Button colors

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Button colors

Postby jjude » Mon May 06, 2024 3:29 pm

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.
jjude
 
Posts: 6
Joined: Mon May 06, 2024 2:58 pm

Re: Button colors

Postby ger21 » Mon May 06, 2024 3:37 pm

AS3.Switchbutton(false,###);
AS3.Switchbutton(true,###);
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: Button colors

Postby jjude » Tue May 07, 2024 4:19 am

I've already tried that too, no help.
jjude
 
Posts: 6
Joined: Mon May 06, 2024 2:58 pm

Re: Button colors

Postby jjude » Tue May 07, 2024 4:52 am

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.
jjude
 
Posts: 6
Joined: Mon May 06, 2024 2:58 pm

Re: Button colors

Postby dezsoe » Tue May 07, 2024 7:43 am

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;
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Button colors

Postby jjude » Tue May 07, 2024 1:10 pm

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!?!?
jjude
 
Posts: 6
Joined: Mon May 06, 2024 2:58 pm

Re: Button colors

Postby dezsoe » Tue May 07, 2024 1:22 pm

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.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Button colors

Postby jjude » Tue May 07, 2024 2:43 pm

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();"
Attachments
Nimetön.jpg
m1_on.png
m1_on.png (6.37 KiB) Viewed 3565 times
m1_off.png
m1_off.png (2.91 KiB) Viewed 3565 times
jjude
 
Posts: 6
Joined: Mon May 06, 2024 2:58 pm

Re: Button colors

Postby dezsoe » Thu May 09, 2024 8:03 am

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?
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Button colors

Postby jjude » Thu May 09, 2024 2:49 pm

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...
jjude
 
Posts: 6
Joined: Mon May 06, 2024 2:58 pm

Next

Return to Macros

Who is online

Users browsing this forum: No registered users and 5 guests