FLTK 等待事件关闭窗口
我基本上有一个带有收件箱和输入按钮的窗口。我怎样才能使窗口保持打开和绘制状态,直到用户在 in_box 中键入内容并按下 Enter 按钮。
Window w(Point(100,100),200,200, "Category Sales");
Button enter(Point(25,25),110,25,"Enter",enter);
In_box cat_in(Point(75,75),100,20,"Category:");
w.attach(cat_in);
w.attach(enter);
Fl::wait();
if(ent==true)
{
category = cat_in.get_string();
reference_to<My_button>(addr).receiver->do_categories();
}
有没有比输入按钮更好的方法来做到这一点?
I basically have a window with an in_box and an enter button. How can I make it so that the window stays open and drawn until the user types into the in_box and hits the enter button.
Window w(Point(100,100),200,200, "Category Sales");
Button enter(Point(25,25),110,25,"Enter",enter);
In_box cat_in(Point(75,75),100,20,"Category:");
w.attach(cat_in);
w.attach(enter);
Fl::wait();
if(ent==true)
{
category = cat_in.get_string();
reference_to<My_button>(addr).receiver->do_categories();
}
Is there a better way to do this rather than have an enter button?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Fl::wait() 是错误的函数。 (阅读文档以了解该函数的更多详细信息)
您真正需要的是在该函数末尾调用 Fl::run() 。 (我假设它位于 main() 函数内部)。我强烈建议您阅读(相当不错的)FLTK 1 文档,并熟悉该工具包。源代码树中的示例是一个很好的信息来源。
Fl::wait() is the wrong function for this. (Read the documentation for more details what that function is all about)
What you really need is to call Fl::run() at the end of that function. (I assume that is inside the main() function). I strongly suggest you read the (pretty good) FLTK 1 documentation, and get familiar with the toolkit. A good source of information are the examples inside the source tree.