Re: [gtkmvc-users] How to launch one view from another view
Brought to you by:
cavada
From: <to...@ce...> - 2011-11-22 09:43:15
|
On 22.11.2011, at 01:41, haiyan qu wrote: > When I try to launch “window2” from the main window “window1”, I didn't get “window2”, instead I got a duplicate “window1”. The top argument only really works with the old libglade. For GtkBuilder it is best to put each window into its own file. Your code creates a window2 every time you want a window1, and vice versa. The reason you only ever see a window1 is that window2 is not set visible in Glade. Two other things: The type of window2 is set to popup. GTK is a little confusing: popup means something like a context menu that is really part of another window, not a dialog. The copied MessageDialog constructor still gets self, only self isn't a window like in the original demo, but a controller. I attached a version with these small changes. You can use diff to examine them. Also attached is a copy & paste port I made from the original demo. Note that dialogs to modify variables are a pattern people use when direct modification is too much work. GTKMVC does that work for you, so our applications usually use less windows, and adapters instead of manually setting and getting text when OK is clicked. |