ExpandoTextCtrl

Hello,

I want an ExpandoTextCtrl with additional style = wx.TE_DONTWRAP. Additionally I want to set a max height, so the text ctrl can't grow forever. If there are more lines than fit into the given height I want a vertical scrollbar to be shown.

Currently this does not work with the stock ExpandoTextCtrl, because it specifies the (undocumented) wx.TE_NO_VSCROLL style. Once there are too many lines in there, I cannot scroll vertically. So I've tried to change the stock ExpandoTextCtrl. My modified expando.py file and a test case are attached. Just put the three attached files next to each other and run the expandoTest.py file.

The current code works. But the horizontal and vertical scrollbars are always shown, even when the TextCtrl is big enough to show the whole content. My problem is how to show those scrollbars only when needed. Is this possible at all?

-Matthias

expando.py (8.49 KB)

expandoTest.py (5.39 KB)

run.py (4.71 KB)

Nitro wrote:

Hello,

I want an ExpandoTextCtrl with additional style = wx.TE_DONTWRAP. Additionally I want to set a max height, so the text ctrl can't grow forever. If there are more lines than fit into the given height I want a vertical scrollbar to be shown.

Currently this does not work with the stock ExpandoTextCtrl, because it specifies the (undocumented) wx.TE_NO_VSCROLL style. Once there are too many lines in there, I cannot scroll vertically. So I've tried to change the stock ExpandoTextCtrl. My modified expando.py file and a test case are attached. Just put the three attached files next to each other and run the expandoTest.py file.

The current code works. But the horizontal and vertical scrollbars are always shown, even when the TextCtrl is big enough to show the whole content. My problem is how to show those scrollbars only when needed. Is this possible at all?

Probably not. I seem to remember fighting this when I was originally working on the ExpandoTextCtrl. The native widgets have different behaviors here but in general if you put them in a state where they can have scrollbars then they always will, or at least will reserve the space for them.

···

--
Robin Dunn
Software Craftsman

I was afraid you'd say that :slight_smile: Thanks for confirming.

-Matthias

···

Am 30.08.2009, 01:14 Uhr, schrieb Robin Dunn <robin@alldunn.com>:

The current code works. But the horizontal and vertical scrollbars are
always shown, even when the TextCtrl is big enough to show the whole
content. My problem is how to show those scrollbars only when needed. Is
this possible at all?

Probably not. I seem to remember fighting this when I was originally
working on the ExpandoTextCtrl. The native widgets have different
behaviors here but in general if you put them in a state where they can
have scrollbars then they always will, or at least will reserve the
space for them.