DCPUSHBUTTONXP work using Double Click?

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
digitsoft
Posts: 461
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

DCPUSHBUTTONXP work using Double Click?

#1 Post by digitsoft »

Hello Roger, how can I make the DCPUSHBUTTONXP work using Double Click?
Nolberto Paulino
Regards

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCPUSHBUTTONXP work using Double Click?

#2 Post by rdonnay »

Here is a simple way to do it in a custom event handler:

Code: Select all

#INCLUDE "dcdialog.CH"
#INCLUDE "appevent.CH"

FUNCTION Main()

LOCAL GetList[0], oButton

@ 0,0 DCPUSHBUTTONXP caption 'Testing' SIZE 20,2 ;
      ACTION {||(wtf 'activated')}

DCREAD GUI FIT HANDLER ButtonHandler

RETURN nil

* ----------

PROC appsys ; RETURN

* ----------

STATIC FUNCTION ButtonHandler( nEvent, mp1, mp2, oXbp, oDlg, GetList )

IF Empty(oXbp)
  RETURN DCGUI_NONE
ENDIF

IF oXbp:isDerivedFrom('XbpPushButton')
  IF nEvent == xbeM_LbClick
    DC_ClearEvents()
    RETURN DCGUI_IGNORE
  ELSEIF nEvent == xbeM_LbDblClick
    PostAppEvent(xbeP_Activate,,,oXbp)
    RETURN DCGUI_IGNORE
  ENDIF
ENDIF

RETURN DCGUI_NONE
The eXpress train is coming - and it has more cars.

User avatar
digitsoft
Posts: 461
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Re: DCPUSHBUTTONXP work using Double Click?

#3 Post by digitsoft »

Thanks Roger
and as I tell you that of 5 button that I have only one be using with double click


rdonnay wrote:Here is a simple way to do it in a custom event handler:

Code: Select all

#INCLUDE "dcdialog.CH"
#INCLUDE "appevent.CH"

FUNCTION Main()

LOCAL GetList[0], oButton

@ 0,0 DCPUSHBUTTONXP caption 'Testing' SIZE 20,2 ;
      ACTION {||(wtf 'activated')}

DCREAD GUI FIT HANDLER ButtonHandler

RETURN nil

* ----------

PROC appsys ; RETURN

* ----------

STATIC FUNCTION ButtonHandler( nEvent, mp1, mp2, oXbp, oDlg, GetList )

IF Empty(oXbp)
  RETURN DCGUI_NONE
ENDIF

IF oXbp:isDerivedFrom('XbpPushButton')
  IF nEvent == xbeM_LbClick
    DC_ClearEvents()
    RETURN DCGUI_IGNORE
  ELSEIF nEvent == xbeM_LbDblClick
    PostAppEvent(xbeP_Activate,,,oXbp)
    RETURN DCGUI_IGNORE
  ENDIF
ENDIF

RETURN DCGUI_NONE
Nolberto Paulino
Regards

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCPUSHBUTTONXP work using Double Click?

#4 Post by rdonnay »

Here is a better solution:

Code: Select all

#INCLUDE "dcdialog.CH"
#INCLUDE "appevent.CH"

FUNCTION Main()

LOCAL GetList[0], oButton

@ 0,0 DCPUSHBUTTONXP caption 'Testing 1' SIZE 20,2 ;
      action {||(wtf 'activated 1')} ;
      EVAL {|o|o:lbClick := {||DC_ClearEvents()}, ;
               o:lbDblClick := {|a,b,o|PostAppEvent(xbeP_Activate,,,o)}}

DCREAD GUI FIT 

RETURN nil

* ----------

PROC appsys ; RETURN
The eXpress train is coming - and it has more cars.

User avatar
digitsoft
Posts: 461
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Re: DCPUSHBUTTONXP work using Double Click?

#5 Post by digitsoft »

Thanks Roger

rdonnay wrote:Here is a better solution:

Code: Select all

#INCLUDE "dcdialog.CH"
#INCLUDE "appevent.CH"

FUNCTION Main()

LOCAL GetList[0], oButton

@ 0,0 DCPUSHBUTTONXP caption 'Testing 1' SIZE 20,2 ;
      action {||(wtf 'activated 1')} ;
      EVAL {|o|o:lbClick := {||DC_ClearEvents()}, ;
               o:lbDblClick := {|a,b,o|PostAppEvent(xbeP_Activate,,,o)}}

DCREAD GUI FIT 

RETURN nil

* ----------

PROC appsys ; RETURN
Nolberto Paulino
Regards

Post Reply