wxTextCtrl

Hi,

I have a questing about wxTextCtrl. Right now, I have a wxTextCtrl, which
width will be changed by the user (it is placed in a wxSashWindow). I
don't want the TextCtrl to have a vertical scroll but limit the text to
two lines followed by ... if the text is cut of. I have tried to do this
by calling following code on an onSize event:

textctrl.SetValue("Some text")
line1 = textctrl.GetLineText(0)
text = line1

if(textctrl.GetNumberOfLines()>1):
  line2 = textctrl.GetLineText(1)
  text = text+line2
    
textctrl.SetValue(text)

However, GetNumberOfLines() and GetLineText() doesn't seem to relate to
current size of the TextCtrl (it returns a much higher number than I can
see on screen)

If you have any ideas of how I can do this, please give me a hint.

Thanks,

Susanne

Susanne Lefvert wrote:

However, GetNumberOfLines() and GetLineText() doesn't seem to relate to
current size of the TextCtrl (it returns a much higher number than I can
see on screen)

Sounds like a bug then. Please report version, platform and provide a small sample app that shows the problem.

···

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