Like clipper readvar()

Like clipper readvar()

Postby Wanderson » Wed Aug 14, 2013 11:45 pm

Hi all,

I want to create a function to process some datas depending that get comes, like readvar() clipper function, I explain below

Set Key VK_F5 to Man_Pro()

...

REDEFINE GET oGet27 VAR oArqCto:ENOME ID 4040 of Folder1:aDialogs[1] Picture "@!" Color Frente,Fundo update
REDEFINE GET oGet28 VAR oArqCto:EEND ID 4041 of Folder1:aDialogs[1] Picture "@!" Color Frente,Fundo update

...

Static Function Man_Pro()

Here I want to know if i press F5 in oGet27 or oGet28

Thanks in advance.
Wanderson.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Re: Like clipper readvar()

Postby James Bott » Thu Aug 15, 2013 2:29 am

Try oGet:bKeyDown or oGet:bKeyChar

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Like clipper readvar()

Postby Antonio Linares » Thu Aug 15, 2013 9:32 am

Wanderson,

You could also do:

nAt := AScan( Folder1:aDialogs[1]:aControls, { | oCtrl | GetFocus() == oCtrl:hWnd } )
Folder1:aDialogs[1]:aControls[ nAt ] // this is the focused control
regards, saludos

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

Re: Like clipper readvar()

Postby Wanderson » Fri Aug 16, 2013 3:27 pm

James Bott wrote:Try oGet:bKeyDown or oGet:bKeyChar

James


Thanks Jame I will try.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Re: Like clipper readvar()

Postby Wanderson » Fri Aug 16, 2013 3:28 pm

Antonio Linares wrote:Wanderson,

You could also do:

nAt := AScan( Folder1:aDialogs[1]:aControls, { | oCtrl | GetFocus() == oCtrl:hWnd } )
Folder1:aDialogs[1]:aControls[ nAt ] // this is the focused control


Thanks Antonio, I think in another way, In my function how i can get a id of the get control when i press the function key?
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Re: Like clipper readvar()

Postby James Bott » Fri Aug 16, 2013 8:38 pm

Wanderson,

In my function how i can get a id of the get control when i press the function key?


oGet:end()
oDlg:refresh()

However, this is not standard behavior so users will most likely be confused by it. I would suggest that irrelevant controls should be shown as disabled. This disabling should be under program control not user control.

Perhaps if you explained in more detail what you are trying to do, we could be of more help.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Like clipper readvar()

Postby Wanderson » Sat Aug 17, 2013 12:01 am

James Bott wrote:Wanderson,

In my function how i can get a id of the get control when i press the function key?


oGet:end()
oDlg:refresh()

However, this is not standard behavior so users will most likely be confused by it. I would suggest that irrelevant controls should be shown as disabled. This disabling should be under program control not user control.

Perhaps if you explained in more detail what you are trying to do, we could be of more help.

Regards,
James


Hi James I think you dont understand. I have many gets in dialog. If I press F5 in any get the function Man_Vei() is called. Inside this function I want to know
in which get it was tight f5, because I want to treat and return some results depending on who gets came.

Thanks.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Re: Like clipper readvar()

Postby James Bott » Sun Aug 18, 2013 3:49 am

Did you try bKeydown or bkeyChar?

Or you could put a small button next to the Get.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Like clipper readvar()

Postby Antonio Linares » Sun Aug 18, 2013 9:54 am

Wanderson,

Simply do:

SET KEY VK_F5 TO Man_Vei()

DEFINE DIALOG ...

ACTIVATE DIALOG ...
regards, saludos

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

Re: Like clipper readvar()

Postby Wanderson » Mon Aug 19, 2013 4:05 pm

Antonio Linares wrote:Wanderson,

Simply do:

SET KEY VK_F5 TO Man_Vei()

DEFINE DIALOG ...

ACTIVATE DIALOG ...


Hi Antonio,
Yes I already do this in my program, I Explain

SET KEY VK_F5 TO Man_Vei()

...
REDEFINE GET oGet01 ID 101 VAR Test1 of odlg
REDEFINE GET oGet02 ID 102 VAR Test2 of odlg

...

Static Function Man_Vei()
Here I need know if i pressed F5 in oGet01 or oGet02 cause i have to return diferent results

... If I pressed F5 in oGet01
VarRet := "XXXXX"
Endif
If I pressed F5 in oGet02
VarRet := "YYYYY"
Endif

Return .t.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Re: Like clipper readvar()

Postby yury » Mon Aug 19, 2013 6:11 pm

Wanderson

so that the object tget contains the "name" of the edited variable is necessary to pass the name of this variable for the fourth parameter GetNew

currently (as my version of FW) class tget sends this null parameter, see the class tget (GetNew (20,20, bSetGet, cPict))

in the example that you mentioned would have to do so:

GetNew (20,20, bSetGet, "Test1", cPict)

this way you would oGet01: oGet: cVarName = "Test1"

for this to be done in a transparent manner you would have to change the class tget to receive a new parameter (cVarName, for example) and change the include the Get command to send the same this parameter

hugs

===============================================================================================================================================

Wanderson

para que o objeto TGet contenha o "nome" da variável editada é necessário passar o nome desta variável para o GetNew no quarto parâmetro

atualmente (até a minha versão do FW) a classe TGet envia este parâmetro nulo, veja na classe TGet ( GetNew(20,20,bSetGet,,cPict) )

no exemplo que voce citou teria que fazer assim:

GetNew(20,20,bSetGet,"Test1",cPict)

desta forma voce teria oGet01:oGet:cVarName = "Test1"

para que isso seja feito de forma transparente voce teria que alterar a classe TGet para receber um novo parâmetro (cVarName, por exemplo) e alterar o include do comando Get para que o mesmo envie este parâmetro

abraços

===============================================================================================================================================
Yury Marcelino Al
yury030575@yahoo.com.br
vimansca@vimansca.com.br
Leme / SP - Brasil
yury
 
Posts: 56
Joined: Wed May 23, 2007 2:01 pm

Re: Like clipper readvar()

Postby Gale FORd » Mon Aug 19, 2013 6:56 pm

Couldn't you use the cargo variable to store the name.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Like clipper readvar()

Postby avista » Tue Aug 20, 2013 8:48 pm

You can try this 2 samples

Code: Select all  Expand view
#Include "FiveWin.Ch"

static nGet := 0

Function Main()
   Local oDlg
   Local oGet1,oGet2,oGet3
   local cVar1 := space(10)
   local cVar2 := space(10)
   local cVar3 := space(10)

   SET KEY VK_F5 TO Man_Vei()

   DEFINE DIALOG oDlg FROM 0,0 to 200,200 PIXEL

   @ 15,15 GET oGet1 VAR cVar1 OF oDlg SIZE 50,12 PIXEL
   oGet1:bKeyDown := { | nKey | IIF( nKey == VK_F5, nGet := 1, ) }

   @ 30,15 GET oGet2 VAR cVar2 OF oDlg SIZE 50,12 PIXEL
   oGet2:bKeyDown := { | nKey | IIF( nKey == VK_F5, nGet := 2, ) }

   @ 45,15 GET oGet3 VAR cVar3 OF oDlg SIZE 50,12 PIXEL

   ACTIVATE DIALOG oDlg

RETURN NIL

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

Static Function Man_Vei()

local VarRet := ""

DO CASE
   CASE nGet == 1
        VarRet := "XXXXX"
        MsgInfo( VarRet )
   CASE nGet == 2
        VarRet := "YYYYY"
        MsgInfo( VarRet )
ENDCASE

nGet := 0

Return VarRet



Code: Select all  Expand view
#Include "FiveWin.Ch"

static nGet := 0

Function Main()
   Local oDlg
   Local oGet1,oGet2,oGet3
   local cVar1 := space(10)
   local cVar2 := space(10)
   local cVar3 := space(10)

   SET KEY VK_F5 TO Man_Vei()

   DEFINE DIALOG oDlg FROM 0,0 to 200,200 PIXEL

   @ 15,15 GET oGet1 VAR cVar1 OF oDlg SIZE 50,12 PIXEL
   oGet1:bGotFocus  := { || nGet := 1 }
   oGet1:bLostFocus := { || nGet := 0 }

   @ 30,15 GET oGet2 VAR cVar2 OF oDlg SIZE 50,12 PIXEL
   oGet2:bGotFocus  := { || nGet := 2 }
   oGet2:bLostFocus := { || nGet := 0 }

   @ 45,15 GET oGet3 VAR cVar3 OF oDlg SIZE 50,12 PIXEL

   ACTIVATE DIALOG oDlg

RETURN NIL

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

Static Function Man_Vei()

local VarRet := ""

DO CASE
   CASE nGet == 1
        VarRet := "XXXXX"
        MsgInfo( VarRet )
   CASE nGet == 2
        VarRet := "YYYYY"
        MsgInfo( VarRet )
ENDCASE

Return VarRet
 


Regards,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: Like clipper readvar()

Postby Gale FORd » Tue Aug 20, 2013 9:17 pm

Here is a version using cargo

Code: Select all  Expand view

#Include "FiveWin.Ch"

Function Main()
   Local oDlg
   Local oGet1,oGet2,oGet3
   local cVar1 := space(10)
   local cVar2 := space(10)
   local cVar3 := space(10)

   //SET KEY VK_F5 TO Man_Vei( )
   SetKey( VK_F5, {|p, l, v| Man_Vei( oDlg )} )

   DEFINE DIALOG oDlg FROM 0,0 to 200,200 PIXEL

   @ 15,15 GET oGet1 VAR cVar1 OF oDlg SIZE 50,12 PIXEL
   oGet1:cargo := 'XXXXX'

   @ 30,15 GET oGet2 VAR cVar2 OF oDlg SIZE 50,12 PIXEL
   oGet2:cargo := 'YYYYY'

   @ 45,15 GET oGet3 VAR cVar3 OF oDlg SIZE 50,12 PIXEL

   ACTIVATE DIALOG oDlg

RETURN NIL

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

static function Man_Vei( oDlg )
   local nCounter, cVarRet
   for nCounter := 1 TO LEN( oDlg:aControls )
      if oDlg:aControls[ nCounter ]:lFocused
         cVarRet := oDlg:aControls[ nCounter ]:cargo
         exit
      endif
   next
   if cVarRet != nil
      msginfo( cVarRet )
   endif
return cRetVar

 
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Like clipper readvar()

Postby Wanderson » Thu Aug 22, 2013 2:33 pm

avista wrote:You can try this 2 samples

Code: Select all  Expand view
#Include "FiveWin.Ch"

static nGet := 0

Function Main()
   Local oDlg
   Local oGet1,oGet2,oGet3
   local cVar1 := space(10)
   local cVar2 := space(10)
   local cVar3 := space(10)

   SET KEY VK_F5 TO Man_Vei()

   DEFINE DIALOG oDlg FROM 0,0 to 200,200 PIXEL

   @ 15,15 GET oGet1 VAR cVar1 OF oDlg SIZE 50,12 PIXEL
   oGet1:bKeyDown := { | nKey | IIF( nKey == VK_F5, nGet := 1, ) }

   @ 30,15 GET oGet2 VAR cVar2 OF oDlg SIZE 50,12 PIXEL
   oGet2:bKeyDown := { | nKey | IIF( nKey == VK_F5, nGet := 2, ) }

   @ 45,15 GET oGet3 VAR cVar3 OF oDlg SIZE 50,12 PIXEL

   ACTIVATE DIALOG oDlg

RETURN NIL

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

Static Function Man_Vei()

local VarRet := ""

DO CASE
   CASE nGet == 1
        VarRet := "XXXXX"
        MsgInfo( VarRet )
   CASE nGet == 2
        VarRet := "YYYYY"
        MsgInfo( VarRet )
ENDCASE

nGet := 0

Return VarRet



Code: Select all  Expand view
#Include "FiveWin.Ch"

static nGet := 0

Function Main()
   Local oDlg
   Local oGet1,oGet2,oGet3
   local cVar1 := space(10)
   local cVar2 := space(10)
   local cVar3 := space(10)

   SET KEY VK_F5 TO Man_Vei()

   DEFINE DIALOG oDlg FROM 0,0 to 200,200 PIXEL

   @ 15,15 GET oGet1 VAR cVar1 OF oDlg SIZE 50,12 PIXEL
   oGet1:bGotFocus  := { || nGet := 1 }
   oGet1:bLostFocus := { || nGet := 0 }

   @ 30,15 GET oGet2 VAR cVar2 OF oDlg SIZE 50,12 PIXEL
   oGet2:bGotFocus  := { || nGet := 2 }
   oGet2:bLostFocus := { || nGet := 0 }

   @ 45,15 GET oGet3 VAR cVar3 OF oDlg SIZE 50,12 PIXEL

   ACTIVATE DIALOG oDlg

RETURN NIL

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

Static Function Man_Vei()

local VarRet := ""

DO CASE
   CASE nGet == 1
        VarRet := "XXXXX"
        MsgInfo( VarRet )
   CASE nGet == 2
        VarRet := "YYYYY"
        MsgInfo( VarRet )
ENDCASE

Return VarRet
 


Regards,


Thank you avista.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 71 guests