So I thought what if I could call the KeyEvent WXK.HOME after the text
value is set. In effect putting the cursor back to the beginning of the
text field.
My main question is how to create this KeyEvent programmatically?
Or maybe someone has another suggestion for how to go about this.
Thank you very much all,
Keith Bolton
BPC
> I tried to Set the insertion point back at the beginning of the text,
>but I cannot.
Do you mean, nothing happens?
Maybe you could try: SetSelection (0,0)
--
Franz Steinhäusler
DrPython (Project Developer)
http://drpython.sourceforge.net/
http://sourceforge.net/projects/drpython/
Here's my code snippet:
def onFocusCurrentTime(self, event):
#When this field gets focus...
if self.buttondef == 0:
#If some condition is set, calculate the
current time.
self.endtime.SetValue(wx.DateTime_Now().Format("%H:%M"))
#Sets the value of field to current time(SetValue by default puts the
cursor at the end).
self.endtime.SetInsertionPoint(-1)
#I want the cursor to be at the
beginning of the text. This part doesn't work.
elif self.buttondef <> 0:
#If the other condition, don't do anything.
event.Skip()
Thanks,
Keith
>>> franz.ste...@gmx.at 10/01/04 04:47:02 AM >>>
--
Franz Steinhäusler
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-user...@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-...@lists.wxwidgets.org
class MyPanel(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id, wx.DefaultPosition, wx.DefaultSize)
self.txt1 = wx.TextCtrl(self, wx.NewId(), 'aa bb cc', (20, 20), (500, 20))
self.txt1.SetValue('999')
wx.CallAfter(self.JobCallAfter) <<<<<<<<<<<<<<<<<<<<
def JobCallAfter(self):
#~ self.txt1.SetLabel('aaa bbb')
#~ self.txt1.SetInsertionPointEnd()
self.txt1.SetInsertionPoint(0)
#~ self.txt1.SetSelection(0, 3)
Jean-Michel Fauth, Switzerland
You can't, not in a way that the native control will get the event anyway.
>
> Or maybe someone has another suggestion for how to go about this.
Do this:
wx.CallAfter(textctrl.SetInsertionPoint, 0)
And in the next EVT_IDLE the SetInsertionPoint will be called with a
parameter of zero.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!