Rodney Posted August 18, 2018 Share Posted August 18, 2018 Hi I am trying to get a "Button" to blink under certain conditions but there is no StrBlink component variable for a button I can get a Static text component to do it as it has the StrBlink component variable The Button with its borders looks better than a static text box therefore I would like to use the "Button" component I think it can do it by using CreateStringProperty in the OnLoad event But the actual syntax eludes me........ can it be done ? - if so what is the syntax (ps have have a number of buttons on the same page I would like to do this with - if it can be done -- do I need to place them in some kind of group to make this easier?) Rodney Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted August 19, 2018 Share Posted August 19, 2018 Well, first, you can always create a button look by putting a panel behind some text (or an image!) But what you want to do with the actual button control you can do in On Paint Event of the button. Let's say you want it to blink each second if myVar is true. In the Event put: visible = !myVar || (systime() % 2 > 1) Note that the page refresh rate will affect the quality of the blink. The first part of the above simply says that the button should be visible if myVar is false (i.e. not flash). If it is true, then the second part kicks in due to the OR. % is modulus, meaning the remainder, and systime() % 2 is the remainder of dividing the current time by 2 seconds, so it will give a number between to 0 and 1.999999... depending on the time. I check if this result is > 1 which is half the time and results in an on for 1 second / off for 1 second. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.