Page 1 of 1

How to set focus after POPUP

Posted: Sun Jul 17, 2011 8:10 am
by jdsoft
Hello,

How to set focus to the next input field when POPUP returns?.
I tryed as folows:

Code: Select all

@ nLine++,KASSA_TAB2   DCGET oKassaBon:nKortingperc;
           PICTURE "999.99" ;
           VALID bRecalc ;
           POPUP {|n,o,r|r := Touch_NumPad(o),Dc_ReadGuiEvent(DCGUI_MOVE_UP,GetList),r} 
@ nLine++,KASSA_TAB2   DCGET oKassaBon:nBetaald ;
           PICTURE "999.99" 
Unfortunaly, the focus remains on the current DCGET, the VALID is not executed.
How to get focus on field "oKassaBon:nbetaald" if the POPUP is finished?

Regards,
Jack Duijf

Re: How to set focus after POPUP

Posted: Sun Jul 17, 2011 10:16 am
by RDalzell
Hi Jack

Add :
GETID "Get_GerVar" within your desired DCGET parameters

Add :
SetAppFocus(DC_GetObject(GetList,"Get_GetVar")) at the end of your VALID function

Rick

Re: How to set focus after POPUP

Posted: Sun Jul 17, 2011 10:38 am
by Wolfgang Ciriack
Or your codeblock returns an array with two Elements, first element the value, second the object to receive focus.

Re: How to set focus after POPUP

Posted: Sun Jul 17, 2011 6:47 pm
by RDalzell
Or, if you did not want to define specifically, but for general use...

DC_ReadGuiEvent(DCGUI_MOVE_DOWN_PAR,GetList) // Set focus to next object in Get List that
has the same parent as the current object.

Re: How to set focus after POPUP

Posted: Mon Jul 18, 2011 3:23 pm
by jdsoft
Hello Rick,

Thank you for the suggestions.
The use of DC_ReadGuiEvent(DCGUI_MOVE_DOWN_PAR,GetList) does not work in the POPUP code-block.
The one that mentioned the return of a array, helped me in the right direction.
Because it was a generic numeric touchscreen entry, i needed to go to the next data-entry (whatever that was).
Below the code i put in the popup codeblock.
I investigate the GetList, and locate the next entryfield (if possible).

Thanks again.
Jack Duijf

Code: Select all

@ 1,1 DCGET nInput PICTURE "999.99"  POPUP {|n,o|Touch_NumPad(o,GetList)} VALID {||myvalid(....)}

Function Touch_NumPad(oInput,aParentGetlist)
Locals .....

if ValType(aParentGetlist) = "A"
   nPos := AScan(aParentGetlist,{|a|a[oGETLIST_OBJECT]==oInput})
   if nPos > 0
      nPos++
      do while nPos <= Len(aParentGetlist)
         oNextFocus        := aParentGetlist[nPos,oGETLIST_OBJECT]
         if ValType(oNextFocus) = "O"
            if oNextFocus:isDerivedFrom("xbpSle") .or. ;
               oNextFocus:isDerivedFrom("xbpMle")
               exit
            endif
         endif
         oNextFocus        := nil
         nPos++
      Enddo
   endif
endif
.. 
.. My touchcreen code..
..
DCREAD GUI TO lOk MODAL OPTIONS GetOptions EVAL {|o| setappwindow(o) } ENTEREXIT FIT OWNER oAppWindow
if lOk
   uRet                 := oInput:Getdata()
   if ValType(oNextFocus) = "O"
      uRet              := {uRet,oNextFocus}
   endif
endif
Return uRet