FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Like clipper readvar()
Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
Like clipper readvar()
Posted: 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.

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Like clipper readvar()
Posted: Thu Aug 15, 2013 02:29 AM

Try oGet:bKeyDown or oGet:bKeyChar

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Like clipper readvar()
Posted: Thu Aug 15, 2013 09: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
Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
Re: Like clipper readvar()
Posted: Fri Aug 16, 2013 03:27 PM
James Bott wrote:Try oGet:bKeyDown or oGet:bKeyChar

James


Thanks Jame I will try.
Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
Re: Like clipper readvar()
Posted: Fri Aug 16, 2013 03: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?
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Like clipper readvar()
Posted: Fri Aug 16, 2013 08: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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
Re: Like clipper readvar()
Posted: 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.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Like clipper readvar()
Posted: Sun Aug 18, 2013 03:49 AM

Did you try bKeydown or bkeyChar?

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

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Like clipper readvar()
Posted: Sun Aug 18, 2013 09:54 AM

Wanderson,

Simply do:

SET KEY VK_F5 TO Man_Vei()

DEFINE DIALOG ...

ACTIVATE DIALOG ...

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
Re: Like clipper readvar()
Posted: Mon Aug 19, 2013 04: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.
Posts: 56
Joined: Wed May 23, 2007 02:01 PM
Re: Like clipper readvar()
Posted: Mon Aug 19, 2013 06: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
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: Like clipper readvar()
Posted: Mon Aug 19, 2013 06:56 PM

Couldn't you use the cargo variable to store the name.

Posts: 301
Joined: Fri Jun 01, 2007 09:07 AM
Re: Like clipper readvar()
Posted: Tue Aug 20, 2013 08:48 PM
You can try this 2 samples

Code (fw): Select all Collapse
#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 (fw): Select all Collapse
#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,
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: Like clipper readvar()
Posted: Tue Aug 20, 2013 09:17 PM
Here is a version using cargo

Code (fw): Select all Collapse
#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
Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
Re: Like clipper readvar()
Posted: Thu Aug 22, 2013 02:33 PM
avista wrote:You can try this 2 samples

Code (fw): Select all Collapse
#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 (fw): Select all Collapse
#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.