FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to detect focus
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM

How to detect focus

Posted: Sat Jan 16, 2010 07:47 PM
For a kiosk application I need touch-screen input.
How could I detect with get field got focus?
Thanks in advance
Otto

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Re: How to detect focus

Posted: Sun Jan 17, 2010 12:43 AM
Hello Otto,

I remember some years ago, I have done something like that.

I used a Flag to replace a Get on Button-Action.
To save the Input as Char at first ( because of , - Input )
and than convert at the End with < Speichern > to numeric Values would be a better Solution.

Code (fw): Select all Collapse
LOCAL GetFlag := 1 // 1. Get

REDEFINE GET oGet1 VAR nValue1 ID 101  OF oDlg PICTURE "999999.99" UPDATE // PICTURE "XXXXXXXXX"
REDEFINE GET oGet2 VAR nvalue2 ID 102  OF oDlg PICTURE "999999.99" UPDATE
REDEFINE GET oGet3 VAR nValue3 ID 103  OF oDlg PICTURE "999999.99" UPDATE

oGet1:bGotFocus := {|| Getflag := 1 } 
oGet2:bGotFocus := {|| Getflag := 2 }
oGet3:bGotFocus := {|| Getflag := 3 }

// Button with value 1
// -----------------------
REDEFINE BTNBMP oBtn1 ID 200 OF oDlg  2007 ;
FILENAME c_path + "\Images\select.bmp" ;
LEFT ;
PROMPT "1" ; // Value 1
FONT oProgFont ;
ACTION ( IIF( Getflag = 1, ( nValue1 := VAL( ALLTRIM(STR(nValue1)) + "1" ) ), oGet1:Refresh() ), NIL ), ;
     IIF( Getflag = 2, ( nValue2 := VAL( ALLTRIM(STR(nValue2)) + "1" ) ), oGet2:Refresh() ), NIL ), ;
     IIF( Getflag = 3, ( nValue3 := VAL( ALLTRIM(STR(nValue3)) + "1" ) ), oGet3:Refresh() ), NIL ) )

// Button with value 2
// -----------------------
REDEFINE BTNBMP oBtn2 ID 210 OF oDlg  2007 ;
FILENAME c_path + "\Images\select.bmp" ;
LEFT ;
PROMPT "2" ; // Value 2
FONT oProgFont ;
ACTION ( IIF( Getflag = 1, ( nValue1 := VAL( ALLTRIM(STR(nValue1)) + "2" ) ), oGet2:Refresh() ), NIL ), ;
     IIF( Getflag = 2, ( nValue2 := VAL( ALLTRIM(STR(nValue2)) + "2" ) ), oGet2:Refresh() ), NIL ),;
     IIF( Getflag = 3, ( nValue3 := VAL( ALLTRIM(STR(nValue3)) + "2" ) ), oget2:Refresh() ), NIL) )
..
..


maybe there is still another Solution, but that had worked fine.

Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Re: How to detect focus

Posted: Sun Jan 17, 2010 03:45 PM
Hello Otto,

I can have a look at my Application for a complete working example.
Very urgent : Buttons for Cash, Creditkarte, Bankomat or Gutschrift-Selection or/and Move-Buttons.
I think, the Input-field on top, You don't need. Like in my Example above, You can fill the selected
Field ( Cash, Creditkarte, Bankomat or Gutschrift ) directly.



Best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM

Re: How to detect focus

Posted: Sun Jan 17, 2010 04:31 PM
Hello Uwe,

please excuse me not having answered immediately.
Your suggestion with CARET didn’t work. Apoint[2] always return 2.
I tried then a similar solution you posted now only I use an array.

Code (fw): Select all Collapse
@ 40 ,   10 GET oGet[1]  VAR aVarGet[1]  of oDlg PIXEL  SIZE 80,12 font Setup():oFntdISPLAY VALID (nGetFocus :=1,.t.)

@ 2, 320 SBUTTON oBtnRest PROMPT "Rest übernehmen1"  OF oDlg  ACTION  ( aVarGet[nGetFocus] := ALLTRIM(STR(nRest))  ,;
      nRest := nRechungsbetrag - VAL(aVarGet[1]) - VAL(aVarGet[2]) - VAL(aVarGet[3]) - VAL(aVarGet[4]) - VAL(aVarGet[5]) + VAL(aVarGet[6]) ,;
      oGet[nGetFocus]:refresh(), oRest:refresh()  ) PIXEL  SIZE 88, 28 FONT Setup():oFntBrowser  COLORS CLR_WHITE,RGB(44,72,93) ,  CLR_WHITE  CRYSTAL


The Input-field on top (say) is to show the total amount .
Thanks for your help.

Best regards,
Otto
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM

Re: How to detect focus

Posted: Sun Jan 17, 2010 04:32 PM
Otto wrote:Hello Uwe,

please excuse me not having answered immediately.
Your suggestion with CARET didn’t work. Apoint[2] always return 2.
I tried then a similar solution you posted now only I use an array.

Code (fw): Select all Collapse
@ 40 ,   10 GET oGet[1]  VAR aVarGet[1]  of oDlg PIXEL  SIZE 80,12 font Setup():oFntdISPLAY VALID (nGetFocus :=1,.t.)

@ 2, 320 SBUTTON oBtnRest PROMPT "Rest übernehmen1"  OF oDlg  ACTION  ( aVarGet[nGetFocus] := ALLTRIM(STR(nRest))  ,;
      nRest := nRechungsbetrag - VAL(aVarGet[1]) - VAL(aVarGet[2]) - VAL(aVarGet[3]) - VAL(aVarGet[4]) - VAL(aVarGet[5]) + VAL(aVarGet[6]) ,;
      oGet[nGetFocus]:refresh(), oRest:refresh()  ) PIXEL  SIZE 88, 28 FONT Setup():oFntBrowser  COLORS CLR_WHITE,RGB(44,72,93) ,  CLR_WHITE  CRYSTAL


The Input-field on top (say) is to show the total amount .
Thanks for your help.

Best regards,
Otto


BTW, for the buttons I use TSBUTTON.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: How to detect focus

Posted: Sun Jan 17, 2010 04:49 PM

Otto,

You can use:

oWndFromHwnd( GetFocus() ) --> oWndFocused

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion