以图形方式布置wx应用 [英] Graphically laying out wx app
问题描述
我对wx真的很陌生,我想知道是否有一个IDE(特别是Linux版)可以帮助我布置框架或对话框,还是可以帮助我了解自己在做什么的IDE。
Being really new to wx, I'm wondering if there is an IDE (especially for Linux) which would help me lay out a frame or dialog or whatever just to help me see what I'm doing. That means also creating the code for those changes.
我记得在OS / 2和Windows上使用资源编译器生成二进制文件后会创建窗口的方法,希望有类似的东西(虽然wx不支持,但显然不是二进制的。)
I remember way back when using resource compilers for OS/2 and Windows that produced binaries that would then create the window, and was hoping for something similar (though obviously not binary if wx doesn't support that).
推荐答案
我使用 wxFormBuilder 。它是用wxWidgets编写的,因此可以在Linux上很好地工作。它可以生成C ++代码或XRC文件。确保您了解其原理,并像这样使用它:
I use wxFormBuilder. It is written in wxWidgets, so it works on Linux quite well. It can generate C++ code or XRC files. Make sure you understand its philosophy, and use it like this:
- 为GUI生成C ++代码
- 不要编辑wxFormBuilder生成的代码,而是创建新文件
- 在新文件中,从其生成的类中派生新类
- 实现您自己的类中的事件处理程序(wxFB为您要使用的每个事件处理程序创建虚函数)
- generate C++ code for the GUI
- don't edit the code wxFormBuilder generated, but create new files
- in new files, derive new classes from the classes it generated
- implement event handlers in you own class (wxFB creates virtual function for each event handler you wish to use)
我通常将wxFormBuilder生成的类命名为/ files,例如MainFrameGUI,一个带有实现的文件(派生我编写所有代码的文件)将只是MainFrame。这样一来,您就可以随时更改视觉布局并从wxFB重新生成C ++文件,而无需覆盖代码。
I usually name the wxFormBuilder generated classes/files like, for example, MainFrameGUI, and one with implementation (derived one in which I write all my code) would be just MainFrame. This enables you to change the visual layout and regenerate C++ files from wxFB at any time without overwriting your code.
这篇关于以图形方式布置wx应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!