PushButton can perform 2 diferent actions?

This forum is for eXpress++ general support.
Message
Author
User avatar
PedroAlex
Posts: 229
Joined: Tue Feb 09, 2010 3:06 am

PushButton can perform 2 diferent actions?

#1 Post by PedroAlex »

Hello.
it is possible for a Pushbutton to perform two different actions?
One for a short click, and one for a long click.
That is, if we click normal on the button it performs a certain action. But pressing the button for more than 3 seconds performs another action.
This is very common in POS applications.
Is this possible?

Many thanks.
Pedro Alexandre

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: PushButton can perform 2 diferent actions?

#2 Post by Auge_Ohr »

Button react on BN_CLICKED or BN_DBLCLK so both are "down"

now every XbPart FROM XbpWindow() have o:LbDn and o:LbUp to react.
so you can use a XbpStatic and react like DragDrop when press left Mouse-Button and hold it.
greetings by OHR
Jimmy

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

Re: PushButton can perform 2 diferent actions?

#3 Post by rdonnay »

I think I can add this to DCPUSHBUTTOXP.
The eXpress train is coming - and it has more cars.

User avatar
PedroAlex
Posts: 229
Joined: Tue Feb 09, 2010 3:06 am

Re: PushButton can perform 2 diferent actions?

#4 Post by PedroAlex »

Hello,
In a TouchScreen scenario, pressing and holding the button makes a lot of sense.
I plan to use it to allow the user to configure their touch keyboard.
So that the user can set the desired actions for that button.
I usually see this functionality in most POS programs that are on the market.
The possibility of a second action on the button increases power in this command.
Maybe a "SetAction"

Many thanks.
I can wait for some news.
Pedro Alexandre

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

Re: PushButton can perform 2 diferent actions?

#5 Post by rdonnay »

Maybe a "SetAction"
That's a possibility. Maybe DELAYACTION.

Probably would also require a 2nd parameter the set the delay amount.

@ .. DCPUSHBUTION ACTION <bAction> DELAYACTION <bAction2> CLICKDELAY nSeconds

Of course there would be a Get-Set function to set the default value for CLICKDELAY.
The eXpress train is coming - and it has more cars.

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

Re: PushButton can perform 2 diferent actions?

#6 Post by rdonnay »

Here is an update for you.

This is the way you use the new parameters:

Code: Select all

#INCLUDE "dcdialog.CH"

FUNCTION Main()

LOCAL GetList[0], oToolBar

DC_XbpPushButtonDelay(1.5)

@ 0,0 DCPUSHBUTTONXP CAPTION 'Test 1' SIZE 20, 1.2  ;
      ACTION {||MsgBox('Action 1')} ;
      DELAYACTION {||MsgBox('Action 2')} CLICKDELAY 2 ;
      COLOR GRA_CLR_WHITE, GRA_CLR_DARKCYAN

@ 2,0 DCPUSHBUTTON CAPTION 'Test 2' SIZE 20, 1.2  ;
      ACTION {||MsgBox('Action 1')} ;
      DELAYACTION {||MsgBox('Action 2')} CLICKDELAY 1.5

@ 4,0 DCTOOLBAR oToolBAR SIZE 30, 1.2

DCADDBUTTONXP CAPTION 'Test 3' SIZE 20, 1.2  ;
      ACTION {||MsgBox('Action 1')} ;
      DELAYACTION {||MsgBox('Action 2')} CLICKDELAY 1 ;
      COLOR GRA_CLR_WHITE, GRA_CLR_DARKPINK ;
      PARENT oToolBar

DCADDBUTTON CAPTION 'Test 4' SIZE 15, 1.2  ;
      ACTION {||MsgBox('Action 1')} ;
      DELAYACTION {||MsgBox('Action 2')}  ;
      PARENT oToolBar

DCREAD GUI FIT

RETURN nil

PROC appsys ; RETURN
Copy _DCXBUTT.PRG to your \exp20\source\dclipx folder.
Copy _DCGETBX.PRG to your \exp20\source\dclipx folder.
Copy DCDIALOG.CH to your \exp20\include folder.

Rebuild DCLIPX.DLL by running BUILD20.BAT or BUILD19_SL1.BAT
Attachments
buttondelay.zip
(162.36 KiB) Downloaded 709 times
The eXpress train is coming - and it has more cars.

User avatar
hz_scotty
Posts: 107
Joined: Thu Jan 28, 2010 8:20 am
Location: Wr.Neustadt / Österreich

Re: PushButton can perform 2 diferent actions?

#7 Post by hz_scotty »

Hello!

Build new dclipx.dll only with this 3 files and start my programm - there is a error

Rebuid DLL with the old files - all is perfect - no error

any idea?
Attachments
error.jpg
error.jpg (46.37 KiB) Viewed 14238 times
best regards
Hans

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

Re: PushButton can perform 2 diferent actions?

#8 Post by rdonnay »

Did you use the new DCDIALOG.CH file?
The eXpress train is coming - and it has more cars.

Sbryan
Posts: 31
Joined: Sun Oct 18, 2015 7:15 am

Re: PushButton can perform 2 diferent actions?

#9 Post by Sbryan »

I'm getting an error too.

I rebuilt dclipx.dll with the new files and ran the included test which worked fine. When I rebuild an existing program with no other changes I get this error when I try to run it.
error.JPG
error.JPG (37.87 KiB) Viewed 14176 times

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

Re: PushButton can perform 2 diferent actions?

#10 Post by rdonnay »

I think I see the problem but I can't figure out why I'm not getting that error.
I didn't initialize a new variable to a numeric.

Here is an updated _DCXBROW.PRG
Attachments
_dcxbrow.zip
(52.87 KiB) Downloaded 709 times
The eXpress train is coming - and it has more cars.

Post Reply