Home AMX User Forum AMX Technical Discussion

All buttons event??

I need to keep a popup "visible" while ANY button on the interface is pushed, and hide the popup when no button is pushed (in a few seconds).

So, my question is:
Can i make a "push" event for ALL buttons at all ports and channels of the touch pannel interface?

If not, do you imagine a solution for what i´m trying to do?

Thanks!!!

Comments

  • DEFINE_VARIABLE
    Dev tpsAll [] =
    {
    tp1, tp2, tp3, tp4, tp5
    };

    DEFINE_EVENT
    BUTTON_EVENT[tpsAll, 0]
    {
    PUSH:
    {
    //Show Popup
    }
    }
  • viningvining Posts: 4,368
    To go a step further from the PP:
    DEFINE_VARIABLE
    
    Dev tpsAll [] =
         {
         tp1, tp2, tp3, tp4, tp5
         };
    
    DEFINE_EVENT
    
    BUTTON_EVENT[tpsAll, 0]
         {
         PUSH:
    	  {
    	  //Show Popup 
    	  }
         RELEASE:
    	  {
    	  CANCEL_WAIT 'SOME_WAIT_NAME';
    	  WAIT SOME_TIME_CONSTANT 'SOME_WAIT_NAME'
    	       {
    	       //hide pop up
    	       }
    	  }
         } 
    
    You could forget the release altogether and put its code in the push too. Might even create a flag to track the pop up and then if(nPopUp_Closed) call to open the pop up an then when you open it set nPopUp_Closed to 0 and to 1 when you close it, just to reduce the number of commands to the TP.
  • ericmedleyericmedley Posts: 4,177
    Do remember that there is an upper limit to how many buttons can be in an event stack. The limit is 3999 buttons. While this number seems big it can be surpassed easily when you start including a few UIs.
  • viningvining Posts: 4,368
    ericmedley wrote: »
    Do remember that there is an upper limit to how many buttons can be in an event stack. The limit is 3999 buttons. While this number seems big it can be surpassed easily when you start including a few UIs.
    Using the "0" catch all in a button event only counts as 1 event so you can use as many buttons as you want with out being affected by the 4k limit that button event have that use button arrays. I think you would need to define 4000 TPs in the TP array to reach it regardless on the actual number of buttons used if you use "0" instead of a button array.

    http://www.amxforums.com/showthread.php?5943-EVENT-TABLES&highlight=Button+event+0+catch
  • MorgoZMorgoZ Posts: 116
    Thanks to everyone!

    I´m going to try your code.

    Really appreciate your help.
Sign In or Register to comment.