[fixed] Perhaps a ComboBox Bug

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
CarlS
Posts: 86
Joined: Wed May 09, 2007 1:21 am
Contact:

Post by CarlS »

I’ve been seeing the same ComboBox problems as GeckoMan and Yoran. The problem didn’t occur with Irrlicht-1.4.2, but showed up in Irrlicht-1.5.

I was able to find a workaround when using a single viewport, but am still stumped on getting it working when the display is in split-screen mode.

I create a control panel with 2 Combo boxes with the lists already loaded. The ComboBox was showing up empty, but clicking anywhere on the control panel containing the ComboBoxes would cause the text to appear in the ComboBox.
The workaround I found was to call env->drawAll() after creating the ComboBox.
If I moved the control panel to a different area of the viewport, or re-sized the viewport, I had to remove the control panel, recreate it in the same location, and again call env->drawAll().

In the case where I’m using split-screen mode, the env->drawAll() approach works fine until I try making a different viewport active.

I’ve been trying to reproduce the problems in a small piece of code I could post in here, but so far I’m only seeing it in the code for our simulation viewer at work which I can’t put online. If I can cut it down to a small program that shows the problem, I'll post it in here.

If anybody has any ideas or patches, I’d be more than happy to try them out.
geckoman
Posts: 143
Joined: Thu Nov 27, 2008 11:05 am
Location: Germany
Contact:

Post by geckoman »

@Acki I don't have setOverrideColor as method of IGUICombobox (does not even apear in the api)

btw I use Irrlicht 1.5
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

geckoman wrote:@Acki I don't have setOverrideColor as method of IGUICombobox (does not even apear in the api)

btw I use Irrlicht 1.5
oh, yes, sorry, it's part of my IrrExtensions !!! :oops:
but if I set the color to black I can see that the item "is" selected and shown !!!
so the problem seems to be that the color gets white, what you also mentioned by setting the box transparent, I think... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
geckoman
Posts: 143
Joined: Thu Nov 27, 2008 11:05 am
Location: Germany
Contact:

Post by geckoman »

So we know it's not my fault, I'm not the only one with problems, can somebody move this to the bug-forum, or do I have to create an own thread there?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

you can do another test to see the color problem !!!
just remove the skin attributes at the beginning of the xml file:

Code: Select all

