Home AMX User Forum AMX Technical Discussion

how to simulate a push event of a button (also the code inside)

Hello!

I need to execute the block code inside a "push" event in a button, when another button is pushed.
I´ve tried with the "do_push" function, but it just turns the button on/off, it doesn´t execute the code inside the push block.
So i need to know if there is any other function that really simulates a push event of a button.
Any help?

Thanks!!!

Comments

  • viningvining Posts: 4,368
    Do_Push should do exactly what you want. Show your do_push statement.
  • [Deleted User][Deleted User] Harman Integrated Technologies Group (ITG) Posts: 0
    As a reminder, Do_Push statements will execute the code portion of the button event but will not execute a panel driven page flip. If you have code driven flips, yes they will occur. However, panel driven page flips will not occur when using the Do_Push statement in code.
  • samossamos Posts: 106
    do push is not recommended to use if you have to use do_push_timed but a better way would be to put the needed code in a function and call it in both places or use a channel event and just pulse the channel in both places
  • viningvining Posts: 4,368
    samos wrote: »
    do push is not recommended to use if you have to use do_push_timed but a better way would be to put the needed code in a function and call it in both places or use a channel event and just pulse the channel in both places
    There's no problem with using a do_push as long as you understand that the channel remains pushed for .5 seconds until the release is automactically generated. Pulsing a channel is exactly the same since the default pulse time is also .5 seconds. For most situations a standard do_push is fine unless you may need to push faster or prolong the push to affect a hold in the target button_event.

    I often use do_push to control modules from the .axi button_event and since I have options with do_push like _timed, do_release, etc I can simulate holds in my module just by using do_push_timed in the axi PUSH event handler and then issue a do_release in my RELEASE event handler. Then my module can have HOLD events with out the need to start and stop timelines off of channel triggers. Basically it acts as if I'm controlling the module directly from the TP with out the virtual middle man but the virtual middle man allows me to target my desired module instance. FYI, I never use the infinite time value but instead always use a default max timeout constant of 5 or 10 seconds just in case.

    As long as you understand the do_push the do_push in all its flavors are your friend
  • samos wrote: »
    do push is not recommended to use if you have to use do_push_timed but a better way would be to put the needed code in a function and call it in both places or use a channel event and just pulse the channel in both places

    As with most anything it can serve a purpose when used correctly. If you already have the BUTTON_EVENT code in a module there is no need to duplicate that programming under a CHANNEL_EVENT. And it's about the simplest method of generating a HOLD from a CHANNEL_EVENT without rolling your own with a WAIT or TIMELINE.
Sign In or Register to comment.