Page 1 of 1

[fixed]combobox appearance not affected by enabled state

Posted: Wed Jan 21, 2009 2:39 pm
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);

Posted: Wed Jan 21, 2009 3:16 pm
by rogerborg
Thanks, committed to the trunk in SVN 2115.