This is odd. I moved text.AppendText("what\n") around. Problem occurs when it's before dialog.Show(), but not if it's after.
Works:
import wx
app= wx.PySimpleApp()
dialog= wx.Dialog( None )
text= wx.TextCtrl( dialog, style=wx.TE_MULTILINE )
sizer= wx.BoxSizer()
sizer.Add(text, 1, wx.EXPAND)
dialog.SetSizer(sizer)
dialog.Center()
dialog.Show()
text.AppendText("what\n")
app.MainLoop()
Breaks:
import wx
app= wx.PySimpleApp()
dialog= wx.Dialog( None )
text= wx.TextCtrl( dialog, style=wx.TE_MULTILINE )
sizer= wx.BoxSizer()
sizer.Add(text, 1, wx.EXPAND)
dialog.SetSizer(sizer)
dialog.Center()
text.AppendText("what\n")
dialog.Show()
app.MainLoop()
ยทยทยท
-------------- Original message ----------------------
From: "Rickey, Kyle W" <Kyle.Rickey@bakerhughes.com>
Sent: Wednesday, January 16, 2008 3:11 PM
I'm having a small problem with the TextCtrl, whenever I AppendText()
everything in the TextCtrl is selected. I tried calling SetSelection(0,
0) to deslect the text, but nothing happened. Any ideas?