<?xml version="1.0"?>
<irr_gui>

   <attributes>
     <!-- remove this part -->
   </attributes>

   <element type="button">

      <attributes>
         <int name="Id" value="1" />
         <string name="Caption" value="MainMenu" />
         <rect name="Rect" value="80, 330, 200, 360" />
         <position name="MinSize" value="1, 1" />
         <position name="MaxSize" value="0, 0" />
         <bool name="NoClip" value="false" />
         <enum name="LeftAlign" value="upperLeft" />
         <enum name="RightAlign" value="upperLeft" />
         <enum name="TopAlign" value="upperLeft" />
         <enum name="BottomAlign" value="upperLeft" />
         <bool name="Visible" value="true" />
         <bool name="Enabled" value="true" />
         <bool name="TabStop" value="true" />
         <bool name="TabGroup" value="false" />
         <int name="TabOrder" value="1" />
         <bool name="PushButton" value="true" />
         <bool name="Pressed" value="false" />
         <texture name="Image" value="" />
         <rect name="ImageRect" value="0, 0, 0, 0" />
         <texture name="PressedImage" value="" />
         <rect name="PressedImageRect" value="0, 0, 0, 0" />
         <bool name="Border" value="true" />
         <bool name="UseAlphaChannel" value="false" />
      </attributes>

   </element>

   <element type="tabControl">

      <attributes>
         <int name="Id" value="2" />
         <string name="Caption" value="" />
         <rect name="Rect" value="20, 10, 360, 320" />
         <position name="MinSize" value="1, 1" />
         <position name="MaxSize" value="0, 0" />
         <bool name="NoClip" value="false" />
         <enum name="LeftAlign" value="upperLeft" />
         <enum name="RightAlign" value="upperLeft" />
         <enum name="TopAlign" value="upperLeft" />
         <enum name="BottomAlign" value="upperLeft" />
         <bool name="Visible" value="true" />
         <bool name="Enabled" value="true" />
         <bool name="TabStop" value="false" />
         <bool name="TabGroup" value="false" />
         <int name="TabOrder" value="-1" />
         <int name="ActiveTab" value="0" />
         <bool name="Border" value="true" />
         <bool name="FillBackground" value="true" />
         <int name="TabHeight" value="32" />
         <enum name="TabVerticalAlignment" value="upperLeft" />
      </attributes>

      <element type="tab">

         <attributes>
            <int name="Id" value="101" />
            <string name="Caption" value="Video" />
            <rect name="Rect" value="0, 0, 340, 310" />
            <position name="MinSize" value="1, 1" />
            <position name="MaxSize" value="0, 0" />
            <bool name="NoClip" value="false" />
            <enum name="LeftAlign" value="upperLeft" />
            <enum name="RightAlign" value="upperLeft" />
            <enum name="TopAlign" value="upperLeft" />
            <enum name="BottomAlign" value="upperLeft" />
            <bool name="Visible" value="true" />
            <bool name="Enabled" value="true" />
            <bool name="TabStop" value="false" />
            <bool name="TabGroup" value="false" />
            <int name="TabOrder" value="1" />
            <int name="TabNumber" value="0" />
            <bool name="DrawBackground" value="false" />
            <color name="BackColor" value="00000000" />
            <color name="TextColor" value="fa0a0a0a" />
         </attributes>

         <element type="checkBox">

            <attributes>
               <int name="Id" value="201" />
               <string name="Caption" value="Fullscreen" />
               <rect name="Rect" value="30, 60, 180, 80" />
               <position name="MinSize" value="1, 1" />
               <position name="MaxSize" value="0, 0" />
               <bool name="NoClip" value="false" />
               <enum name="LeftAlign" value="upperLeft" />
               <enum name="RightAlign" value="upperLeft" />
               <enum name="TopAlign" value="upperLeft" />
               <enum name="BottomAlign" value="upperLeft" />
               <bool name="Visible" value="true" />
               <bool name="Enabled" value="true" />
               <bool name="TabStop" value="true" />
               <bool name="TabGroup" value="false" />
               <int name="TabOrder" value="3" />
               <bool name="Checked" value="false" />
            </attributes>

         </element>

         <element type="checkBox">

            <attributes>
               <int name="Id" value="202" />
               <string name="Caption" value="Antialiasing" />
               <rect name="Rect" value="30, 90, 180, 110" />
               <position name="MinSize" value="1, 1" />
               <position name="MaxSize" value="0, 0" />
               <bool name="NoClip" value="false" />
               <enum name="LeftAlign" value="upperLeft" />
               <enum name="RightAlign" value="upperLeft" />
               <enum name="TopAlign" value="upperLeft" />
               <enum name="BottomAlign" value="upperLeft" />
               <bool name="Visible" value="true" />
               <bool name="Enabled" value="true" />
               <bool name="TabStop" value="true" />
               <bool name="TabGroup" value="false" />
               <int name="TabOrder" value="2" />
               <bool name="Checked" value="false" />
            </attributes>

         </element>

         <element type="comboBox">

            <attributes>
               <int name="Id" value="203" />
               <string name="Caption" value="" />
               <rect name="Rect" value="30, 150, 284, 170" />
               <position name="MinSize" value="1, 1" />
               <position name="MaxSize" value="0, 0" />
               <bool name="NoClip" value="true" />
               <enum name="LeftAlign" value="upperLeft" />
               <enum name="RightAlign" value="upperLeft" />
               <enum name="TopAlign" value="upperLeft" />
               <enum name="BottomAlign" value="upperLeft" />
               <bool name="Visible" value="true" />
               <bool name="Enabled" value="true" />
               <bool name="TabStop" value="true" />
               <bool name="TabGroup" value="false" />
               <int name="TabOrder" value="4" />
               <enum name="HTextAlign" value="upperLeft" />
               <enum name="VTextAlign" value="center" />
               <int name="Selected" value="-1" />
               <int name="ItemCount" value="0" />
            </attributes>

         </element>

         <element type="staticText">

            <attributes>
               <int name="Id" value="-1" />
               <string name="Caption" value="Resolution" />
               <rect name="Rect" value="30, 120, 210, 140" />
               <position name="MinSize" value="1, 1" />
               <position name="MaxSize" value="0, 0" />
               <bool name="NoClip" value="false" />
               <enum name="LeftAlign" value="upperLeft" />
               <enum name="RightAlign" value="upperLeft" />
               <enum name="TopAlign" value="upperLeft" />
               <enum name="BottomAlign" value="upperLeft" />
               <bool name="Visible" value="true" />
               <bool name="Enabled" value="true" />
               <bool name="TabStop" value="false" />
               <bool name="TabGroup" value="false" />
               <int name="TabOrder" value="-1" />
               <bool name="Border" value="false" />
               <bool name="OverrideColorEnabled" value="false" />
               <bool name="WordWrap" value="true" />
               <bool name="Background" value="false" />
               <color name="OverrideColor" value="65ffffff" />
               <enum name="HTextAlign" value="upperLeft" />
               <enum name="VTextAlign" value="upperLeft" />
            </attributes>

         </element>

      </element>

      <element type="tab">

         <attributes>
            <int name="Id" value="102" />
            <string name="Caption" value="Game" />
            <rect name="Rect" value="0, 0, 340, 310" />
            <position name="MinSize" value="1, 1" />
            <position name="MaxSize" value="0, 0" />
            <bool name="NoClip" value="false" />
            <enum name="LeftAlign" value="upperLeft" />
            <enum name="RightAlign" value="upperLeft" />
            <enum name="TopAlign" value="upperLeft" />
            <enum name="BottomAlign" value="upperLeft" />
            <bool name="Visible" value="false" />
            <bool name="Enabled" value="true" />
            <bool name="TabStop" value="false" />
            <bool name="TabGroup" value="false" />
            <int name="TabOrder" value="2" />
            <int name="TabNumber" value="1" />
            <bool name="DrawBackground" value="false" />
            <color name="BackColor" value="00000000" />
            <color name="TextColor" value="fa0a0a0a" />
         </attributes>

      </element>

   </element>

