Insert data into Get

Insert data into Get

Postby Jeff Barnes » Thu Apr 01, 2010 2:30 am

Hi,

Lets say I have 2 gets in a dialog and one button.

If the user clicks the button I would like the number 5 inserted to which ever get has the flashing cursor in it.
Can this be done?
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Insert data into Get

Postby Otto » Thu Apr 01, 2010 6:38 am

Hello Jeff,
this is Fivewin code from my touch screen ECR but it is much the same.
Best regards,
Otto

Code: Select all  Expand view

   @ 40 ,   10 GET oGet[1]  VAR aVarGet[1]  of oDlg PIXEL  SIZE 80,12 font FntdISPLAY VALID (nGetFocus :=1,.t.)
   @ 80 ,   10 GET oGet[2]  VAR aVarGet[2]  of oDlg PIXEL  SIZE 80,12 font FntdISPLAY VALID (nGetFocus :=2,.t.)
   @ 120 ,  10 GET oGet[3]  VAR aVarGet[3]  of oDlg PIXEL  SIZE 80,12 font FntdISPLAY VALID (nGetFocus :=3,.t.)
   @ 160 ,  10 GET oGet[4]  VAR aVarGet[4]  of oDlg PIXEL  SIZE 80,12 font FntdISPLAY VALID (nGetFocus :=4,.t.)
   @ 200 ,  10 GET oGet[5]  VAR aVarGet[5]  of oDlg PIXEL  SIZE 80,12 font FntdISPLAY VALID (nGetFocus :=5,.t.)
   @ 240 ,  10 GET oGet[6]  VAR aVarGet[6]  of oDlg PIXEL  SIZE 80,12 font FntdISPLAY VALID (nGetFocus :=6,.t.)

 
   @ 40, YZHGTASTE SBUTTON oBtn1 PROMPT "1"  OF oDlg  ACTION  ( aVarGet[nGetFocus] := aVarGet[nGetFocus] + "1",;
      nRest := nRechungsbetrag - VAL(aVarGet[1]) - VAL(aVarGet[2]) - VAL(aVarGet[3]) - VAL(aVarGet[4]) - VAL(aVarGet[5]) + VAL(aVarGet[6]) ,;
      oGet[nGetFocus]:refresh(), oGet[nGetFocus]:SetPos( len(oGet[nGetFocus]) ),;
      oRest:refresh(), oGet[nGetFocus]:SetFocus()  ) PIXEL  SIZE 38, 38 FONT oFntBrowser  COLORS CLR_WHITE,RGB(44,72,93) ,  CLR_WHITE  CRYSTAL

   @ 40, YZHGTASTE+40    SBUTTON oBtn2 PROMPT "2"  OF oDlg  ACTION  (  aVarGet[nGetFocus]:=aVarGet[nGetFocus] + "2",;
      nRest := nRechungsbetrag - VAL(aVarGet[1]) - VAL(aVarGet[2]) - VAL(aVarGet[3]) - VAL(aVarGet[4]) - VAL(aVarGet[5]) + VAL(aVarGet[6]) ,;
      oGet[nGetFocus]:refresh(), oGet[nGetFocus]:SetPos( len(oGet[nGetFocus]) ),;
      oRest:refresh(), oGet[nGetFocus]:SetFocus()  ) PIXEL  SIZE 38, 38 FONT oFntBrowser  COLORS CLR_WHITE,RGB(44,72,93) ,  CLR_WHITE  CRYSTAL

   @ 40, YZHGTASTE+80   SBUTTON oBtn3 PROMPT "3"  OF oDlg  ACTION  ( aVarGet[nGetFocus]:=aVarGet[nGetFocus]+"3",;
    nRest := nRechungsbetrag - VAL(aVarGet[1]) - VAL(aVarGet[2]) - VAL(aVarGet[3]) - VAL(aVarGet[4]) - VAL(aVarGet[5]) + VAL(aVarGet[6]) ,;
      oGet[nGetFocus]:refresh(), oGet[nGetFocus]:SetPos( len(oGet[nGetFocus]) ),;
      oRest:refresh(), oGet[nGetFocus]:SetFocus()  ) PIXEL  SIZE 38, 38 FONT oFntBrowser  COLORS CLR_WHITE,RGB(44,72,93) ,  CLR_WHITE  CRYSTAL

 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6329
Joined: Fri Oct 07, 2005 7:07 pm

Re: Insert data into Get

Postby Jeff Barnes » Thu Apr 01, 2010 11:07 pm

Thanks Otto.

I went a different route but it was thanks to your VALID (nGetFocus :=1,.t.) As soon as I saw that the answer hit me :)

Code: Select all  Expand view
     @ 1.5,2 Get oGet1 var nBORG1 of oBORG SIZE 20,10 PICTURE "99.9" UPDATE VALID (nGetFocus :=1,.t.)
      @ 1.5,7 Get oGet2 var nBORG2 of oBORG SIZE 20,10 PICTURE "99.9" UPDATE VALID (nGetFocus :=2,.t.)

        @ 3,1   BUTTON oBtn PROMPT "0"   SIZE 15,15 Action ( iif(nGetFocus=1,(nBorg1:=0,oGet2:Setfocus()),(nBorg2:=0,oGet1:SetFocus())),oBorg:Update() )
        @ 3,5   BUTTON oBtn PROMPT "0.5" SIZE 15,15 Action ( iif(nGetFocus=1,(nBorg1:=0.5,oGet2:Setfocus()),(nBorg2:=0.5,oGet1:SetFocus())),oBorg:Update() )
        @ 3,9   BUTTON oBtn PROMPT "1"   SIZE 15,15 Action ( iif(nGetFocus=1,(nBorg1:=1,oGet2:Setfocus()),(nBorg2:=1,oGet1:SetFocus())),oBorg:Update() )
        @ 3,13  BUTTON oBtn PROMPT "2"   SIZE 15,15 Action ( iif(nGetFocus=1,(nBorg1:=2,oGet2:Setfocus()),(nBorg2:=2,oGet1:SetFocus())),oBorg:Update() )
 
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 22 guests