Author: reinhard
Date: 2007-04-07 10:21:52 -0500 (Sat, 07 Apr 2007)
New Revision: 9463
Modified:
trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
Log:
Allow for explicitly setting the dropdown value to None.
Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py 2007-04-07
15:21:30 UTC (rev 9462)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py 2007-04-07
15:21:52 UTC (rev 9463)
@@ -428,12 +428,15 @@
widget.SetEvtHandlerEnabled(False)
try:
- if isinstance (widget, wx.StaticText):
- widget.SetLabel (value)
+ if isinstance(widget, wx.StaticText):
+ widget.SetLabel(value)
- elif isinstance (widget, wx.ListBox):
- if value:
- widget.SetStringSelection (value, True)
+ elif isinstance(widget, wx.ListBox):
+ # TODO: We must allow setting the value to None, too, to be
+ # able to move the cursor to the empty position at the start.
+ # Must be tested under windows and Mac OS X.
+ if not widget.SetStringSelection(value, True):
+ widget.SetSelection(wx.NOT_FOUND)
elif isinstance(widget, wx.CheckBox):
if value is None:
@@ -443,15 +446,13 @@
else:
widget.Set3StateValue(wx.CHK_UNCHECKED)
+ elif isinstance(widget, wx.ComboBox):
+ # We use SetStringSelection to keep the selected index in sync
+ # with the string value (e.g. in Choice-Controls on OS X)
+ if not widget.SetStringSelection(value):
+ widget.SetValue(value)
else:
- if isinstance(widget, wx.ComboBox):
- # We use SetStringSelection to keep the selected index in
- # sync with the string value (e.g. in Choice-Controls on OS
- # X)
- if not widget.SetStringSelection(value):
- widget.SetValue(value)
- else:
- widget.SetValue(value)
+ widget.SetValue(value)
finally:
if self.in_grid and widget._gnue_label_:
_______________________________________________
commit-gnue mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/commit-gnue