Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
Pages: 1
Topic closed
Well, as the title says.
How do trigger an event when a public integer is changed? I've searched the web but nothing helped me.
Thanks.
Seems you didn't look hard enough - http://stackoverflow.com/questions/5842 … is-changed
To summarise the answers there, in the most basic way possible, otherwise see the link above.
private int _MyFavouriteNumber
public int MyFavouriteNumber {
get { return _MyFavouriteNumber }
set {
_MyFavouriteNumber = value;
DoSomething();
}
}
My how we have fallen so that those who desire help also need the guise of anonymity…
But yeah, this is where get/set blocks make sense to me
Does that works if it increases/decreases?
I might post un-anonymously. Someday...
Any time the value is changed (this includes the example below) even if you did
MyFavouriteNumber = 1215;
MyFavouriteNumber = 1215;
The function will be fired twice
Ah, thank you. I get confused when somepony sends a code without explenation.
Thread closed.
Pages: 1
Topic closed
[ Started around 1732416653.8973 - Generated in 0.033 seconds, 12 queries executed - Memory usage: 1.41 MiB (Peak: 1.51 MiB) ]