Page 1 of 2

ComboBox drop down text options not visible

Posted: Wed Feb 04, 2009 21:52
by tpynegar
Hey,

I've got some combo box's in a Frame and i'm using the Windows looknfeel. I've tried to populate these combox box's and the text in the drop downs is not visible. When i select one of these options which obviously i can't see it is selected and it's correct entry is put into the main text area of the combox box. I haven't built from source and that's going to be the next move but thought i'd ask here and see if anyone has had anything similar happen. I've got other combo box's working on other pages. I seem to get a lot of these messages in the CEGUI.log, about been added to dead pool, i've done some googling but nothing came up.

Thanks,
Tim.

04/02/2009 21:46:34 (InfL2) Window 'Editor/frmPlayer/cbEthnicOrigin__auto_editbox__' has been added to dead pool.
04/02/2009 21:46:34 (InfL2) Window 'Editor/frmPlayer/cbEthnicOrigin__auto_droplist____auto_hscrollbar____auto_incbtn__' has been added to dead pool.
04/02/2009 21:46:34 (InfL2) Window 'Editor/frmPlayer/cbEthnicOrigin__auto_droplist____auto_hscrollbar____auto_decbtn__' has been added to dead pool.
04/02/2009 21:46:34 (InfL2) Window 'Editor/frmPlayer/cbEthnicOrigin__auto_droplist____auto_hscrollbar____auto_thumb__' has been added to dead pool.
04/02/2009 21:46:34 (InfL2) Window 'Editor/frmPlayer/cbEthnicOrigin__auto_droplist____auto_hscrollbar__' has been added to dead pool.
04/02/2009 21:46:34 (InfL2) Window 'Editor/frmPlayer/cbEthnicOrigin__auto_droplist____auto_vscrollbar____auto_incbtn__' has been added to dead pool.
04/02/2009 21:46:34 (InfL2) Window 'Editor/frmPlayer/cbEthnicOrigin__auto_droplist____auto_vscrollbar____auto_decbtn__' has been added to dead pool.
04/02/2009 21:46:34 (InfL2) Window 'Editor/frmPlayer/cbEthnicOrigin__auto_droplist____auto_vscrollbar____auto_thumb__' has been added to dead pool.
04/02/2009 21:46:34 (InfL2) Window 'Editor/frmPlayer/cbEthnicOrigin__auto_droplist____auto_vscrollbar__' has been added to dead pool.
04/02/2009 21:46:34 (InfL2) Window 'Editor/frmPlayer/cbEthnicOrigin__auto_droplist__' has been added to dead pool.
04/02/2009 21:46:34 (InfL2) Window 'Editor/frmPlayer/cbEthnicOrigin__auto_button__' has been added to dead pool.
04/02/2009 21:46:34 (InfL2) Window 'Editor/frmPlayer/cbEthnicOrigin' has been added to dead pool.

Posted: Thu Feb 05, 2009 09:39
by CrazyEddie
Hi,

I think the combobox list is getting clipped to the edge of the containing window. You might set the combo box (or even just the list) so that it's not clipped by parent. This is done via the Window::setClippedByParent function or via the "ClippedByParent" property.

Those log messages are normal, and indicate the window objects are listed for destruction (as happens when you close the app, for example).

HTH

CE.

Posted: Thu Feb 05, 2009 12:06
by Pompei2
If I understand you correctly, I had this problem long time ago and it was just that the font color was exactly the same as the list's background, maybe it's that for you too?

Posted: Thu Feb 05, 2009 23:01
by tpynegar
Thanks for your replys, in the tool i've changed the "Clipped by parent" to false and with the font it's on "Bold" but so is everything else on the form so i'm not sure why it is.

I've posted the .layout file for this form and also the code i use to populate the combobox. If you've got a moment to take a look at it i'd really appricate it.

CEGUI::Combobox * lpEthnicOriginComboBox = getComboboxPnt( "Editor/frmPlayer/cbEthnicOrigin" );

CEGUI::ListboxTextItem* item;
item = new CEGUI::ListboxTextItem((CEGUI::utf8*)"Entry1", 1);
item->setText( "Entry1" );
lpEthnicOriginComboBox->addItem(item);

