[Gtk-sharp-list] reusing windows using attribute [Widget]
Wed, 08 Dec 2004 18:43:50 -0600
I have the following program:
public class GladeApp
[Widget] Gtk.Window window1;
[Widget] Gtk.Window window2;
[Widget] Gtk.Button button1;
public static void Main (string args)
new GladeApp (args);
public GladeApp (string args)
Glade.XML gxml = new Glade.XML (null, "gui.glade", null, null);
public void OnWindowDeleteEvent (object o, DeleteEventArgs args)
args.RetVal = true;
public void on_button1_clicked (object o, EventArgs args)
window2.Visible = true;
gui.glade has two windows, "window1" and "window2"; "window1" has one
button "button1"; "button1" has one signal "on_button1_clicked" and
"window2" is not visible by default.
The idea, is to have an event on "window1" that opens "window2"
It work very well for me the first time, the problem comes when I close
"window2", the window is destroyed and when I click on "button1" again
to re-open "window2", it is empty.
I have two ideas of how to work around this issue (please correct me if
1.- to have another class (one class per window) with it's own:
Glade.XML gxml = new Glade.XML (null, "gui.glade", "window2", null);
and instance this class every time I want to open "window2"
2.- to use gxml.GetWidget("window2"); I don't like this one 'cause
GetWidget returns an object of type Gtk.Widget :(
Is there any way to re-open window2 also using the arrtribute [Widget]?
i.e. by not destroying the window, or re-instance it a second time ?
Javier Díaz <email@example.com>