Page 1 of 1

focus on folderex navigating between gets

Posted: Tue Oct 08, 2024 11:15 pm
by JoséQuintas
Imageprivate picture hosting

I want next focus on page2 of folderex

try this:

Code: Select all | Expand

   xGet:LostFocus( { || xTab:aDialogs[ nPageNext ]:SetFocus(), xGetNext:SetFocus() } )
 
What is wrong ?

Re: focus on folderex navigating between gets

Posted: Wed Oct 09, 2024 5:07 am
by Antonio Linares
Dear Jose,

xGet:bLostFocus := { || xTab:SetOption( nPageNext ), xGetNext:SetFocus() }

working example code:

Code: Select all | Expand

#include "FiveWin.ch"

function Main()

   local oDlg, oFld, cTest1, cTest2, cTest3, oGet2, oGet3

   cTest1 := cTest2 := cTest3 := Space( 30 )

   TGet():SetColorFocus( nRGB( 255, 255, 0 ) )

   DEFINE DIALOG oDlg SIZE 400, 300

   @ 0, 0 FOLDEREX oFld OF oDlg SIZE 200, 150

   @ 1, 1 GET cTest1 OF oFld:aDialogs[ 1 ]

   @ 2, 1 GET oGet2 VAR cTest2 OF oFld:aDialogs[ 1 ]
   oGet2:bLostFocus = { || oFld:SetOption( 2 ), oGet3:SetFocus() }

   @ 1, 1 GET oGet3 VAR cTest3 OF oFld:aDialogs[ 2 ]

   ACTIVATE DIALOG oDlg CENTERED 

return nil  

Re: focus on folderex navigating between gets

Posted: Wed Oct 09, 2024 2:46 pm
by JoséQuintas

Code: Select all | Expand

#include "FiveWin.ch"

function Main()

   local oDlg, oFld, cTest1, cTest2, cTest3, oGet1, oGet2, oGet3

   cTest1 := cTest2 := cTest3 := Space( 30 )

   TGet():SetColorFocus( nRGB( 255, 255, 0 ) )

   DEFINE DIALOG oDlg SIZE 400, 300

   @ 0, 0 FOLDEREX oFld OF oDlg SIZE 200, 150

   @ 1, 1 GET oGet1 VAR cTest1 OF oFld:aDialogs[ 1 ]

   @ 2, 1 GET oGet2 VAR cTest2 OF oFld:aDialogs[ 1 ]
   oGet2:bLostFocus := { || oFld:SetOption( 2 ), oGet3:SetFocus() }

   @ 1, 1 GET oGet3 VAR cTest3 OF oFld:aDialogs[ 2 ]
   oGet3:bLostFocus := { || oFld:SetOption( 1 ), oGet1:SetFocus() }

   ACTIVATE DIALOG oDlg CENTERED

return nil
 
And first losfocus do not works anymore.

Re: focus on folderex navigating between gets

Posted: Thu Oct 10, 2024 4:09 am
by Antonio Linares
Please do it this way:

Code: Select all | Expand

   
   @ 2, 1 GET oGet2 VAR cTest2 OF oFld:aDialogs[ 1 ]
   oGet2:bLostFocus := { || oFld:SetOption( 2 ), oGet3:SetFocus(), oGet3:bLostFocus := nil }

   @ 1, 1 GET oGet3 VAR cTest3 OF oFld:aDialogs[ 2 ] ;
      VALID ( oGet3:bLostFocus := { || oFld:SetOption( 1 ), oGet1:SetFocus() }, .T. )

Re: focus on folderex navigating between gets

Posted: Thu Oct 10, 2024 3:32 pm
by karinha
Veja também, o comando OJUMP para "navegar" entre os GETS dos FOLDERS.

Regards, saludos.

Re: focus on folderex navigating between gets

Posted: Thu Oct 10, 2024 4:21 pm
by JoséQuintas
Gui libraries are crazy.

On dialog creation I create an array with list of gets by page

Code: Select all | Expand

      IF ::lWithTab .AND. ! aItem[ CFG_ISKEY ]
         AAdd( Atail( aList ), aItem[ CFG_FCONTROL ] )
      ENDIF
 
And at the end of creation, I setup bLostfocus using the array.

Code: Select all | Expand

