Honestly, if I were going to do this, I would use a paintable canvas and draw the entire thing.
Here is an example from sometime ago that does something similar (although I don't think you need to deal with the mouse), perhaps it can provide some insight.
Maybe, I will throw something together later today if I get a chance.
I gave up on dynamically changing the angle of the "hand" object. I've redone it with a simple bitmap of a line and dynamically changing the rotation of the image.
I'd still like to know the issue with the former. IRose, I like your solution, but this keeps it within the K.I.S.S. philosophy (my version: Keep It Simple Steve).
I use rotating Vision objects frequently. I never have a problem like this when I use a style customizer to drive the rotation. You'd have 60 rows in your rotation table for this situation, but that should be OK.
If you only care about integer values, sure that will work, but if you want any higher precision (which @steven.rehnborg seems to from the OP) and it balloons to unworkable. Just a single decimal place and you’re already at 600 entries.
I remember looking into something like this before while working on a different problem. I believe that 60 lines would work even with decimals if the goal is to rotate the hand in one second increments. Nevertheless, the paintable canvas approach is the one I would implement for this usage case.
Actually, I don't need anything more precise than seconds. The main concern is minutes in process for the cycle, but fractions (seconds) are recorded. Didn't mean to imply I needed more accuracy.
I will try this out. I'm not familiar with the paintable canvas yet, so I'll be doing some study. Thanks all for the help! I think my issue has technically been resolved even if my question still remains for what happens to the objects in dynamic rotation.
No, I didn't have any unforeseen issues with re-sizing. The code doesn't account for changes in aspect ratio, so as long as the height and width are close to the same ratio, you should get decent results. If you get too far off you'll start to see some weird things, like the tick marks not being centered exactly. This is because they are drawn assuming a perfect circle. That can be fixed, I just didn't take the time to do it.
There are also some things which I hard coded based on the original size that I used (such as the position of the labels). The code doesn't account for repositioning those based on the height and width of the template. That is easily done though.
If for instance you change line 114 and 118 to something like this:
I was trying to hold aspect ratio, but when I actually checked, it was off a small amount. Changing it manually fixed the issue with the tickmarks. Your code fixed the value location, thanks!
I have one more issue, but I'm going to dig into the code to fix it myself. Gives me a reason to become more familiar with the coding of this.
Thanks!
Something new with the paintable canvas for the timer. Getting this error below when page is opened. Once the Error box is closed, the alarm does not come back unless the page is opened again. Related to the clock setpoint hand because the error is on the line that draws the setpoint hand. An almost identical line for the process variable hand does not error.
An interesting question would be how to handle it. Obviously, wrapping the whole thing in a quick and dirty try, except, pass would get rid of the exception, but that would also get rid of any other exception that could happen for whatever reason down the road. Wouldn't some sort of initial binding verification be better? ...and if so, what is the best practice for accomplishing this?