Press and hold event then pop up menu appears

Greetings!

 

I have similar case about this press and hold object. https://forums.coronalabs.com/topic/74728-how-to-make-a-long-touch-on-the-button/?p=409627

 

Please see attached pictures or link for reference. https://ibb.co/ZYFLNc5

 

Can you help me on how to do this?

 

The interactive flow of this app is you press and hold the date (for example, January 15) then the menu named “new” will pop out. The user will release his finger off the screen then he will press the “new” to enter into another window frame in which he will enter details for that date. 

 

Please disregard the other details of the interface you saw in the pictures. I just want to know what API, event listener, etc. used in this process. If you can provide the codes much better.  :slight_smile:

 

Your immediate response is highly appreciated. Thanks.  :slight_smile:

Just add a touch listener to your base object that:

  1. In the began phase, starts a timer and stores a handle to the timer.  This timer, when it fires will show the display object representing your pop up button.

  2. In the ended phase, check to see if the pop-up button was created:

  • If created, add a touch listener to the pop-up.  This new listener will allow you to use the pop-up as a button.

  • If not created, cancel the timer.

1 Like