wxWidgets中的窗口溢出小部件 [英] Window-overflowing widget in wxWidgets

查看:109
本文介绍了wxWidgets中的窗口溢出小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找在Linux上的wxPython中实现此设计的方法...
我有一个带有按钮的工具栏,当按下按钮时,将出现一个弹出窗口,模仿工具栏的扩展(如菜单),并且此弹出窗口应显示两列单选按钮(例如2x5)和一个文本框. . 我的主要问题是工具栏的高度很小,因此弹出窗口必须溢出窗口/工作区的边界.

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:

    通过使用wxMenu
  • ,因为可以在客户区域之外绘制菜单 .我担心布局的可能性不足以实现我的目标
  • 使用异型框架.按下按钮将重新调整框架形状,并根据要求绘制所需的小部件.
  • 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?

推荐答案

不能使用菜单,因为wxWidgets不能在菜单上放置小部件.原则上可以使用成形框架,但是问题是要获得单击的按钮的位置,以将窗口显示在正确的位置.我当时尝试这样做,但是没有运气(在C ++ wxWidgets中).也许这种情况在这之间发生了变化,祝您好运.

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.

您还可以尝试使用wxComboCtrl,它使您可以自定义弹出窗口.然后可以显示单选框和输入控件.

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.

这篇关于wxWidgets中的窗口溢出小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