Page 1 of 1

Métodos mejorados GoNextCtrl() y GoPrevCtrl()

Posted: Thu Dec 01, 2011 6:36 pm
by Antonio Linares
Siguiendo en la línea de los recientes cambios en el Método GoNextCtrl() de la Clase TWindow, hemos implementado un nuevo método GoPrevCtrl() asi como una optimización para GoNextCtrl().

Agradecemos vuestras pruebas y comentarios :-)

Gracias!

Code: Select all

METHOD GoNextCtrl( hCtrl ) CLASS TWindow

   local hCtlNext := NextDlgTab( ::hWnd, hCtrl )
   
   if ::oWnd:ClassName() $ "TFOLDER,TFOLDEREX,TPAGES"
      if hCtrl == NextDlgTab( ::hWnd, GetWindow( ::hWnd, GW_CHILD ), .T. ) // last ctrl ?
         hCtlNext = NextDlgTab( ::oWnd:oWnd:hWnd, ::oWnd:hWnd )
      endif   
   endif

   ::hCtlFocus = hCtrl
   SetFocus( hCtlNext )

return nil

//----------------------------------------------------------------------------//

METHOD GoPrevCtrl( hCtrl ) CLASS TWindow

   local hCtlPrev := NextDlgTab( ::hWnd, hCtrl, .T. )
   local oCtl, oDlg

   if ::oWnd:ClassName() $ "TFOLDER,TFOLDEREX,TPAGES"
      if hCtrl == NextDlgTab( ::hWnd, NextDlgTab( ::hWnd,;
         GetWindow( ::hWnd, GW_CHILD ), .T. ) ) // first ctrl ?
         hCtlPrev = NextDlgTab( ::oWnd:oWnd:hWnd, ::oWnd:hWnd, .T. )
      endif
   endif      

   ::hCtlFocus = hCtrl
   
   if GetClassName( hCtlPrev ) $ "SysTabControl32,TFOLDEREX,TPAGES"
      oCtl = oWndFromHwnd( hCtlPrev )
      oDlg = oCtl:aDialogs[ oCtl:nOption ]
      hCtlPrev = NextDlgTab( oDlg:hWnd, GetWindow( oDlg:hWnd, GW_CHILD ), .T. )
   endif
      
   SetFocus( hCtlPrev )

return nil
 

Re: Métodos mejorados GoNextCtrl() y GoPrevCtrl()

Posted: Fri Dec 02, 2011 2:23 am
by miragerr
Ola amigos

Antonio estou tendo problemas com a TFOLDEREX quando em uma DIALOG tenho no inicio varios GETs e logo abaixo uma TFOLDEREX... quando vou teclando ENTER a mesma nao passa para a TFOLDEREX

Estou usando .RES

mais creio que com o EXEMPLO ABAIXO voce tera o resultado esperado

Code: Select all


#include "FiveWin.ch"

function Main()

       local oDlg, oGet, cTest := "Hello world", cAnother := "Another GET"
       local oGet1, cTest1 := "Hello world 1", cAnother1 := "Another GET 1"

       SetGetColorFocus( nRGB( 235, 235, 145 ) )

       DEFINE DIALOG oDlg SIZE 400, 300

       @ 1, 1 GET oGet1 VAR cTest1 OF oDlg
       
       @ 2, 1 GET cAnother1 OF oDlg

       @ 53, 5 FOLDEREX oFld PIXEL ;
          PROMPT "&One", "&Two", "&Three" ;
          SIZE 190, 60
         
       @ 1, 1 GET oGet VAR cTest OF oFld:aDialogs[ 1 ]
       
       @ 2, 1 GET cAnother OF oFld:aDialogs[ 1 ]  
       
       @ 7.2, 14 BUTTON "Ok"    
             
       ACTIVATE DIALOG oDlg CENTERED ;
          ON INIT ( oGet1:SetFocus(), .F. )

    return nil

 
Fico no aguardo

Re: Métodos mejorados GoNextCtrl() y GoPrevCtrl()

Posted: Fri Dec 02, 2011 10:41 am
by Antonio Linares
Jackson,

Si, aún existen algunos problemas de tabulación con TFolderEx. Estamos trabajando para resolverlos.

Re: Métodos mejorados GoNextCtrl() y GoPrevCtrl()

Posted: Sat Dec 03, 2011 8:26 pm
by fgondi
Antonio,

En los valid de los get's tengo comprobaciones de que lo escrito sea correcto.
Estas validaciones usan "msgrun".

Con estas mejoras de GoNextCtrl() y GoPrevCtrl() se produce el siguiente error:

Code: Select all

  Error BASE/1.132  Error de límites: acceso al array

   Argumentos   :
     [   1] = A   { ... }
     [   2] = N   1

Llamadas al Stack
________________________________________________________________________________
1 Called TDIALOG:LASTACTIVECTRL(3382)
          2 Called TDIALOG:GONEXTCTRL(2741)
          3 Called TDIALOG:COMMAND(375)
          4 Called TWINDOW:HANDLEEVENT(0)
          5 Called TDIALOG:HANDLEEVENT(884)
          6 Called DIALOGBOXINDIRECT(0)
          7 Called TDIALOG:ACTIVATE(265)
          8 Called MSGRUN(42)
Dicho error es produccido al pulsar el intro varias veces de forma rapida.
Osea, me posiciono en el primer get y pulso intro varias veces para ir avanzando entre los get's.

Si esta pulsaciones se realizan de forma lenta funciona correctamente.

Anteriormente no me pasaba.

Re: Métodos mejorados GoNextCtrl() y GoPrevCtrl()

Posted: Sun Dec 04, 2011 12:04 pm
by Antonio Linares
Ya no llamamos al método LastActiveCtrl() :-)

Ahora las comprobaciones se hacen mucho más rápidas y con un código mucho más limpio :-)

Re: Métodos mejorados GoNextCtrl() y GoPrevCtrl()

Posted: Sun Dec 04, 2011 12:21 pm
by fgondi
Antonio,

Si es que creía que el error se producía con los nuevos métodos GoNextCtrl y GoPrevCtrl.

Es error mio, por ni siquiera comprobar que lastActiveCtrl era llamado en GoNextCtrl.

Copiando el código nuevo para las métodos GoNextCtrl y GoPrevCtrl funciona correctamente.

Perdón por las molestias.

Re: Métodos mejorados GoNextCtrl() y GoPrevCtrl()

Posted: Tue Dec 06, 2011 7:48 pm
by Antonio Linares
Lo importante es que funcione bien :-)

gracias!