item = new CEGUI::ListboxTextItem((CEGUI::utf8*)"Entry2", 2);
item->setText( "Entry2" );
lpEthnicOriginComboBox->addItem(item);


<Window Type="WindowsLook/FrameWindow" Name="Editor/frmPlayer" >
<Property Name="Text" Value="Player" />
<Property Name="TitlebarFont" Value="Bold" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="TitlebarEnabled" Value="True" />
<Property Name="UnifiedAreaRect" Value="{{0,0},{0,50},{0,300},{0,591}}" />
<Window Type="WindowsLook/StaticText" Name="Editor/frmPlayer/lbName" >
<Property Name="Text" Value="Name" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedAreaRect" Value="{{0,15},{0,50},{0,115},{0,80}}" />
</Window>
<Window Type="WindowsLook/Editbox" Name="Editor/frmPlayer/txtName" >
<Property Name="MaxTextLength" Value="1073741823" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedAreaRect" Value="{{0,130},{0,50},{0,280},{0,80}}" />
</Window>
<Window Type="WindowsLook/StaticText" Name="Editor/frmPlayer/lbGroup" >
<Property Name="Text" Value="Group" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedAreaRect" Value="{{0,15},{0,90},{0,115},{0,120}}" />
</Window>
<Window Type="WindowsLook/Editbox" Name="Editor/frmPlayer/txtGroup" >
<Property Name="MaxTextLength" Value="1073741823" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedAreaRect" Value="{{0,130},{0,90},{0,280},{0,120}}" />
</Window>
<Window Type="WindowsLook/StaticText" Name="Editor/frmPlayer/lbRole" >
<Property Name="Text" Value="Role" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedAreaRect" Value="{{0,15},{0,200},{0,110},{0,230}}" />
</Window>
<Window Type="WindowsLook/Combobox" Name="Editor/frmPlayer/cbRole" >
<Property Name="Font" Value="Regular" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="ClippedByParent" Value="False" />
<Property Name="UnifiedAreaRect" Value="{{0,15},{0,240},{0,285},{0,377}}" />
<Property Name="MaxEditTextLength" Value="1073741823" />
</Window>
<Window Type="WindowsLook/StaticText" Name="Editor/frmPlayer/lbAnimState1" >
<Property Name="Text" Value="Anim 1" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedAreaRect" Value="{{0,15},{0,280},{0,120},{0,310}}" />
</Window>
<Window Type="WindowsLook/Combobox" Name="Editor/frmPlayer/cbAnim1" >
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="ClippedByParent" Value="False" />
<Property Name="UnifiedAreaRect" Value="{{0,15},{0,320},{0,285},{0,449}}" />
<Property Name="MaxEditTextLength" Value="1073741823" />
</Window>
<Window Type="WindowsLook/Editbox" Name="Editor/frmPlayer/txtTime" >
<Property Name="MaxTextLength" Value="1073741823" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedAreaRect" Value="{{0,210},{0,440},{0,260},{0,470}}" />
</Window>
<Window Type="WindowsLook/StaticText" Name="Editor/frmPlayer/lbEthnicity" >
<Property Name="Font" Value="Bold" />
<Property Name="Text" Value="Ethnicity" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedAreaRect" Value="{{0,15},{0,130},{0,150},{0,160}}" />
</Window>
<Window Type="WindowsLook/StaticText" Name="Editor/frmPlayer/lbAnimState2" >
<Property Name="Font" Value="Bold" />
<Property Name="Text" Value="Anim 2" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedAreaRect" Value="{{0,15},{0,360},{0,120},{0,390}}" />
</Window>
<Window Type="WindowsLook/Combobox" Name="Editor/frmPlayer/cbAnim2" >
<Property Name="Font" Value="Bold" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="ClippedByParent" Value="False" />
<Property Name="UnifiedAreaRect" Value="{{0,15},{0,400},{0,285},{0,520}}" />
<Property Name="MaxEditTextLength" Value="1073741823" />
</Window>
<Window Type="WindowsLook/StaticText" Name="Editor/frmPlayer/lbBlendPeriod" >
<Property Name="Text" Value="Blend Period" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedAreaRect" Value="{{0,15},{0,440},{0,200},{0,470}}" />
</Window>
<Window Type="WindowsLook/Checkbox" Name="Editor/frmPlayer/ckbSkeleton" >
<Property Name="Text" Value="Skeleton" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedAreaRect" Value="{{0,15},{0,480},{0,160},{0,510}}" />
</Window>
<Window Type="WindowsLook/Combobox" Name="Editor/frmPlayer/cbEthnicOrigin" >
<Property Name="Font" Value="Commonwealth-10" />
<Property Name="ReadOnly" Value="True" />
<Property Name="AlwaysOnTop" Value="True" />
<Property Name="InheritsAlpha" Value="False" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="ClippedByParent" Value="False" />
<Property Name="UnifiedAreaRect" Value="{{0,13},{0,159},{0,283},{0,417}}" />
<Property Name="MaxEditTextLength" Value="1073741823" />
</Window>
</Window>

