I have a button control on a form and depending on the state of a Controller variable I want to change what text is displayed on the button. This isn’t currently possible so instead I thought I’d use a hack and place a Text object over the button. This revealed a bug in the z sorting: as soon as you mouse over the button (triggers a repaint for the pretty effect) the button is painted over the text object.
Instead of using a “button control”, try it with a shape instead (rectangular with rounded corners can look nice). I’ve found that the Z-order between text objects and shapes is maintained. Through the dynamic attributes of the shape, you can make it change colors while being pressed to give the visual feedback.
Thanks for the suggestion. I’m new to PAC Display so I could be missing something basic here, but how would you change the color when the button is pressed? The only way I can think to do this would be to have chart logic (or OptoScript) that would modify a variable to represent the depressed duration. So the user clicks the button and a SendValue command causes some chart logic to set a variable, say “buttonDownTimer” to 100ms and then Display has the background color driven by this variable. After 100ms the Controller resets the variable value and Display will change the background color.
That can’t be the correct way to do it. How did you handle the pressed background change effect without the Controller?
It can be done without chart logic. In the “Send Discrete” dynamic attribute, if you choose “Fixed Data” as the source, you are given some options for how that data is sent. Choosing “Direct” means that the data is sent only while the button is being pressed. You can then use the graphical dynamic attributes of the button to adjust how it looks based on value of the tag that was affected by the direct button. For me, it works out that I haven’t need to create any tags for the sole purpose of controlling button graphics, but even if you have to add some tags, at least there is no need to involve the controller strategy.