[Gtk-sharp-list] How do i access my window object in a event?

Mike Rhodes mike.rhodes at gmail.com
Mon Oct 10 10:54:00 EDT 2005

You need to use (obj as Window).some_method or
((Window)obj).some_method. Otherwise I think it will try to cast
obj.some_method to type Window rather than just obj, which I guess is
why you are getting the exception.

Hope that helps,


On 10/10/05, Joeri Belis <joeri.belis at nollekens.be> wrote:
> I have the following event
> I know that object obj will be a window. How do i access the window
> properties and methods through this obj object?
> static void test1 (object obj, EventArgs args)
>  {
> // i tried
> (Window)obj.some_method_in_window
> // but got error about cast
> }
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

"Some cause happiness wherever they go;
others whenever they go" -- Oscar Wilde

More information about the Gtk-sharp-list mailing list