Need for popup window to extend beyond bounds of parent
Jeffrey Barish
jeff_barish at earthlink.net
Tue Jan 9 16:14:39 PST 2007
I am trying to create a subclass of StaticText with a menu that pops up on a
mouse left down. It should look and behave like a menu on a menubar except
that the text changes to indicate the last selection (like a Choice -- in
fact, I could use a Choice if there were a way to select a flat style).
However, the StaticTextWithMenu can go on a panel with other controls, such
as StaticBitmaps or Buttons. My implementation uses a ListCtrl for the
menu. I thought I had the control working, but there is a problem. When
the control is placed on a short panel, the ListCtrl gets clipped. I am
trying to think of a way to get the ListCtrl to draw outside the bounds of
its parent.
In my StaticTextWithMenu class, both the StaticText and the popup ListCtrl
are owned by the panel the StaticTextWithMenu is placed on. One
possibility I have been exploring is to give the ListCtrl to the top-level
Frame. That change does circumvent the clipping, but I will have to figure
out how to position the ListCtrl relative to the StaticText on the panel.
Also, the ListCtrl draws without a box around it on Linux (with
wx.SIMPLE_BORDER)(on Windows the border still appears).
The other approach I explored was a popup menu. That approach is
wonderfully simple, but I can't find a way to position the popup menu. It
needs to appear in a fixed position relative to the static text, not
relative to the position of the mouse event.
Am I missing something obvious?
--
Jeffrey Barish
More information about the wxpython-users
mailing list