[fixed] Perhaps a ComboBox Bug
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.
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.
oh, yes, sorry, it's part of my IrrExtensions !!!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
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:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
you can do another test to see the color problem !!!
just remove the skin attributes at the beginning of the xml file:
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:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
realy ???
when I remove this part I get this screen (just loaded, nothing clicked):
EDIT: I also get this result when I use your 2nd xml file (the one with the items in it)...
when I remove this part I get this screen (just loaded, nothing clicked):
EDIT: I also get this result when I use your 2nd xml file (the one with the items in it)...
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
that's right, it was only meant to show this...geckoman wrote:you can only see the aaa2 text because the gui is transparent, the color of the text is WHITE too! Thats wrong...
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Resetting the focus also fixed the issue I had in split screen mode, where the ComboBox text disappeared when the active window was changed.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.
Thanks for posting that.
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:
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
right after
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));
}
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));
Code: Select all
SelectedText->enableOverrideColor(true);