Page 1 of 1
GET AND ENTER
Posted: Sun Jul 31, 2011 11:36 am
by ukservice
Hello.
I have a Get with an Action. I would like to execute the action when the user press Enter too.
Is it possible?.
Thanks
Code: Select all | Expand
@ 2, 295 GET cGet of oDlg SIZE 140, 10 ;
ACTION msgalert("hello") PIXEL UPDATE
Re: GET AND ENTER
Posted: Sun Jul 31, 2011 6:25 pm
by Demont Brecht
Uwe,
Some years ago we had BTNGET from Manuel Mercado , but the last two (?) years the get class has also this possibilty; See Fivewin.ch , REDEFINE GET :
[ ACTION <uAction> ] ;
Frank
Re: GET AND ENTER
Posted: Sun Jul 31, 2011 7:12 pm
by ukservice
Thank you.
I already use Action clause, which creates a button inside the get. It works perfect.
What I want is that when enter is pressed, it also runs action.
Re: GET AND ENTER
Posted: Sun Jul 31, 2011 9:02 pm
by Enrico Maria Giordano
Try something like this:
Code: Select all | Expand
oGet:bKeyDown = { | nKey | If( nKey = VK_RETURN, msgalert("hello"), ) }
EMG
Re: GET AND ENTER
Posted: Sun Jul 31, 2011 11:19 pm
by ukservice
It does not work fine.
I have to press twice on Enter to get value.
Code: Select all | Expand
#include "fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg
LOCAL oGet1 , cGet1 := SPACE(10)
LOCAL oGet2 , cGet2 := SPACE(10)
DEFINE DIALOG oDlg
@ 2 , 1 GET oGet2 VAR cGet2
oGet2:bKeyDown = { | nKey | If( nKey == VK_RETURN, MSGALERT(CGET2) ,) }
ACTIVATE DIALOG oDlg CENTERED
RETURN NIL
Re: GET AND ENTER
Posted: Mon Aug 01, 2011 8:35 am
by Enrico Maria Giordano
Code: Select all | Expand
oGet2:bKeyDown = { | nKey | If( nKey == VK_RETURN, ( oGet2:Assign(), MSGALERT(CGET2) ), ) }
EMG
Re: GET AND ENTER
Posted: Mon Aug 01, 2011 8:48 am
by ukservice
Thank you.
It works perfect now.
Re: GET AND ENTER
Posted: Wed Mar 04, 2015 2:40 pm
by bart
Antonio
How to use btnget with a resource file ?
REDEFINE BTNGET aoObjetos[9] VAR cReken PICTURE "99999" MESSAGE "Boekhoudrekening" ID 109 OF oDlg ;
RESOURCE "FW_BOEKHOUDPLAN" ACTION ( BrwBoekhoudplan(), aoObjetos[9]:SetFocus(), oDlg:Update() ) ;
VALID Rek_num(cReken) .or. Eval ( { || cReken := Rek_num( cReken), cNaam := Boekhoudplan->naam,.T. } )
aoObjetos[9]:cToolTip := "Standaard boekhoudrekening"
Compling the app. failed. Btnget.ch is included in the prg.
Best regards.
Bart