Hi, All:
I have a question about the wx.Panel with OnPaint fucntion, and
the wx.TextCtrl.
In the sample code, I create a wx.Panel class with a wx.TextCtrl
in it, and the size of the panel is just a little larger than the size
of the wx.TextCtrl. And it works very well that if the textctrl is not
focused, when the mouse move over it, the background and the border
changes. if the text ctrl is focused, the border is red and background
is white. It look good.
But now, if I add two customized textctrl in a wx.BoxSizer,
everything becomes wrong.
Any idea?
Thank you very much
Hi, All:
I have a question about the wx.Panel with OnPaint fucntion, and
the wx.TextCtrl.
In the sample code, I create a wx.Panel class with a wx.TextCtrl
in it, and the size of the panel is just a little larger than the size
of the wx.TextCtrl. And it works very well that if the textctrl is not
focused, when the mouse move over it, the background and the border
changes. if the text ctrl is focused, the border is red and background
is white. It look good.
But now, if I add two customized textctrl in a wx.BoxSizer,
everything becomes wrong.
Any idea?
You must set then minimal size of the custon control for the layout works right.
class textctrl(wx.Panel):
def __init__(self,parent, text, sz):
"""
size defines the size of the textctrl panel size
"""
wx.Panel.__init__(self,parent, -1, size = sz, pos = (50, 50))
self.parent = parent
l, w = sz
# -- Set minimal size --
self.SetMinSize(wx.Size(l, w))
....
Or use a sizer on the panel to manage the layout of the textctrl. Then when the parent's sizer is calculating its layout the minsize of the textctrl panel will be calculated from the sizer.
···
On 1/14/11 2:32 AM, Oswaldo Hern�ndez wrote:
El 14/01/2011 6:17, zhengqing gan escribi�:
Hi, All:
I have a question about the wx.Panel with OnPaint fucntion, and
the wx.TextCtrl.
In the sample code, I create a wx.Panel class with a wx.TextCtrl
in it, and the size of the panel is just a little larger than the size
of the wx.TextCtrl. And it works very well that if the textctrl is not
focused, when the mouse move over it, the background and the border
changes. if the text ctrl is focused, the border is red and background
is white. It look good.
But now, if I add two customized textctrl in a wx.BoxSizer,
everything becomes wrong.
Any idea?
You must set then minimal size of the custon control for the layout
works right.