[Mono-list] notebook signals troubles

Chris Howie cdhowie at gmail.com
Thu May 22 08:51:38 EDT 2008


On Wed, May 7, 2008 at 4:50 AM, David Griffith <dgriffi at cs.csubak.edu> wrote:
>
> I have a notebook widget set up with tabs labeled A, B, C, and D.  From
> within Monodevelop I dropped a custom widget into tab C that needs to know
> if we're logged into the database.  This is handled by some business in
> tab D, which sets a global variable (like this: MyProgram.Global.online =
> true;).  My problem is that the widget dropped into tab C starts up as
> soon as the application starts up, which means it always checks the online
> variable before the user has a chance to get to the database login widget
> in tab D.
>
> So, the solution to this is to NOT drop that custom widget into tab C, but
> instead wait until tab C is clicked, and THEN do something like this:
>
>        if (Frame_C.Child != null)
>                Frame_C.Remove(Frame_C.Child);
>        MyProgram.Roster myRoster = new MyProgram.Roster();
>        Frame_C.Add(myRoster);
>        Frame_C.ShowAll();
>
> So I look at the signals available for the notebook widget -- FocusTab,
> ChangeCurrentTab, MoveFocusOut, SwitchPage, and SelectPage.  I think maybe
> SelectPage is the one I want.  Please correct me.
>
> Now, here's my big question:  Once a handler is declared for the correct
> signal, how does that handler determine which tab was selected?

A much better idea would be to also have a global event that gets
fired when you change the online variable.  C can pick up on that and
modify its behavior accordingly.  (Or you could have that event create
C, but that would be less preferable IMO.)

-- 
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers


More information about the Mono-list mailing list