</irr_gui>
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
geckoman
Posts: 143
Joined: Thu Nov 27, 2008 11:05 am
Location: Germany
Contact:

Post by geckoman »

Nothing changes.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

realy ??? :shock:
when I remove this part I get this screen (just loaded, nothing clicked):
Image

EDIT: I also get this result when I use your 2nd xml file (the one with the items in it)...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
geckoman
Posts: 143
Joined: Thu Nov 27, 2008 11:05 am
Location: Germany
Contact:

Post by geckoman »

Sure SOMETHING changes, transparency etc. but not the combobox thing. I see in your Screenshot, you can only see the aaa2 text because the gui is transparent, the color of the text is WHITE too! Thats wrong...
drewbacca
Posts: 38
Joined: Tue Jan 30, 2007 6:49 pm

Post by drewbacca »

I had similar problems with gui fields not populating until I clicked the windows that contained the elements. I fixed my problems by setting the focus to the window that contained my gui elements right after I would create them.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

geckoman wrote:you can only see the aaa2 text because the gui is transparent, the color of the text is WHITE too! Thats wrong...
that's right, it was only meant to show this... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
CarlS
Posts: 86
Joined: Wed May 09, 2007 1:21 am
Contact:

Post by CarlS »

drewbacca wrote:I had similar problems with gui fields not populating until I clicked the windows that contained the elements. I fixed my problems by setting the focus to the window that contained my gui elements right after I would create them.
Resetting the focus also fixed the issue I had in split screen mode, where the ComboBox text disappeared when the active window was changed.
Thanks for posting that.
geckoman
Posts: 143
Joined: Thu Nov 27, 2008 11:05 am
Location: Germany
Contact:

Post by geckoman »

Yes thanks for this workaround.

I hope this bug will be fixed soon.
drewbacca
Posts: 38
Joined: Tue Jan 30, 2007 6:49 pm

Post by drewbacca »

If I had to guess at the problem, it's due to the text color incorrectly being white, as pointed out earlier in the thread.

The text color is only changed when the focus changes:
from draw() in CGUIComboBox.cpp:

Code: Select all

if (currentFocus != LastFocus)
{
    HasFocus = currentFocus == this || isMyChild(currentFocus);
    LastFocus = currentFocus;

    SelectedText->setBackgroundColor(skin->getColor(EGDC_HIGH_LIGHT));
    SelectedText->setDrawBackground(HasFocus);
    SelectedText->setOverrideColor(skin->getColor(HasFocus ? EGDC_HIGH_LIGHT_TEXT : EGDC_BUTTON_TEXT));
}
so if the focus doesn't change, the text color is never changed from it's default value.

I can't seem to reproduce the problem on my side anymore. Can you guys try editing the contructor for CGUIComboBox by adding the line

Code: Select all

SelectedText->setOverrideColor(skin->getColor(EGDC_BUTTON_TEXT));
right after

Code: Select all

SelectedText->enableOverrideColor(true);
kaos
Posts: 155
Joined: Tue Aug 12, 2008 8:25 pm
Location: Spain

Post by kaos »

I have the same problem too
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

This should be fixed in svn trunk now. Admittedly I didn't recreate the problem before applying the fix, but the complaints are about white text which comes from the CGUIStaticText constructor.
Thanks for finding this drewbacca :)
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Post Reply