Log In    |    Knowledge Base    |    4D Home
Tech Tip: Use On Clicked OR On Double Clicked not Both
Published On: July 19, 2019
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

It is typically not recommended to use both the On Clicked form event and the On Double Clicked event for a single item because they can cause interferences with each other. To attempt to trigger an On Double Clicked event, two Clicks must be performed, which should trigger the On Clicked event twice. If both events are needed it may require that some flags and timers are implemented to prevent the triggering of the On Clicked event twice when a double click event should be triggered. As such it is not recommended to enable both events on an object unless planned to be handled properly.

Example the following will set a flag and a timer when the first click is performed, and if a second click is performed fast enough soon after it will register a double click, if not it will register a single click:

// Form Object's Method:
If (Form event=On Clicked)
  If (clicked_b=True)
    ALERT("Double Clicked") //Do your double clicked code
    SET TIMER(20) //grace period
  End if
End if

// Form Method:
Case of
  : (Form event=On Load)
  : (Form event=On Timer)
    If (clicked_b=True)
      ALERT("Single Clicked")
    End if
End case