wxWidgets中的窗口溢出小部件

编程入门 行业动态 更新时间:2024-10-28 12:24:49
本文介绍了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中的窗口溢出小部件

本文发布于:2023-10-05 12:16:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1467365.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:部件   窗口   wxWidgets

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!