GET AND ENTER

Post Reply
User avatar
ukservice
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

GET AND ENTER

Post 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
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Demont Brecht
Posts: 55
Joined: Fri Jul 08, 2011 6:43 am

Re: GET AND ENTER

Post 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
User avatar
ukservice
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: GET AND ENTER

Post 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.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
User avatar
Enrico Maria Giordano
Posts: 8736
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: GET AND ENTER

Post by Enrico Maria Giordano »

Try something like this:

Code: Select all | Expand

oGet:bKeyDown = { | nKey | If( nKey = VK_RETURN, msgalert("hello"), ) }


EMG
User avatar
ukservice
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: GET AND ENTER

Post 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
 
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
User avatar
Enrico Maria Giordano
Posts: 8736
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: GET AND ENTER

Post by Enrico Maria Giordano »

Code: Select all | Expand

oGet2:bKeyDown = { | nKey | If( nKey == VK_RETURN,  ( oGet2:Assign(), MSGALERT(CGET2) ), ) }


EMG
User avatar
ukservice
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: GET AND ENTER

Post by ukservice »

Thank you.

It works perfect now.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
bart
Posts: 10
Joined: Tue Feb 10, 2015 9:11 pm

Re: GET AND ENTER

Post 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
Post Reply