Reputation: 1
Last week I was given a requirement for an already crowded display/input screen written in wxPython (data stored in MySQL database) to show the first 24 characters of two free format comment fields but to allow up to 255 characters to be displayed/input. For instance on entry the screen might show “Right hip and knee X-ra” whilst the full entry continues “ys requested 24th September in both laying and standing positions with knee shown straighten and bent through 75 degrees”. Whilst I can create a wxtextCtrl that holds more characters than displayed (scrolls) I cannot work out how to display/enter the contents as a multiline box when selected. I have gone through our wxPython book and searched online with no joy.
Upvotes: 0
Views: 177
Reputation: 22443
Have you considered using my.TextCtrl.SetToolTipString()
and setting it to the same value as the textctrl contents. In this manner only the first 24 characters show in the textctrl but if you hover over it the entire string will be displayed as a tooltip.
Upvotes: 0
Reputation: 22688
The simplest way to do it I see would be to store only the abbreviated contents in wxTextCtrl
itself normally and only replace it with the full contents when the user is about to start editing it (i.e. when you get wxEVT_SET_FOCUS
) and then replace it with the abbreviated version again later (i.e. when you get wxEVT_KILL_FOCUS
).
Upvotes: 1