Posted: Fri Feb 06, 2009 06:35
by gamecat
I'm having the exact same problem, which is what prompted me to upgrade from CEGUI 6.0 to 6.2 (see the 'Building CEGUI 6.2 for MinGw' thread for the gory details). That didn't fix it however.

My next step was going to be to get a Debug build going so that I could step through it. I'll be inerested in seeing how you fix your problem. I'll post if I figure out anything on my own.

gamecat

Posted: Fri Feb 06, 2009 06:37
by gamecat
BTW, do you happen to be using Ogre3d + Code::Blocks?

Posted: Fri Feb 06, 2009 09:38
by CrazyEddie
Hi,

I did not test the layout, but looking at the code posted above, Pompei2 was indeed correct when he mentioned the text colour. The CEGUI::ListboxTextItem defaults to white, when rendered on a white background as in the WindowsLook list widgets, obviously you don't see anything :)

You should set the text colours to something more appropriate:

Code: Select all

item->setTextColours( 0xFF000000 );


You probably also want to set an image to be used as the highlight 'brush' also,

Code: Select all

item->setSelectionBrushImage( "WindowsLook", "Background" );


HTH

CE.

Posted: Sat Feb 07, 2009 02:48
by gamecat
setTextColours fixed it for me. :-/

Does this mean that the default text color is white? Not quite what I was expecting. Funny thing is, the text that I apply directly to the window via setText shows up as black, but I have to set the color on the ListBoxTextItems in order for them to show.

Anyway, thanks!

Posted: Sat Feb 07, 2009 09:25
by CrazyEddie
Yeah, the default colour is white.

The thing about having the black default for other parts in WindowsLook is because other parts are Window and looknfeel skin based, so we can modify the defaults, whereas the ListboxTextItem is more of a lightweight content class that has no skinning, as such the defaults are hard-coded.

One recommendation I usually make is to subclass ListboxTextItem in order to provide suitable defaults for the text colour and selection brush (as we do in demo 7)

CE.

Posted: Sun Feb 08, 2009 00:26
by gamecat
I did end up wrapping ListTextBoxItem, but may I also suggest changing

const colour ListboxTextItem::DefaultTextColour = 0xFFFFFFFF;

to

const colour ListboxTextItem::DefaultTextColour = 0xFF000000;

?

Posted: Sun Feb 08, 2009 08:45
by CrazyEddie
I could do that, but then anyone using a skin that uses dark backgrounds (such as TaharezLook) would then have the same issue, but in reverse ;) Overall the "best" solution has been to leave things as they are (although this solution is not ideal).

Posted: Mon Feb 09, 2009 10:44
by Pompei2
You could also have the default ListboxTextItem query the looknfeel's background color, calculate its "darkness" and automagically switch from white to black :)

Posted: Mon Feb 09, 2009 14:30
by tpynegar
Thanks that fine now.

Posted: Tue Feb 10, 2009 08:26
by gamecat
I guess that I just assumed that white backgrounds were more prevalent than black backgrounds. Well, my problem's fixed. The next poor bloke can figure it out by reading the forums. ;-)

Posted: Tue Feb 10, 2009 09:40
by CrazyEddie
Pompei2 wrote:You could also have the default ListboxTextItem query the looknfeel's background color, calculate its "darkness" and automagically switch from white to black :)

This is a possibility, thanks for the idea. I'll look into it in more detail once that "other job" I'm working on is done ;)

CE.