A BColorControl without RGB text controls?

Is it possible to get a BColorControl without the red, green and blue text controls beside the colour sliders?

I tried the following to get rid of them, but while now invisible, they still take up the space…:

	fNegativeColor =
		new BColorControl(B_ORIGIN, B_CELLS_32x8, 8.0, "colorpicker", new BMessage(M_UPDATE_COLOR));

	BTextControl* widget(NULL);
	widget = (BTextControl*)fNegativeColor->FindView("_red");
	if (widget != NULL)
		bool status = fNegativeColor->RemoveChild(widget);

// repeated for green and blue

	fNegativeColor->Relayout();

Maybe I need to do something else than Relayout()?

Relayout probably won’t do anything because BColorControl doesn’t use the Layout API.

I would suggest ResizeToPreferred() because it calls BColorControl::_LayoutView() but it might crash because it doesn’t check if the red, green, and blue text controls exist before moving them into position.

Hey Dale, long time no see! Hope you’re fine!

I tried ResizeToPreferred() before. Doesn’t crash, but doesn’t work either…
No matter. I can live with those text boxes, just thought it might be nice if I could hide them.

Good to see you still keep an eye on the forum! :slight_smile:

1 Like

That’s too bad. Yeah I didn’t spend a lot of time on this, just took a quick look.

I’m still around, just not active like I wish I could be! :smiley: But I’m doing well; hope you are too.

1 Like