Page 1 of 1
A shortcut for forcing a redraw when setting a property
Posted: Thu Mar 05, 2015 3:19 pm
by trevordevore
I'm finding that I'm having to write lots of setProps that just assign the value passed in to a property and then force a redraw. This gets a little redundant. It would be nice if we could somehow specify that the control should be redrawn whenever a property is set. Maybe something like this:
Code: Select all
property chevronYOffset get mChevYOffset set mChevYOffset with redraw
Re: A shortcut for forcing a redraw when setting a property
Posted: Sat Mar 07, 2015 1:40 pm
by LCMark
@trevordevore: This is a really good idea
Indeed, I think there's a generalization here - the idea of a 'trigger':
Code: Select all
property myProperty get mMyProperty set mMyProperty trigger RedrawMe
Here 'RedrawMe' would be a handler something like:
Code: Select all
handler RedrawMe
redraw all
end handler
A further extension could be to allow any statement which takes no inputs as part of the trigger clause:
Code: Select all
property myProperty get mMyProperty set mMyProperty trigger redraw all
All that being said, 'redraw' is perhaps something which should be a flag on the property itself - can you think of any other common triggers which might see use?
Re: A shortcut for forcing a redraw when setting a property
Posted: Mon Mar 09, 2015 2:08 pm
by trevordevore
I like the idea of a trigger. I haven't come across any other common triggers just yet. Depending on the final implementation of the sizing conversion we are having you may want to trigger a resize when setting a property.
Re: A shortcut for forcing a redraw when setting a property
Posted: Thu Mar 12, 2015 3:45 pm
by LCMark
@trevordevore: I've filed
http://quality.runrev.com/show_bug.cgi?id=14901 to do with property triggers.