Page 1 of 1

xebK_F4 doesn't work correctly

Posted: Fri Dec 27, 2013 6:48 am
by obelix
Hi everybody,
In DCBROWSE I use the DCHOTKEY x_beK_F4 and it works
if I use in the same DCBROWSE the statement
case nEvent = xbeP_Keyboard .and. Upper(Chr(mp1)) = "S" in HANDLER Myhandler,
pushing the F4-key executes the xbeP_keyboard statement.
The other DCHOTKEYS F1, F2 and so on work correctly.

Re: xebK_F4 doesn't work correctly

Posted: Fri Dec 27, 2013 8:29 am
by rdonnay
I don't understand your question.

Can you show me some source code?

Re: xebK_F4 doesn't work correctly

Posted: Fri Dec 27, 2013 10:55 am
by obelix
hi Roger,

in this DCBROWSE-Window, I want to be able to use the PUSHBUTTON CAPTION "F4 Projekt "...
that's ok
but also the DCHOTKEY CAPTION "F4 Projekt". That's ok as long as I don't use the line
case nEvent = xbeP_Keyboard .and. Upper(Chr(mp1)) = "S"
in function myhandler4
if I could adress the F4-key in myhandler4,it would even be better but i dont't noch the value of mp1

thanks


@ 3,2 DCBROWSE oBrowse EDIT xbeBRW_ItemSelected MODE DCGUI_BROWSE_EDITEXIT ; //PARENT oTabPage1
DATA cAlias SIZE wcol,wrow FONT feldfont
DCBROWSECOL FIELD &felder1 WIDTH 6 ; //felder[1] ;
HEADER feldub1 PARENT oBrowse
...
....
@ wrow+vv, 1+hv DCPUSHBUTTON CAPTION "F1 Hilfe" SIZE 12+i,1 FONT textfont1 ACTION {||hpshelp()}
@ wrow+vv, 16+hv+i*1 DCPUSHBUTTON CAPTION "F2 Vorgang" SIZE 12+i,1 FONT textfont1 ACTION {||w_order(1),oBrowse:RefreshAll()}
@ wrow+vv, 31+hv+i*2 DCPUSHBUTTON CAPTION "F3 Kurzname" SIZE 12+i,1 FONT textfont1 ACTION {||w_order(2),oBrowse:RefreshAll()}
@ wrow+vv, 46+hv+i*3 DCPUSHBUTTON CAPTION "F4 Projekt" SIZE 12+i,1 FONT textfont1 ACTION {||w_order(3),oBrowse:RefreshAll()}
...
...

DCHOTKEY xbeK_F1 ACTION {||hpshelp()} // 28
DCHOTKEY xbeK_F2 ACTION {||w_order(1),oBrowse:RefreshAll()} // -1
DCHOTKEY xbeK_F3 ACTION {||w_order(2),oBrowse:RefreshAll()} // -2
DCHOTKEY xbeK_F4 ACTION {||w_order(3),oBrowse:RefreshAll()} // -4
DCHOTKEY xbeK_F5 ACTION {||w_order(4),oBrowse:RefreshAll()} // -5

DCREAD GUI FIT TO lStatus TITLE cTitle OPTIONS GetOptions ENTEREXIT HANDLER MyHandler4 REFERENCE @oBrowse
RETURN lstatus


FUNCTION MyHandler4 (nEvent,mp1,mp2,oXbp,oDlg,GetList,oBrowse)

do case
case nEvent = xbeP_Keyboard .and. Upper(Chr(mp1)) = "S"
aufsuches()
obrowse:refreshall()
case nEvent = xbeP_Keyboard .and. mp1= 13 // Enter
return DCGUI_EXIT_OK
case nEvent = xbeP_Keyboard .and. mp1= 27 // ESC
esca=.t.
return DCGUI_EXIT_ABORT
endcase

RETURN DCGUI_NONE

Re: xebK_F4 doesn't work correctly

Posted: Fri Dec 27, 2013 11:59 am
by rdonnay
This anomoly is caused by the Chr() function.

Chr(xbeK_F4) returns "s"

You can fix this as follows:

Code: Select all

case nEvent = xbeP_Keyboard .and. Upper(Chr(mp1)) = "S" .and. mp1 # xbeK_F4

Re: xebK_F4 doesn't work correctly

Posted: Fri Dec 27, 2013 1:37 pm
by obelix
ok, it works.
thank you Roger

Re: xebK_F4 doesn't work correctly

Posted: Sat Dec 28, 2013 11:08 pm
by Auge_Ohr
instead of CHR()

Code: Select all

Upper(Chr(mp1)) = "S"
you can do same with ASC()

Code: Select all

CASE nEvent = xbeP_Keyboard .and. mp1 = ASC("s")

Re: xebK_F4 doesn't work correctly

Posted: Mon Dec 30, 2013 1:22 am
by skiman
Hi,

Better look at ACCELKEY parameter for the dcpushbutton. Now you have your code twice in you sources. With the accelerator key you don't need to do this.

Code: Select all

@ wrow+vv, 1+hv DCPUSHBUTTON CAPTION "F1 Hilfe" SIZE 12+i,1 FONT textfont1 ACTION {||hpshelp()} ACCELKEY  xbeK_F1

Re: xebK_F4 doesn't work correctly

Posted: Sun Jan 05, 2014 8:36 am
by obelix
thank you for your suggestions. :D
the addition of «.and. mp1 # xbeK_Fx» is necessary for all Fx-key, but it works.