[Gtk-sharp-list] Don't do myframe.Add(mylabel) if it was already done

Rafael Teixeira monoman at gmail.com
Mon Feb 26 07:03:33 EST 2007

Hi David,

Just keep a boolean field in the class, set it to true when you first
add the frame and check it every time to avoid doing it again.

Nevertheless, that is not the way users expect 'about something' to work...
Guidelines exist to make apps more consistent with each other to the
benefit of users, but you're free to ignore my remarks.

Have fun,

On 2/25/07, David Griffith <dgriffi at cs.csubak.edu> wrote:
> I'm building a C# app using Stetic.  There's one Notebook widget.  On each
> page of the Notebook there's an HBox with a VButtonBox at the left.  All
> the business happens on the right HBox slot.  On the "Management" page, is
> the "About" button.  Here's the code for the About button:
> protected virtual void OnAbout(object sender, System.EventArgs e)
>         {
>                 Frame myframe = new Frame();
>                 Label label = new Label();
>                 myframe.Label = "About Dave's Pizza Helper";
>                 label.Text = "Dave's App";
>                 myframe.Add(label);
>                 ManagementHbox.Add(myframe);
>                 ManagementHbox.ShowAll();
>         } // end method OnAbout
> My problem is that this repeatedly adds myframe to ManagementHbox.  How do
> I avoid this?
> --
> David Griffith
> dgriffi at cs.csubak.edu
> A: Because it fouls the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
> A: Top-posting.
> Q: What is the most annoying thing in e-mail?
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Rafael "Monoman" Teixeira
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man." George Bernard Shaw

More information about the Gtk-sharp-list mailing list