[MonoDevelop] Public Widgets using Stetic?
danieru
samuraidanieru at gmail.com
Fri Mar 13 21:07:17 EDT 2009
I'm a little unclear on how to interact with the code that stetic generates.
For testing purposes, I have a separate thread that's trying to update text
on 'label1' in my GUI, like so:
Gtk.Application.Invoke(delegate{ win.Title = updateVal; });
With 'win' being an instance of the 'MainWindow' class that Monodevelop
gives you for a gtk project. Inside 'MainWindow' I have:
public string Title {
get { return label1.Text; }
set { label1.Text = value; }
}
..but running gives me a 'NullReferenceException' on the set line in the
property. It's acting as if it can't see the label1 object. so, two
questions:
1. What am I missing here to access the label?
2. Once I have this figured out, I'll be accessing a NodeView to update it.
What is the best way to update a NodeView?
Michael Hutchinson wrote:
>
> In general in .NET/Mono it is recommended to use properties instead of
> public/protected fields, as this allows you to change internal
> implementation without breaking ABI. Trivial properties are inlined
> by the JIT so there is no real cost. The commonness of trivial
> properties with backing fields is why we have automatic properties in
> C# 3.
>
> public string Title {
> get { return titleLabel.Text; }
> set { titleLabel.Text = value; }
> }
>
--
View this message in context: http://www.nabble.com/Public-Widgets-using-Stetic--tp20918045p22507995.html
Sent from the Mono - MonoDevelop IDE mailing list archive at Nabble.com.
More information about the Monodevelop-list
mailing list