I would like to use a wxTextCtrl in PythonCard for static text, simply
setting the editable flag to 0 by default, but the native text control
always has a 3d indented border around the text. It may be possible to
eliminate the border by overriding the erase background event, but I haven't
messed with it and I suspect it will cause side-effects in the text
rendering.
Ideally, I would like the option to have everything except the text itself
be 'transparent' and float over whatever elements are behind it. This would
allow the text control to double as a static text control while still
allowing the user to copy any text in the control. If anyone has ideas about
how to pull this off let me know.
I would like to use a wxTextCtrl in PythonCard for static text, simply
setting the editable flag to 0 by default, but the native text control
always has a 3d indented border around the text. It may be possible to
eliminate the border by overriding the erase background event, but I
haven't
messed with it and I suspect it will cause side-effects in the text
rendering.
Use a style of wxNO_BORDER.
Ideally, I would like the option to have everything except the text itself
be 'transparent' and float over whatever elements are behind it. This
would
allow the text control to double as a static text control while still
allowing the user to copy any text in the control. If anyone has ideas
about
how to pull this off let me know.
It depends on if the native control paints the text with a background or
transparent. You'll be able to tell if you give the text control an empty
EVT_ERASE_BACKGROUND handler. It may be that the best you can (easily) do
is to match the background colour of the control with the parent:
> I would like to use a wxTextCtrl in PythonCard for static text, simply
> setting the editable flag to 0 by default, but the native text control
> always has a 3d indented border around the text. It may be possible to
> eliminate the border by overriding the erase background event, but I
haven't
> messed with it and I suspect it will cause side-effects in the text
> rendering.
Use a style of wxNO_BORDER.
Looks like wxNO_BORDER is the key, now I feel really dumb. It doesn't even
look like the erase background is necessary. A simple test...
self.SetEditable(0)
self.SetValue('hello')
# match panel background color
self.SetBackgroundColour(self.GetParent().GetBackgroundColour())
A couple of problems arise. One, wxTextCtrl doesn't have text alignment
options like wxStaticText (left, center, right) or does it? Multiline
wxTextCtrl always gets a vertical scrollbar, is there a way to turn off the
vertical scrollbar? You can stick newlines in a wxStaticText control in
order to get a multiline block of text, but newlines don't work in
wxTextCtrl unless it is multiline as well. Is there a way to not use the
wxTE_MULTILINE style and have the text field display multiple lines?
Pretty nice, now I have to redo the PythonCard StaticText widget or more
likely, just expand the TextField widget to have no border.
I just noticed that adding wxTE_RICH to the style gets rid of the vertical
scrollbar?! So does that mean wxTextCtrl with a wxTE_RICH style can't have a
vertical scrollbar or is something else going on?
ka
···
-----Original Message-----
From: wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]On Behalf Of Kevin
Altis
Sent: Wednesday, August 15, 2001 3:22 PM
To: wxpython-users@lists.wxwindows.org
Subject: RE: [wxPython] disabling the wxTextCtrl border
> > I would like to use a wxTextCtrl in PythonCard for static text, simply
> > setting the editable flag to 0 by default, but the native text control
> > always has a 3d indented border around the text. It may be possible to
> > eliminate the border by overriding the erase background event, but I
> haven't
> > messed with it and I suspect it will cause side-effects in the text
> > rendering.
>
> Use a style of wxNO_BORDER.
Looks like wxNO_BORDER is the key, now I feel really dumb. It doesn't even
look like the erase background is necessary. A simple test...
self.SetEditable(0)
self.SetValue('hello')
# match panel background color
self.SetBackgroundColour(self.GetParent().GetBackgroundColour())
A couple of problems arise. One, wxTextCtrl doesn't have text alignment
options like wxStaticText (left, center, right) or does it? Multiline
wxTextCtrl always gets a vertical scrollbar, is there a way to
turn off the
vertical scrollbar? You can stick newlines in a wxStaticText control in
order to get a multiline block of text, but newlines don't work in
wxTextCtrl unless it is multiline as well. Is there a way to not use the
wxTE_MULTILINE style and have the text field display multiple lines?
Pretty nice, now I have to redo the PythonCard StaticText widget or more
likely, just expand the TextField widget to have no border.