在对话框(wxDialog)中安装大网格(wxGrid)
这是我的布局:
我有一个包含网格(比例为 1)和确定/取消按钮栏的 sizer
所有内容都在 wxDialog 中
这是:
Here is my layout:
I have a sizer that contains a grid (with a proportion of 1) and a ok/cancel button bar
The all thing is in a wxDialog
Here it is:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
|||||
| |
| GRID |
| |
| |
| |
|||||
| |
| GRID |
| |
| |
| |
|||||
| OK CANCEL |
|||||
| OK CANCEL |
|||||
问题是网格包含太多行,并且溢出了屏幕,所以最终我看不到对话框的顶部部分。在对话框上调用 Fit() 时,有没有办法限制其高度?
我尝试过这样的东西:
SetSizeHints(-1,-1,-1,500);
和SetMaxSize(500,500)
但它不起作用。我也尝试这样做:
this->SetSize(this->GetSize().GetX(), 500);
,但是由于垂直滚动条出现在网格上,所以它是宽度不够,会出现水平滚动条。编辑
在构造函数中我调用
wxGrid(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
|||||
The issue is that the grid contains too many row, and over flow the screen, so in the end I don't see the top part of the dialog. Is there a way, when calling Fit() on the dialog, to limit its height ?
I have tried stuff like this:
SetSizeHints(-1,-1,-1,500);
andSetMaxSize(500,500)
but it did not worked.Also I have tried to do that:
this->SetSize(this->GetSize().GetX(), 500);
, but since the vertical scroll bar appears on the grid, it is not wide enough and a horizontal scroll bar shows up.EDIT
In the constructor I call
wxGrid(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
处理这个问题最简单的方法是使用固定大小的网格。如果行数超出了容纳范围,则会出现滚动条。您可以在构造函数中设置所需的大小。
如果您希望调整网格的大小,例如当用户调整应用程序窗口的大小时,事情会稍微复杂一些。您需要处理窗口大小事件并根据需要更改网格大小。
沿着这些思路:
The easiest way to handle this is to use a grid of fixed size. If there are more rows than will fit, then a scroll bar will appear. You set the size you want in the constructor.
If you want the size of the grid to adjust, e.g. when the user resizes the application window, things are a bit more complex. You need handle the window size event and change the grid size as appropriate.
Something along these lines: