focus on folderex navigating between gets

Post Reply
JoséQuintas
Posts: 55
Joined: Tue Feb 09, 2021 4:20 pm

focus on folderex navigating between gets

Post 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 ?
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: focus on folderex navigating between gets

Post 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  
regards, saludos

Antonio Linares
www.fivetechsoft.com
JoséQuintas
Posts: 55
Joined: Tue Feb 09, 2021 4:20 pm

Re: focus on folderex navigating between gets

Post 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.
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: focus on folderex navigating between gets

Post 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. )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
karinha
Posts: 7910
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 3 times
Contact:

Re: focus on folderex navigating between gets

Post by karinha »

Veja também, o comando OJUMP para "navegar" entre os GETS dos FOLDERS.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
JoséQuintas
Posts: 55
Joined: Tue Feb 09, 2021 4:20 pm

Re: focus on folderex navigating between gets

Post 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.
JoséQuintas
Posts: 55
Joined: Tue Feb 09, 2021 4:20 pm

Re: focus on folderex navigating between gets

Post 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.
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: focus on folderex navigating between gets

Post by Antonio Linares »

José,

> note: focus color do not works on MEMO.

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42393
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 9 times
Been thanked: 41 times
Contact:

Re: focus on folderex navigating between gets

Post 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  
regards, saludos

Antonio Linares
www.fivetechsoft.com
JoséQuintas
Posts: 55
Joined: Tue Feb 09, 2021 4:20 pm

Re: focus on folderex navigating between gets

Post 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
 
Post Reply