Like clipper readvar()
Like clipper readvar()
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.
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.
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Like clipper readvar()
Try oGet:bKeyDown or oGet:bKeyChar
James
James
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Like clipper readvar()
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
You could also do:
nAt := AScan( Folder1:aDialogs[1]:aControls, { | oCtrl | GetFocus() == oCtrl:hWnd } )
Folder1:aDialogs[1]:aControls[ nAt ] // this is the focused control
Re: Like clipper readvar()
Thanks Jame I will try.James Bott wrote:Try oGet:bKeyDown or oGet:bKeyChar
James
Re: Like clipper readvar()
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?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
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Like clipper readvar()
Wanderson,
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
oGet:end()In my function how i can get a id of the get control when i press the function key?
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
Re: Like clipper readvar()
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 knowJames Bott wrote:Wanderson,
oGet:end()In my function how i can get a id of the get control when i press the function key?
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
in which get it was tight f5, because I want to treat and return some results depending on who gets came.
Thanks.
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Like clipper readvar()
Did you try bKeydown or bkeyChar?
Or you could put a small button next to the Get.
James
Or you could put a small button next to the Get.
James
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Like clipper readvar()
Wanderson,
Simply do:
SET KEY VK_F5 TO Man_Vei()
DEFINE DIALOG ...
ACTIVATE DIALOG ...
Simply do:
SET KEY VK_F5 TO Man_Vei()
DEFINE DIALOG ...
ACTIVATE DIALOG ...
Re: Like clipper readvar()
Hi Antonio,Antonio Linares wrote:Wanderson,
Simply do:
SET KEY VK_F5 TO Man_Vei()
DEFINE DIALOG ...
ACTIVATE DIALOG ...
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.
Re: Like clipper readvar()
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
===============================================================================================================================================
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
===============================================================================================================================================
Re: Like clipper readvar()
Couldn't you use the cargo variable to store the name.
Re: Like clipper readvar()
You can try this 2 samples
Regards,
Code: Select all
#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
#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
Re: Like clipper readvar()
Here is a version using cargo
Code: Select all
#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
Re: Like clipper readvar()
Thank you avista.avista wrote:You can try this 2 samples
Code: Select all
#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
Regards,Code: Select all
#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