I have a custom label template that is drawing formatted text on a paint event.
The template parameter being used is then bound to a tag when the template is consumed on a window.
My thought process was that when the tag changed, it would set the property, this would trigger the repaint.
Instead… The tag changes the underlying value of the property, but the repaint is not fired until after something else takes place such as a window click.
Why is the process of setting the property not causing a repaint?
If it is not supposed to, then what would be the work around that when a tag updates, the control repaints to display its value?
all in all is this just a bad way to approach this with this system?
So I’m not sure why the repaint is not occurring when the value changes. I’ll have to have one of the developers look into this issue but I do have a workaround for now. Add the following to a property change script on the aw_time_label template instance in main window:
if event.propertyName == "seconds":
This will force the template instance to repaint every time the seconds property updates. I’m not sure what sort of side effects this might have but it does get your custom label updating as expected.
Excellent, this does work, and when setting it on the lowest level instance it works all the way up through the control hierarchy as well.
Desired effect achieved
So the failure to do so was indeed a failure to behave as it should, not a misconception on my part?
I thought I was losing my mind…
Another word on this component. Paintable canvases will indeed repaint themselves when any dynamic properties that have been added to them change. The idea is if someone added dynamic properties to the paintable canvas object, then those properties are likely being used to manipulate the image being painted. So if you were to add a dynamic property to the canvas, then bind that property to the “display” template parameter that you have defined the canvas would then repaint itself when every property/parameter updated.
But “display” is being pre-formatted by a script, so I cannot directly bind it to seconds, it is not a pass thorough, it is an intercept / format / relay.
So when “seconds” changes in the aw_time_label instance, the result immediately following should be a change in the “display” property of the nested aw_input_label template (done via the event.propertyChange event on the aw_time_label and filtered by name of property “seconds”), which should in turn make it repaint should it not?
Unless I misunderstood that…
Nm, that does make sense now that I reread it, I created a “display” property on the canvas as well, and bound it to the display property on the template, then removed the property change work around.
I understand why it works, and it does so without issue.
So that just leaves the original question, so the end result was the template was repainting but not the child controls?
Is that normal behavior and just a misunderstanding on my part?
Maybe I didn’t explain what I was trying to say correctly. What I did to also get this to work without using the repaint script I suggested earlier was the following:
[ul]1. add a dynamic property called “display” of type string to the paintable canvas component on aw_input_label.
2. bind that new property to the template parameter you have called “display” on the aw_input_label template[/ul]
Doing this will cause the new dynamic property to change every time the template parameter changes and in turn cause the paintable canvas to repaint. All the formatting you are doing in the propertyChange script will still occur. Binding the new “display” property to the template parameter isn’t really doing anything other than forcing a repaint of the paintable canvas for the reasons that I described in my earlier post.
Hope this is a little clearer.
Yes we are on the same page, that is what I did.
And it does work.
I will make note of it in future controls.