[fixed]combobox appearance not affected by enabled state

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.
Post Reply
drewbacca
Posts: 38
Joined: Tue Jan 30, 2007 6:49 pm

[fixed]combobox appearance not affected by enabled state

Post by drewbacca »

The combo box control has no visual indication when it is disabled. I haven't checked other gui elements to see if they also have similar problems. I made the following change to disable the blue highlight on click and give it grey text so the user knows the combobox is disabled:

from CGUIComboBox.cpp in draw()

Code: Select all

@@ -343,8 +343,16 @@
 		LastFocus = currentFocus;
 
 		SelectedText->setBackgroundColor(skin->getColor(EGDC_HIGH_LIGHT));
-		SelectedText->setDrawBackground(HasFocus);
-		SelectedText->setOverrideColor(skin->getColor(HasFocus ? EGDC_HIGH_LIGHT_TEXT : EGDC_BUTTON_TEXT));
+        if (isEnabled())
+        {
+            SelectedText->setDrawBackground(HasFocus);
+		    SelectedText->setOverrideColor(skin->getColor(HasFocus ? EGDC_HIGH_LIGHT_TEXT : EGDC_BUTTON_TEXT));
+        }
+        else
+        {
+            SelectedText->setDrawBackground(false);
+            SelectedText->setOverrideColor(skin->getColor(EGDC_GRAY_TEXT));
+        }
 	}
 
 	core::rect<s32> frameRect(AbsoluteRect);
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Thanks, committed to the trunk in SVN 2115.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply