Disable Page Down key functionality in DCCOMBOBOX
Disable Page Down key functionality in DCCOMBOBOX
I would like to use Page Down as an ACCELKEY for a DCPUSHBUTTON. Consequently, if a DCCOMBOBOX is currently active, I do not want the Page Down key to select a different entry in the DCCOMBOBOX list. I would like the DCCOMBOBOX to ignore the key. How can I go about doing that. Thx.
Re: Disable Page Down key functionality in DCCOMBOBOX
You could try this:
I tried it and it worked for me.
You will also need #include "appevent.ch"
Code: Select all
@..DCCOMBOBOX .. EVAL {|o|o:keyboard := {|a,b,o|IIF(a==xbeK_PGDN,DC_ClearEvents(),nil)}}
You will also need #include "appevent.ch"
The eXpress train is coming - and it has more cars.
Re: Disable Page Down key functionality in DCCOMBOBOX
Alas, it did not work. I tried:
@ 1,1 DCCOMBOBOX cSlsmn LIST aSlsIDs SIZE 22,8 TYPE XBPCOMBO_DROPDOWNLIST ;
EVAL {|o|o:keyboard := {|a,b,o|IIF(a==xbeK_PGDN,DC_ClearEvents(),nil)}}
Hitting PGDN from the SLE selects the last element in the array. The only time this dues not happen is if I first click on the arrow to open the dropdown box, then hit PGDN. I inserted a dc_alert("???") in front of the dc_clearevents() and noticed the last element was selected from the array and placed in the SLE before the dc_clearevents() had a chance to strip out the PGDN.
@ 1,1 DCCOMBOBOX cSlsmn LIST aSlsIDs SIZE 22,8 TYPE XBPCOMBO_DROPDOWNLIST ;
EVAL {|o|o:keyboard := {|a,b,o|IIF(a==xbeK_PGDN,DC_ClearEvents(),nil)}}
Hitting PGDN from the SLE selects the last element in the array. The only time this dues not happen is if I first click on the arrow to open the dropdown box, then hit PGDN. I inserted a dc_alert("???") in front of the dc_clearevents() and noticed the last element was selected from the array and placed in the SLE before the dc_clearevents() had a chance to strip out the PGDN.
Re: Disable Page Down key functionality in DCCOMBOBOX
hi
i have try it with "pure" Xbase++ : PGDN -> last Array Element is the normal behavior of SLE from a Combobox
try to intercept ::XbpCombo:XbpSLE
i have try it with "pure" Xbase++ : PGDN -> last Array Element is the normal behavior of SLE from a Combobox
try to intercept ::XbpCombo:XbpSLE
Code: Select all
EVAL {|o|o:XbpSLE:keyboard := {|nKeyCode, uNIL,oSelf | ... }
greetings by OHR
Jimmy
Jimmy
Re: Disable Page Down key functionality in DCCOMBOBOX
My test program worked.
I will need one from you that does not work.
Please give me a sample program that I can compile and run.
I will need one from you that does not work.
Please give me a sample program that I can compile and run.
The eXpress train is coming - and it has more cars.
Re: Disable Page Down key functionality in DCCOMBOBOX
Here you go. If I run the program and hit PGDN, the last name will be selected.
By the way, I did try to intercept ::XbpCombo:XbpSLE, but it did not work.
Thanks
#include "dcdialog.ch"
#INCLUDE "appevent.CH"
FUNCTION Main()
LOCAL GetList:={}, GetOptions
LOCAL nSlsHt, lReminder:=.F., cSlsmn1:="1235 Joe Schriber Maximus"
LOCAL aSlsIDs:={SPACE(25),;
"1234 John Jones ",;
"1235 Joe Schriber Maximus",;
"1236 Jane Austin IV ",;
"1237 Last Man Standing "}
nSlsHt:=LEN(aSLSIDS)
@ 1.3,1 DCSAY "SLS ID"
@ 1.3,8 DCCOMBOBOX cSlsmn1 LIST aSLSIDS SIZE 25, nSlsHt ;
TYPE XBPCOMBO_DROPDOWNLIST ;
EVAL {|o| o:keyboard := {|a,b,o|IIF(a==xbeK_PGDN,DC_ClearEvents(),nil)}}
@ 2.3,1 DCCHECKBOX lReminder PROMPT "Create a Followup Reminder"
@ 4.3+nSlsHt/2,8 DCPUSHBUTTON CAPTION 'Ok' SIZE 10,1.3 ;
ACCELKEY xbeK_PGDN ;
ACTION {|| DC_Alert(cSlsmn1+" "+Var2Char(lReminder))}
@ 4.3+nSlsHt/2,19 DCPUSHBUTTON CAPTION 'Cancel' ;
SIZE 10,1.3 ;
ACTION {|| DC_ReadGuiEvent(DCGUI_EXIT_ABORT,GetList)}
DCGETOPTIONS NOCONFIRM
DCREAD GUI TITLE "Add to Wish List" ;
OPTIONS GetOptions CLEAREVENTS NOENTEREXIT ;
FIT MODAL
RETURN NIL
* ---------
PROC appsys
return
* ---------
By the way, I did try to intercept ::XbpCombo:XbpSLE, but it did not work.
Thanks
#include "dcdialog.ch"
#INCLUDE "appevent.CH"
FUNCTION Main()
LOCAL GetList:={}, GetOptions
LOCAL nSlsHt, lReminder:=.F., cSlsmn1:="1235 Joe Schriber Maximus"
LOCAL aSlsIDs:={SPACE(25),;
"1234 John Jones ",;
"1235 Joe Schriber Maximus",;
"1236 Jane Austin IV ",;
"1237 Last Man Standing "}
nSlsHt:=LEN(aSLSIDS)
@ 1.3,1 DCSAY "SLS ID"
@ 1.3,8 DCCOMBOBOX cSlsmn1 LIST aSLSIDS SIZE 25, nSlsHt ;
TYPE XBPCOMBO_DROPDOWNLIST ;
EVAL {|o| o:keyboard := {|a,b,o|IIF(a==xbeK_PGDN,DC_ClearEvents(),nil)}}
@ 2.3,1 DCCHECKBOX lReminder PROMPT "Create a Followup Reminder"
@ 4.3+nSlsHt/2,8 DCPUSHBUTTON CAPTION 'Ok' SIZE 10,1.3 ;
ACCELKEY xbeK_PGDN ;
ACTION {|| DC_Alert(cSlsmn1+" "+Var2Char(lReminder))}
@ 4.3+nSlsHt/2,19 DCPUSHBUTTON CAPTION 'Cancel' ;
SIZE 10,1.3 ;
ACTION {|| DC_ReadGuiEvent(DCGUI_EXIT_ABORT,GetList)}
DCGETOPTIONS NOCONFIRM
DCREAD GUI TITLE "Add to Wish List" ;
OPTIONS GetOptions CLEAREVENTS NOENTEREXIT ;
FIT MODAL
RETURN NIL
* ---------
PROC appsys
return
* ---------
Re: Disable Page Down key functionality in DCCOMBOBOX
I have found that almost any problem like this can be solved with a custom event handler.
This works very good.
This works very good.
Code: Select all
#include "dcdialog.ch"
#INCLUDE "appevent.CH"
FUNCTION Main()
LOCAL GetList:={}, GetOptions
LOCAL nSlsHt, lReminder:=.F., cSlsmn1:="1235 Joe Schriber Maximus"
LOCAL aSlsIDs:={SPACE(25),;
"1234 John Jones ",;
"1235 Joe Schriber Maximus",;
"1236 Jane Austin IV ",;
"1237 Last Man Standing "}
nSlsHt:=LEN(aSLSIDS)
@ 1.3,1 DCSAY "SLS ID"
@ 1.3,8 DCCOMBOBOX cSlsmn1 LIST aSLSIDS SIZE 25, nSlsHt ;
TYPE XBPCOMBO_DROPDOWNLIST
@ 2.3,1 DCCHECKBOX lReminder PROMPT "Create a Followup Reminder"
@ 4.3+nSlsHt/2,8 DCPUSHBUTTON CAPTION 'Ok' SIZE 10,1.3 ;
ACCELKEY xbeK_PGDN ;
ACTION {|| DC_Alert(cSlsmn1+" "+Var2Char(lReminder))}
@ 4.3+nSlsHt/2,19 DCPUSHBUTTON CAPTION 'Cancel' ;
SIZE 10,1.3 ;
ACTION {|| DC_ReadGuiEvent(DCGUI_EXIT_ABORT,GetList)}
DCGETOPTIONS NOCONFIRM
DCREAD GUI TITLE "Add to Wish List" ;
OPTIONS GetOptions CLEAREVENTS NOENTEREXIT ;
FIT MODAL ;
HANDLER myHandler
RETURN NIL
* ---------
STATIC FUNCTION myHandler( nEvent, mp1, mp2, oXbp )
IF nEvent == xbeP_Keyboard .AND. mp1 == xbeK_PGDN .AND. oXbp:isDerivedFrom('XbpComboBox')
RETURN DCGUI_IGNORE
ENDIF
RETURN DCGUI_NONE
* ---------
PROC appsys
return
The eXpress train is coming - and it has more cars.
Re: Disable Page Down key functionality in DCCOMBOBOX
Perfect! Thanks for all your help.
-
- Posts: 605
- Joined: Thu Jan 28, 2010 9:11 pm
- Location: Steven Point, Wisconsin USA
- Contact:
Re: Disable Page Down key functionality in DCCOMBOBOX
We also use a custom handler to modify the behavior of the dccombobox and it has worked great for years.