Antonio Linares Help

Post Reply
xfood
Posts: 96
Joined: Tue Jun 17, 2008 9:02 pm

Antonio Linares Help

Post by xfood »

ciao,
scusami,
puoi rispondere a questi miei dubbi?
http://forums.fivetechsoft.com/viewtopic.php?t=11890


grazie mille

anche questo non funzione il tasto ENTER

ti invio tutta la procedurina completa,
su windows cee 5.0 il controllo DTPICKER
esce solo con il tasto Tab e se premo invio in questo
caso non mi spunta il messaggio perchè?????
Grazie mille anticipatamente



#include "FWCE.ch"

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

function Main()

Local oDlg, aCtl[ 7 ], aFonts[ 2 ]
Local aLoc[ 3 ]
Local oBottone,oData

FORNITORE=SPACE(5)
NUMERO=SPACE(5)
NDATA=DATE()




DEFINE FONT aFonts[ 1 ] NAME "MS Sans Serif" SIZE 0, -13 BOLD
DEFINE FONT aFonts[ 2 ] NAME "Arial" SIZE 0, -16 BOLD
* 200 239
DEFINE DIALOG oDlg FROM 0, 0 TO 190, 230 PIXEL ;
COLORS CLR_BLACK, CLR_WHITE ;
TITLE "Inserimento Dati"

@ 8, 49 GET aCtl[ 1 ] VAR FORNITORE OF oDlg ;
FONT aFonts[ 2 ] UPDATE ;
COLORS CLR_HGREEN, nRGB( 240, 248, 255 ) SIZE 57, 11 PIXEL

@ 9, 2 SAY aCtl[ 2 ] PROMPT "FORN.:" OF oDlg ;
FONT aFonts[ 2 ] UPDATE ;
COLORS CLR_BLACK, CLR_WHITE SIZE 36, 12 PIXEL

@ 25, 49 GET aCtl[ 3 ] VAR NUMERO OF oDlg ;
FONT aFonts[ 2 ] UPDATE ;
COLORS CLR_HGREEN, nRGB( 240, 248, 255 ) SIZE 57, 11 PIXEL

@ 26, 2 SAY aCtl[ 4 ] PROMPT "N.DOC:" OF oDlg ;
FONT aFonts[ 2 ] UPDATE ;
COLORS CLR_BLACK, CLR_WHITE SIZE 36, 10 PIXEL


*DTPICKER :arrow: :arrow: :arrow: :( :( :(
@ 42, 49 DTPICKER aCtl[ 5 ] VAR NDATA OF oDlg ;
FONT aFonts[ 2 ] ;
COLORS CLR_HGREEN, nRGB( 240, 248, 255 ) SIZE 67, 11 PIXEL
aCtl[ 5 ]:bKeyDown = { | nKey | If( nKey =13, msginfo('io'), ) }

@ 66, 17 BUTTON aCtl[ 7 ] PROMPT "&Accetta" OF oDlg ;
FONT aFonts[ 1 ] SIZE 76, 26 PIXEL UPDATE ;
ACTION ODLG:END()
ACTIVATE DIALOG oDlg CENTERED ;
VALID ( Aeval( aFonts, { |o| o:End() } ), .T. )

return nil
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Si lo que necesitas es que al pulsar enter el foco vaya al siguiente control, tienes que añadir este método a la clase TControl:

Code: Select all

METHOD GetDlgCode( nLastKey ) CLASS TControl

   if .not. ::oWnd:lValidating
      if nLastKey == VK_RETURN .or. nLastKey == VK_TAB .or. ;
         nLastkey == VK_DOWN .or. nLastkey == VK_UP
         ::oWnd:nLastKey = nLastKey

      // don't do a else here with :nLastKey = 0
      // or WHEN does not work properly, as we pass here twice before
      // evaluating the WHEN
      endif
   endif

   if ::oWnd:oWnd == nil   // There is no folders !!!
      return ::nDlgCode    // standard GetDlgCode behavior (nil)
   else
      if ( Upper( ::oWnd:oWnd:ClassName() ) != "TFOLDER" .and. ;
           Upper( ::oWnd:oWnd:ClassName() ) != "TPAGES" )
         return ::nDlgCode // standard GetDlgCode behavior (nil)
      endif
   endif

return DLGC_WANTALLKEYS // It is the only way to have 100% control using Folders
Admás en la clase TDatePick tienes que quitar esta línea:

Code: Select all

METHOD KeyChar( nKey, nFlags ) CLASS TDatePick

   if nKey == VK_RETURN
      ::oWnd:GoNextCtrl( ::hWnd )
      // return 0      Comment this !!!
   endif
   
return Super:KeyChar( nKey, nFlags )      
Finalmente en tu PRG tienes que añadir esto:

Code: Select all

@ 42, 49 DTPICKER aCtl[ 5 ] VAR NDATA OF oDlg ; 
FONT aFonts[ 2 ] ; 
COLORS CLR_HGREEN, nRGB( 240, 248, 255 ) SIZE 67, 11 PIXEL 
aCtl[ 5 ]:nDlgCode = 4 // DLGC_WANTALLKEYS
aCtl[ 5 ]:bKeyChar = { | nKey | If( nKey =13, msginfo('io'), ) } 
Te envio por email las librerías modificadas :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply