[Gtk-sharp-list] ColorSelectionDialog

Chris Howie cdhowie at gmail.com
Tue Jun 16 20:12:08 EDT 2009


On Tue, Jun 16, 2009 at 7:14 PM, Darwin Reynoso<monouser at gmail.com> wrote:
> ok i got it. thank you Chris
>
> here is what i did.
>
> void setColor()
>        {
>
>                colorDialog = new ColorSelectionDialog("select color");
>
>
>
>                if(colorDialog.Run()==(int)ResponseType.Ok)
>                {
>                        selected = colorDialog.ColorSelection;
>
>                        textview1.ModifyText(StateType.Normal,selected.CurrentColor);
>
>                }
>                colorDialog.Destroy();
>
>        }

Is "selected" a class-level variable?  If it is, you should either
change it to something else, like a Gdk.Color, and store the color
directly on it, or set it to null after calling colorDialog.Destroy().
 Calling Destroy on a container widget, like a dialog, destroys all of
its children too, and using "selected" after this point would be a bad
thing.

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


More information about the Gtk-sharp-list mailing list