TextCtrl EVT_TEXT : because typed or SetValue ?
can it be discerned?
Robert
TextCtrl EVT_TEXT : because typed or SetValue ?
can it be discerned?
Robert
Robert,
On Jul 31, 4:06 pm, Robert <kxrobe...@googlemail.com> wrote:
TextCtrl EVT_TEXT : because typed or SetValue ?
can it be discerned?Robert
I'm pretty sure it's only fired when the text is entered via the
keyboard, although you might have to have the wx.WANTS_CHARS style
turned on. You can probably simulate it with wx.PostEvent.
- Mike
Robert wrote:
TextCtrl EVT_TEXT : because typed or SetValue ?
can it be discerned?
I don't think so.
What about using ChangeValue instead of SetValue?
wxTextCtrl::ChangeValue
virtual void ChangeValue(const wxString& value)
Sets the text value and marks the control as not-modified (which means that IsModified would return false immediately after the call to SetValue).
Note that this function will not generate the wxEVT_COMMAND_TEXT_UPDATED event. This is the only difference with SetValue. See this topic for more information.
This function is new since wxWidgets version 2.7.1
Werner
Mike Driscoll wrote:
Robert,
TextCtrl EVT_TEXT : because typed or SetValue ?
can it be discerned?Robert
I'm pretty sure it's only fired when the text is entered via the
keyboard, although you might have to have the wx.WANTS_CHARS style
turned on. You can probably simulate it with wx.PostEvent.
>>> fe.phi.SetValue('0.1')
`OnPhiText' EventType: 10164 ExtraLong: 0
>>>
`OnPhiText' EventType: 10164 ExtraLong: 0 #digit typed
hmm.. its always the same (Windows). And no other interesting attributes found, so perhaps no means on the control/event level.
>>> dir(event_text)
['Checked', 'ClassName', 'ClientData', 'ClientObject', 'Clone', 'Destroy', 'EventObject', 'EventType', 'ExtraLong', 'GetClassName', 'GetClientData', 'GetClientObject', 'GetEventObject', 'GetEventType', 'GetExtraLong', 'GetId', 'GetInt', 'GetSelection', 'GetSkipped', 'GetString', 'GetTimestamp', 'Id', 'Int', 'IsChecked', 'IsCommandEvent', 'IsSameAs', 'IsSelection', 'ResumePropagation', 'Selection', 'SetClientData', 'SetClientObject', 'SetEventObject', 'SetEventType', 'SetExtraLong', 'SetId', 'SetInt', 'SetString', 'SetTimestamp', 'ShouldPropagate', 'Skip', 'Skipped', 'StopPropagation', 'String', 'Timestamp', '__class__', '__del__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__swig_destroy__', '__weakref__', 'this', 'thisown']
wx.WANTS_CHARS style seem to catch TAB,arrow keys etc., - not really to do with the problem here.
Perhaps I just shall/can compare the changed ctrl values against the data storage (from which .SetValue()'s mostly origin) - or against a artificial last_setvalue attribute, like
fe.phi.last_setvalue = '0.1'
.. and run the change reaction only when a difference - thus on a higher level. Detection of adding spaces/nulls/neutrals etc. is not so important or even desirable...
Robert
On Jul 31, 4:06 pm, Robert <kxrobe...@googlemail.com> wrote:
Werner F. Bruhin wrote:
Robert wrote:
TextCtrl EVT_TEXT : because typed or SetValue ?
can it be discerned?
I don't think so.
What about using ChangeValue instead of SetValue?
wxTextCtrl::ChangeValue
virtual void ChangeValue(const wxString& value)
Sets the text value and marks the control as not-modified (which means that IsModified would return false immediately after the call to SetValue).
Note that this function will not generate the wxEVT_COMMAND_TEXT_UPDATED event. This is the only difference with SetValue. See this topic for more information.
This function is new since wxWidgets version 2.7.1
thanks, work on first trials.
Then it seems ChangeValue() should be the default tool in all Dialog Data Transfer instead of SetValue() ? Hope this has no further side effects, when I change it so for the whole app...
Robert
Robert wrote:
Werner F. Bruhin wrote:
Robert wrote:
TextCtrl EVT_TEXT : because typed or SetValue ?
can it be discerned?
I don't think so.
What about using ChangeValue instead of SetValue?
wxTextCtrl::ChangeValue
virtual void ChangeValue(const wxString& value)
Sets the text value and marks the control as not-modified (which means that IsModified would return false immediately after the call to SetValue).
Note that this function will not generate the wxEVT_COMMAND_TEXT_UPDATED event. This is the only difference with SetValue. See this topic for more information.
This function is new since wxWidgets version 2.7.1thanks, work on first trials.
Then it seems ChangeValue() should be the default tool in all Dialog Data Transfer instead of SetValue() ? Hope this has no further side effects, when I change it so for the whole app...
That is what I use for all controls when loading the data from the database and it works great for me. There were a few issues with the wx.lib.masked controls, but they are fixed in recent releases (I am on wxPython 2.8.10.1).
Only controls I am aware of/use which don't have ChangeValue are wx.CheckBox and wx.DatePickerCtrl.
Werner
Werner F. Bruhin wrote:
Robert wrote:
Werner F. Bruhin wrote:
Robert wrote:
TextCtrl EVT_TEXT : because typed or SetValue ?
can it be discerned?
I don't think so.
What about using ChangeValue instead of SetValue?
wxTextCtrl::ChangeValue
virtual void ChangeValue(const wxString& value)
Sets the text value and marks the control as not-modified (which means that IsModified would return false immediately after the call to SetValue).
Note that this function will not generate the wxEVT_COMMAND_TEXT_UPDATED event. This is the only difference with SetValue. See this topic for more information.
This function is new since wxWidgets version 2.7.1thanks, work on first trials.
Then it seems ChangeValue() should be the default tool in all Dialog Data Transfer instead of SetValue() ? Hope this has no further side effects, when I change it so for the whole app...
That is what I use for all controls when loading the data from the database and it works great for me. There were a few issues with the wx.lib.masked controls, but they are fixed in recent releases (I am on wxPython 2.8.10.1).
Only controls I am aware of/use which don't have ChangeValue are wx.CheckBox and wx.DatePickerCtrl.
Here ('2.8.9.2 (msw-unicode)') the wx.ComboBox - relevant frequently regarding EVT_TEXT - also doesn't have ChangeValue.
That would be a reason for update if latest wxPython version does have now ...
Robert
Robert wrote:
Werner F. Bruhin wrote:
Robert wrote:
Werner F. Bruhin wrote:
Robert wrote:
TextCtrl EVT_TEXT : because typed or SetValue ?
can it be discerned?
I don't think so.
What about using ChangeValue instead of SetValue?
wxTextCtrl::ChangeValue
virtual void ChangeValue(const wxString& value)
Sets the text value and marks the control as not-modified (which means that IsModified would return false immediately after the call to SetValue).
Note that this function will not generate the wxEVT_COMMAND_TEXT_UPDATED event. This is the only difference with SetValue. See this topic for more information.
This function is new since wxWidgets version 2.7.1thanks, work on first trials.
Then it seems ChangeValue() should be the default tool in all Dialog Data Transfer instead of SetValue() ? Hope this has no further side effects, when I change it so for the whole app...
That is what I use for all controls when loading the data from the database and it works great for me. There were a few issues with the wx.lib.masked controls, but they are fixed in recent releases (I am on wxPython 2.8.10.1).
Only controls I am aware of/use which don't have ChangeValue are wx.CheckBox and wx.DatePickerCtrl.
Here ('2.8.9.2 (msw-unicode)') the wx.ComboBox - relevant frequently regarding EVT_TEXT - also doesn't have ChangeValue.
That would be a reason for update if latest wxPython version does have now ...
Nope, no ChangeValue, but:
wxControlWithItems::SetStringSelection
bool SetStringSelection(const wxString& string)
Selects the item with the specified string in the control. This doesn't cause any command events being emitted.
Werner