I have a wxComboBox that I am using to select the number of sheets to run through our machine. I'd like to "lock" it so that it won't update the expected number of sheets to feed. I've successfully done that by capturing the event, and simply returning before the function that updates the GUI counters is called. However I'd like to have the number in the text field of the combo box remain "static". So I have tried to do a SetValue(xxx) on the box in the event handling function, however the text field won't change off of what is newly selected. I've tried changing the focus to another control prior to writing, I've created another function that I call which attempts to write to the text field. Nothing I can think of allows me to write the old value back into the text field. I've also tried Undo() with no luck. Anyone have any thoughts or experiences on this. I'm guessing it has something to do with the fact that I am still in the event handler. I can successfully write a value into the text field in other parts of the program with no problems, however that is outside of a text/combobox event.
I have a wxComboBox that I am using to select the number of sheets to run through our machine. I'd like to "lock" it so that it won't update the expected number of sheets to feed. I've successfully done that by capturing the event, and simply returning before the function that updates the GUI counters is called. However I'd like to have the number in the text field of the combo box remain "static".
I don't really understand what you want to do. Do you want a ComboBox without an editable field? Did you look at wx.Choice? Or the ComboBox style wx.CB_READONLY which disables editing. If you don't want the user to even use the drop-down list, you can use the .Enable() method.
Nicolas
···
--
"If you try to stay sane in life, it'll just
drive you crazy. So, you may as well go crazy
now and have fun with life."
--MegaZone
I would like to lock the combo box during the sheet feeding, and then unlock it after the run is over. This prevents the user from changing the number of sheets requested display during the run. Under normal conditions the combo box is editable so that the user can either select one of the dropdown selections for number of sheets to feed, or can enter their own value. I have not tried an enable/disable on the control. I will try that. Thank you for you assistance.
Greg Miller
···
From: Nicolas Briche <nbriche@free.fr>
Reply-To: wxPython-users@lists.wxwidgets.org
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] wxComboBox text won't update
Date: Wed, 25 Jan 2006 15:34:55 +0100
Gregory Miller a �crit :
I have a wxComboBox that I am using to select the number of sheets to run through our machine. I'd like to "lock" it so that it won't update the expected number of sheets to feed. I've successfully done that by capturing the event, and simply returning before the function that updates the GUI counters is called. However I'd like to have the number in the text field of the combo box remain "static".
I don't really understand what you want to do. Do you want a ComboBox without an editable field? Did you look at wx.Choice? Or the ComboBox style wx.CB_READONLY which disables editing. If you don't want the user to even use the drop-down list, you can use the .Enable() method.
Nicolas
--
"If you try to stay sane in life, it'll just
drive you crazy. So, you may as well go crazy
now and have fun with life."
--MegaZone
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
I have a wxComboBox that I am using to select the number of sheets to run through our machine. I'd like to "lock" it so that it won't update the expected number of sheets to feed. I've successfully done that by capturing the event, and simply returning before the function that updates the GUI counters is called. However I'd like to have the number in the text field of the combo box remain "static". So I have tried to do a SetValue(xxx) on the box in the event handling function, however the text field won't change off of what is newly selected. I've tried changing the focus to another control prior to writing, I've created another function that I call which attempts to write to the text field. Nothing I can think of allows me to write the old value back into the text field. I've also tried Undo() with no luck. Anyone have any thoughts or experiences on this. I'm guessing it has something to do with the fact that I am still in the event handler. I can successfully write a value into the text field in other parts of the program with no problems, however that is outside of a text/combobox event.
The text field is probably updated after the event handler has completed, so any changes you made are overwritten. So what you want to do is not make your change until after the native control updates itself. You can do this using wx.CallAfter(combo.SetValue, "text").
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I ended up using the Enable()/Disable(), which did exactly what I wanted it to do. Thanks to all for your input!!
Greg Miller
···
From: Robin Dunn <robin@alldunn.com>
Reply-To: wxPython-users@lists.wxwidgets.org
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] wxComboBox text won't update
Date: Wed, 25 Jan 2006 15:11:34 -0800
Gregory Miller wrote:
I have a wxComboBox that I am using to select the number of sheets to run through our machine. I'd like to "lock" it so that it won't update the expected number of sheets to feed. I've successfully done that by capturing the event, and simply returning before the function that updates the GUI counters is called. However I'd like to have the number in the text field of the combo box remain "static". So I have tried to do a SetValue(xxx) on the box in the event handling function, however the text field won't change off of what is newly selected. I've tried changing the focus to another control prior to writing, I've created another function that I call which attempts to write to the text field. Nothing I can think of allows me to write the old value back into the text field. I've also tried Undo() with no luck. Anyone have any thoughts or experiences on this. I'm guessing it has something to do with the fact that I am still in the event handler. I can successfully write a value into the text field in other parts of the program with no problems, however that is outside of a text/combobox event.
The text field is probably updated after the event handler has completed, so any changes you made are overwritten. So what you want to do is not make your change until after the native control updates itself. You can do this using wx.CallAfter(combo.SetValue, "text").
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org