开发者

c++ gtk open multiple window

I'm still working on the example at this link: gtkmm statusicon quits开发者_如何转开发 after creation I changed the function in this way to open the traybar different windows, but does not show anything.

void Tray::on_statusicon_popup(guint button, guint activate_time) {
    printf("popup!\n");
    Gtk::Window w;
    w.show();
}

I tried to run every window with "Gtk::Main::run(w);" and it works, but I would like to not run a main loop for each window.


You're creating the window object on the stack, so it gets destroyed immediately after on_statusicon_popup() returns. If you want the window to outlast the function call, you'll need to create it on the heap and connect to its 'hide' signal (or similar) and delete the object from there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