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

jimevt jaeuvt at gmail.com
Wed Aug 3 18:09:55 EDT 2011


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.


More information about the Mono-list mailing list