Window-overflowing widget in wxWidgets

扶醉桌前 提交于 2020-01-15 11:08:10

问题


I'm looking for a way to implement this design in wxPython on Linux...
I have a toolbar with a button, when the button is pressed a popup should appear, mimicking an extension of the toolbar (like a menu), and this popup should show two columns of radio buttons (say 2x5) and a text box... My main problem is that the toolbar is small in height, so the popup has to overflow the bounds of the window/client area..

I thought of two possible implementations:

  • by using a wxMenu, since a menu can be drawn outside the client area. I fear that the layout possibilities aren't flexible enough for my goal
  • by using a shaped frame. Pressing the button would re-shape the frame and draw the needed widgets as requested.

My question is: am I missing something / wrong on something? :) Is this doable at all?


回答1:


Using a menu is a no-go, because wxWidgets can't put widgets on a menu. Using the shaped frame would be possible in principle, but the problem is then to get the position of the button you clicked, to display the window at the right position. I tried to do that back then, but didn't have luck (in C++ wxWidgets). Maybe this situation changed in between though, good luck.

You can also try a wxComboCtrl, which allows you to have a custom popup window. That one could then display the radio boxes and the input control.



来源:https://stackoverflow.com/questions/462320/window-overflowing-widget-in-wxwidgets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!