[英]Fltk Window wait
C ++ fltk:我有一个带有in_box和out_box的窗口,我该如何做,以便用户可以按Enter键输入in_box,然后继续进行其余的事件。 现在,窗口刚刚出现并消失了。
Window w(Point(100,100),200,200, "Category Sales");
In_box cat_in(Point(75,75),100,20,"Category:");
Out_box cat_out(Point(75,115),100,20,"Sales:");
w.attach(cat_in);
w.attach(enter);
category = cat_in.get_string();
我以前从未见过In_box和Out_box,所以我将假定它们是您自己的类或结构...如前所述-启动FLTK事件循环的最简单方法是使用Fl :: run()或(FLTK2)fltk ::跑()。
因此,此处的代码应类似于(FLTK2):
#include <fltk/Window.h>
#include <fltk/Widget.h>
#include <fltk/run.h>
using namespace fltk;
int main(int argc, char **argv) {
// your code begins
Window w(Point(100,100),200,200, "Category Sales");
In_box cat_in(Point(75,75),100,20,"Category:");
Out_box cat_out(Point(75,115),100,20,"Sales:");
w.attach(cat_in);
w.attach(enter);
category = cat_in.get_string();
// your code ends
w->end();
w->show(argc, argv);
return run(); // this line is the most important, here we start the FLTK event-loop
}
我不确定这是否可以解决您的问题,但是要保持窗口打开,请返回Fl :: run()。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.