4D v16.3

Clickcount

Home

 
4D v16.3
Clickcount

Clickcount 


 

Clickcount -> Function result 
Parameter Type   Description
Function result  Longint in Number of consecutive clicks

The Clickcount command returns, in the context of a mouse click event, the number of times the user has clicked in rapid succession with the same mouse button. Typically, this command returns 2 for a double-click.

This command allows you to detect double-clicks in listbox headers or footers, and also to handle sequences of triple-clicks or more.

Every mouse button click generates a separate click event. For example, if a user double-clicks, an event is sent for the first click in which Clickcount returns 1; then another event is sent for the second click in which Clickcount returns 2.

This command must only be used in the context of On Clicked, On Header Click or On Footer Click form events. It is therefore necessary to check in Design mode that the appropriate event has been properly selected in the Form properties and/or for the specific object.

When both On Clicked and On Double Clicked form events are enabled, the following sequence will be returned by Clickcount:

  • 1 in On Clicked event
  • 2 in On Double Clicked event
  • 2+n in On Clicked event

The following code structure can be placed in a listbox header to handle single- and double-clicks:

 Case of
    :(Form event=On Header Click)
       Case of
          :(Clickcount=1)
             ... //single-click action
          :(Clickcount=2)
             ... //double-click action
       End case
 End case

Labels are not enterable but they become so after a triple-click. If you want to allow users to edit labels, you can write the following in the object method:

 If(Form event=On Clicked)
    Case of
       :(Clickcount=3)
          OBJECT SET ENTERABLE(*;"Label";True)
          EDIT ITEM(*;"Label")
    End case
 End if

 
PROPERTIES 

Product: 4D
Theme: Form Events
Number: 1332

 
HISTORY 

Created: 4D v14 R5

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)