[wxpython-users] A TextCtrl's GetValue method problem

Robin Dunn robin at alldunn.com
Wed May 14 15:24:04 PDT 2008


gaobing wrote:
> Hi, everyone!
> 
> When I read the book "wxPython in action" by Robin Dunn, in the section 
> "7.1.7 What if my text control doesn’t match my string?" ,the author 
> said that:
> "
> and the following results from a Windows operating system:
> getValue 121
> lastPos 119
> "
> 
> I used the code example from the book, but I got the following result:
> getValue 119
> lastPos 121
> 
> Also, if I changed the textctrl style to the 
> "wx.TE_MULTILINE|wx.TE_RICH", then the result would be:
> getValue 119
> lastPos 119
> 
> I could not understand why the result was not as what the author said. 
> Can you give me an answer?

I think the values in the book are backwards.  But the main point of
that section is not exactly how certain things work, but that anything
that depends on the internal representation of the text in the widget
should not be counted on to behave in any predefined manner.


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!



More information about the wxpython-users mailing list