[MonoDevelop] OnLoad?

JimD Jim at keeliegirl.dyndns.org
Sun Jun 4 23:25:44 EDT 2006


Is there a GTK# equivelent to an onload even for a window?  I want to
run some code that sets up the GUI widgets right before the window is
displayed.  I didn't see any signal in MonoDev/Stetic that will do what
I want.  Or at least they are not firing.  Here is a small snippet:


protected Gtk.Button btnDate;
protected Gtk.Entry txtDate;
protected Gtk.Entry txtDir;
protected Gtk.Entry txtUser;
protected Gtk.Entry txtPass;
protected Gtk.Button btnDownload;
protected Gtk.Button btnCancel;
protected Gtk.CheckButton chkClose;
protected Gtk.Table table1;
private bool realized = false;
private bool shown = false;

public MainWindow (): base ("")
{
    Stetic.Gui.Build(this, typeof(MainWindow));
}

protected void OnDeleteEvent(object sender, DeleteEventArgs a)
{
    Application.Quit ();
    a.RetVal = true;
}

protected virtual void OnBtnDownloadClicked(object sender,
    System.EventArgs e)
{
    if (realized == true)
        MsgBox("realized = true", "Title");
    else
        MsgBox("realized = false", "Title");

    if (shown == true)
        MsgBox("shown = true", "Title");
    else
        MsgBox("shown = false", "Title");
}

protected virtual void OnRealized(object sender, System.EventArgs e)
{
    realized = true;
}

protected virtual void OnShown(object sender, System.EventArgs e)
{
    shown = true;
}


OnRealized and OnShown are never called.  I want somewhere to put code like:

btnCancel.State = StateType.Insensitive;


However, I cannot put it before the call to Stetic.Gui.Build() because I
 get a NullReferenceException exception.

Where does one usually put window/widget setup code that needs to run
before the window/form is shown?

Thanks,

Jim
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
You roll an 18 in Dex and see if you
don't end up with a girlfriend
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
JimD
Central FL, USA, Earth, Sol


More information about the Monodevelop-list mailing list