[Mono-list] Scope of MainWindow methods & Stetic created widgets

Ian Norton Ian.Norton-Badrul at thales-esecurity.com
Thu Aug 4 02:22:30 EDT 2011


Hello,

So, MainWindow has an instance of an RTDFile object and you want it to  
be able to set properties on the MainWindow?

I would either pass the RTDFile object your MainWindow class or supply  
it with a callback ( a delegate such as Action ) that it can call when  
it needs

How's that sound?

Ian

On 3 Aug 2011, at 23:11, "jimevt" <jaeuvt at gmail.com> wrote:

> My first post!   I'm new to C#, mono, gtk#, etc.  I'm pulling out my  
> hair on
> this one, and I can't afford it!
>
>   I've used the Stetic designer to make a MainWindow that includes a  
> status
> bar.   I also created a public method named SetStatus() to update  
> the status
> bar ( get context id, pop, then push a new status ).   I can call  
> this from
> within the MainWindow class itself with no problems.
>
>   I also have another file with a custom class  (RTDFile.cs ) that
> processes files.   The MainWindow class has an instance of the RTDFile
> class.
>   I want the code within the RTDFile class to be able to update the  
> status
> bar as it works its way through a file, and I can't figure out how  
> to do it!
>
>   The RTDFile class doesn't know about SetStatus().   My research  
> leads me
> to believe that I can declare methods as "static" to make them  
> accessible
> from other classes, and this appears to work for other methods.    
> However,
> If I try to declare SetStatus() as "static" then the SetStatus()  
> method no
> longer has access to the StatusBar object - I get the error message:
>
>      An object reference is required for the non-static field,  
> method, or
> property 'MainWindow.StatusBar'
>
>   Is there a way to grant the RTDFile class access to the SetStatus()
> method?  Or, if I make SetStaus() "static",  how to I get an object
> reference to an existing MainWindow object?
>
>   Thanks for your help!
>
> JimE.
>
>
>
> --
> View this message in context: http://mono.1490590.n4.nabble.com/Scope-of-MainWindow-methods-Stetic-created-widgets-tp3717101p3717101.html
> Sent from the Mono - General mailing list archive at Nabble.com.
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list


More information about the Mono-list mailing list