To Antonio:

To Antonio:

Postby HunterEC » Mon Apr 02, 2012 3:25 am

Antonio:


How can I call a procedure from within a GET via pressing one of the function keys (F1...F12) ? I've tried the following but does not work.
Code: Select all  Expand view
  @ 55,45 GET oGets[5] VAR cCode       OF oDlg SIZE 40,10 PIXEL  PICTURE "@!" ;
                        WHEN EVAL({|| SETKEY(VK_F2, {||  cVar := cCode,  LookUp(@cVar),   ;
                                  cCode := cVar,  oGets[5]:varget(), oGets[5]:refresh()}), .T.})
 


Thank you very much.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: To Antonio:

Postby Antonio Linares » Mon Apr 02, 2012 5:37 am

Pedro,

Tienes un ejemplo en FWH\samples\TestKey.prg :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: To Antonio:

Postby HunterEC » Mon Apr 02, 2012 6:33 pm

Antonio:

Thank you for your help. What I'm trying to achieve is to "activate" the SetKey() during the get's WHEN clause and deactivate it in the VALID one. Still I cannot make this work. Any ideas ? Thank you.


Gustavo
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: To Antonio:

Postby Enrico Maria Giordano » Mon Apr 02, 2012 7:41 pm

Use oGet:bKeyDown instead.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: To Antonio:

Postby HunterEC » Tue Apr 03, 2012 12:24 am

Enrico:

Can you provide a small example ?

Thank you.


Gustavo
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: To Antonio:

Postby HunterEC » Tue Apr 03, 2012 3:15 am

Antonio:

Can you post an example ? The Testkey.prg addresses a global setkey, what I'm looking is a more specific, defined at the get level. Different gets using different SETKEYS(). All shall be activated when entering the GET field and deactivating it when exiting.Thank you.

Gustavo
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: To Antonio:

Postby Enrico Maria Giordano » Tue Apr 03, 2012 8:04 am

HunterEC wrote:Enrico:

Can you provide a small example ?

Thank you.


Gustavo


Code: Select all  Expand view
oGet:bKeyDown = { | nKey | If( nKey = VK_???, MyFunc(), ) }


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: To Antonio:

Postby Antonio Linares » Tue Apr 03, 2012 8:06 am

Pedro,

Here you have it, press F2 on each GET and different actions will be executed:

Code: Select all  Expand view
// Testing Keyboard management

#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   local oDlg
   local oGet1, cFirst := "Hello    "
   local oGet2, cLast := "World    "

   DEFINE DIALOG oDlg TITLE "Function Keys for each GET"

   @ 1, 1 GET oGet1 VAR cFirst SIZE 80, 12 OF oDlg

   oGet1:bKeyDown = { | nKey | If( nKey == VK_F2, MsgInfo( "An action for GET 1" ), ) }

   @ 2, 1 GET oGet2 VAR cLast SIZE 80, 12 OF oDlg

   oGet2:bKeyDown = { | nKey | If( nKey == VK_F2, MsgInfo( "An action for GET 2" ), ) }

   @ 3, 6 BUTTON "Ok" ACTION oDlg:End()

   @ 3, 14 BUTTON "Cancel" ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED
   
return nil

//----------------------------------------------------------------------------//
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 112 guests