STATIC FUNCTION gui_TabNavigate( xDlg, xTab, aList )

   LOCAL nTab, nPageNext

   IF Len( aList ) == 0
      RETURN Nil
   ENDIF
   FOR nTab = 1 TO Len( aList ) - 1
      nPageNext  := iif( nTab == Len( aList ), 1, nTab + 1 )
      GUI():TabSetLostFocus( aList[ nTab, Len( aList[ nTab ] ) ], xTab, nPageNext, aList[ nPageNext, 1 ] )
   NEXT

   //xTab:aDialogs[1]:SetFocus()
   xTab:SetOption( 1 )

   RETURN Nil

STATIC FUNCTION gui_TabSetLostFocus( xTextbox, xTab, nPageNext, xTextboxNext )

   LOCAL bCode

   bCode := { || ;
      xTab:SetOption( nPageNext ), ;
      /* xTab:aDialogs[nPageNext ]:SetFocus() */ ;
      xTextboxNext:SetFocus() }

   xTextbox:bLostFocus := bCode

   RETURN Nil
 
Now it is working creating bCode first.
Do not test the same on post sample.

Problem now is GET MEMO - TMULTIGET.

Re: focus on folderex navigating between gets

Posted: Thu Oct 10, 2024 4:38 pm
by JoséQuintas
Image

Image

Image

It is ok for GET, but fail for GET MEMO

if memo is on page 2, fail on page 2.
if memo is on page 3, fail on page 3.
there exists an extra fake get, seems that problem is not about last get, but about MEMO-TMULTIGET.

note: focus color do not works on MEMO.

Re: focus on folderex navigating between gets

Posted: Thu Oct 10, 2024 5:22 pm
by Antonio Linares
José,

> note: focus color do not works on MEMO.

TMultiGet():SetColorFocus( nRGB( 255, 255, 0 ) )

Re: focus on folderex navigating between gets

Posted: Thu Oct 10, 2024 5:25 pm
by Antonio Linares

Code: Select all | Expand

#include "FiveWin.ch"

function Main()

   local oDlg, oFld, cTest1, cTest2, cTest3, cTest4, oGet2, oGet3, oMGet1

   cTest1 := cTest2 := cTest3 := cTest4 := Space( 30 )

   TGet():SetColorFocus( nRGB( 255, 255, 0 ) )
   TMultiGet():SetColorFocus( nRGB( 255, 255, 0 ) )

   DEFINE DIALOG oDlg SIZE 400, 300

   @ 0, 0 FOLDEREX oFld OF oDlg SIZE 200, 150

   @ 1, 1 GET cTest1 OF oFld:aDialogs[ 1 ]

   @ 2, 1 GET oGet2 VAR cTest2 OF oFld:aDialogs[ 1 ]
   oGet2:bLostFocus = { || oFld:SetOption( 2 ), oGet3:SetFocus() }

   @ 1, 1 GET oGet3 VAR cTest3 OF oFld:aDialogs[ 2 ]

   @ 2, 1 GET oMGet1 VAR cTest4 MEMO OF oFld:aDialogs[ 2 ] SIZE 180, 50
   oMGet1:bLostFocus = { || oFld:SetOption( 1 ) }

   ACTIVATE DIALOG oDlg CENTERED

return nil  

Re: focus on folderex navigating between gets

Posted: Thu Oct 10, 2024 9:59 pm
by JoséQuintas
SOLVED. MY ERROR., ESCUSE ME.

Code: Select all | Expand

   FOR nTab = 1 TO Len( aList ) - 1
 
on my application, this works for all now

Code: Select all | Expand

   LOCAL bCode

   bCode := { || ;
      gui_MsgDebug( "lostfocus" ), ;
      xTab:SetOption( nPageNext ), ;
      xTextboxNext:SetFocus() }
   xTextbox:bLostFocus := bCode
 
I have this too:

Code: Select all | Expand

   IF GUI():LibName() $ "FIVEWIN,HWGUI"
      /* dummy textbox for bugs */
      AAdd( ::aControlList, EmptyFrmClassItem() )
      Atail( ::aControlList )[ CFG_CTLTYPE ] := TYPE_BUG_GET

      GUI():TextCreate( ::xDlg, ::xDlg, @Atail( ::aControlList )[ CFG_FCONTROL ], ;
         APP_DLG_HEIGHT - 40, 20, 0, 0, " ", "", 0, { || .T. },,,Atail( ::aControlList ), Self )

   ENDIF