Page 1 of 2

Button colors

PostPosted: Mon May 06, 2024 3:29 pm
by jjude
I have my own display set with a few own buttons.
I have made "UP"- and" DOWN"-pictures for the buttons.
When I press the button, its color changes "DOWN-picture".
But when the macros runs out, the color of the button does not return to normal "UP-picture".
The color is restored only once, on the first press.
The system's (AXBB-E) own routine (not a macro) causes the color of the buttons to return to normal.

Re: Button colors

PostPosted: Mon May 06, 2024 3:37 pm
by ger21
AS3.Switchbutton(false,###);
AS3.Switchbutton(true,###);

Re: Button colors

PostPosted: Tue May 07, 2024 4:19 am
by jjude
I've already tried that too, no help.

Re: Button colors

PostPosted: Tue May 07, 2024 4:52 am
by jjude
jjude wrote:I've already tried that too, no help.

I ask the user with the information "exec.TextQuestion"-function
Apparently this "window" is causing the problem.
Without it, the button color always returns to normal.

Re: Button colors

PostPosted: Tue May 07, 2024 7:43 am
by dezsoe
Yes, when a button is pressed and any other window opens then the main form does not set the buttons to upper position. Your macro opens a new window and this is the case if you open any other window. Here is a small macro to do it: set it as a macroloop.

Code: Select all
// ================================================================================================
// Macroloop to release stuck buttons
// ================================================================================================

bool focus = (Form.ActiveForm == exec.mainform);

if ((focus ^ LastFocus) && !focus)
    AS3.Sendallbuttonsup();

LastFocus = focus;

#Events

bool LastFocus = false;

Re: Button colors

PostPosted: Tue May 07, 2024 1:10 pm
by jjude
I just added the macro to the end "AS3.Sendallbuttonsup();" and it works!
Now the problem is that the color of the button does not change to "DOWN" on the first execution of the macro.
In the following times, the color of the button is correct during the execution of the macro.
"AS3.Switchbutton(true,20210);" not help me!?!?

Re: Button colors

PostPosted: Tue May 07, 2024 1:22 pm
by dezsoe
Can you upload the button images? Note that the "up" is the normal, the "down" is the pressed state, but these have nothing to do with the Switchbutton. You need double pictures to have on and off states and you have to set the button to bi-state.

Re: Button colors

PostPosted: Tue May 07, 2024 2:43 pm
by jjude
dezsoe wrote:Can you upload the button images? Note that the "up" is the normal, the "down" is the pressed state, but these have nothing to do with the Switchbutton. You need double pictures to have on and off states and you have to set the button to bi-state.

Yes "up" / "off" is normal, "down" / "on" is "active"...
This online display kit works the same way. The first time the macro is executed, the "on" button is only visible for a moment.
The second time, it will be visible throughout the execution of the macro.
And you have to return "off" to the button there "AS3.Sendallbuttonsup();"

Re: Button colors

PostPosted: Thu May 09, 2024 8:03 am
by dezsoe
I'm sorry, but I still can't find out what you want to do. Is it a switch that you want to turn on and off? Or is it just a push button to start your macro?

Re: Button colors

PostPosted: Thu May 09, 2024 2:49 pm
by jjude
dezsoe wrote:I'm sorry, but I still can't find out what you want to do. Is it a switch that you want to turn on and off? Or is it just a push button to start your macro?

For example, I want the M1 "button" to change color to "yellow" when pressed and back to "white" when the macro is executed.

Now, ON THE FIRST PRESS, the "yellow" color just flashes when the macro starts. Why doesn't it turn "yellow" right away?
SECOND TIME when you press the color stays "yellow" until at the end of the macro "AS3.Sendallbuttonsup();" it changes the color to "white"

Sorry bad english - Google translate...