CTRL-TAB and TFolder

CTRL-TAB and TFolder

Postby Patrizio » Mon Jul 18, 2011 3:40 pm

Hi, the control TFolder() don't change page by the pression of CTRL-TAB or CTRL-SHIFT-TAB on keyborad (standard windows).

I've tried to add a custom function to TFolder():bKeyDown but seem it doesn't work.

The code is the same of Folder.prg in \FWH\Samples with the custom function.

Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oDlg, oFld

   DEFINE DIALOG oDlg TITLE "FiveWin Dynamic folders" ;
      FROM 5, 5 TO 20, 49

   @ 0.5, 1 FOLDER oFld PROMPT "&xBase", "&And OOP", "&Power" ;
      OF oDlg SIZE 160, 90

   @ 1, 1 BUTTON "&Hello" OF oFld:aDialogs[ 1 ] ;
     ACTION MsgInfo( "Hello world!" )

   @ 5.5, 11 BUTTON "Ok" OF oDlg ACTION oDlg:End()

   oFld:bKeyDown  := {|nKey,nFlags|TestKey(oFld,nKey,nFlags)}

   ACTIVATE DIALOG oDlg CENTERED

return nil

procedure AppSys // Xbase++ requirement

return


FUNC TestKey(oFld,nKey,nFlags)
   IF nKey == VK_TAB .and. GetKeyState( VK_CONTROL )
      IF GetKeyState(VK_SHIFT)
         IF oFld:nOption == 1
            oFld:SetOption( Len(oFld:aDialogs) )
         ELSE
            oFld:SetOption( oFld:nOption - 1 )
         ENDIF
      ELSE
         IF oFld:nOption == Len(oFld:aDialogs)
            oFld:SetOption( 1 )
         ELSE
            oFld:SetOption( oFld:nOption + 1 )
         ENDIF
      ENDIF
   ENDIF
RETURN nKey
Patrizio
 
Posts: 90
Joined: Wed Nov 07, 2007 8:56 am
Location: Italy

Re: CTRL-TAB and TFolder

Postby Antonio Linares » Tue Jul 19, 2011 7:41 am

Patrizio,

We have implemented it for FWH 11.07 modifying Class TControl Method KeyDown() this way:
Code: Select all  Expand view
METHOD KeyDown( nKey, nFlags ) CLASS TControl

   local oFolder
   ...
   if ::lDrag
      ...
   else
      if nKey == VK_TAB .and. GetKeyState( VK_CONTROL )
         if ::oWnd:oWnd != nil .and. ::oWnd:oWnd:IsKindOf( "TFOLDER" )
            oFolder = ::oWnd:oWnd
            if GetKeyState( VK_SHIFT )    
               if oFolder:nOption == 1
                  oFolder:SetOption( Len( oFolder:aDialogs ) )
               else
                  oFolder:SetOption( oFolder:nOption - 1 )
               endif
            else
               if oFolder:nOption == Len( oFolder:aDialogs )
                  oFolder:SetOption( 1 )
               else
                  oFolder:SetOption( oFolder:nOption + 1 )
               endif
            endif
            return 0                
         endif
      else      
         return Super:KeyDown( nKey, nFlags )
      endif  
   endif
   ...
 

Many thanks for your feedback! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42097
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: CTRL-TAB and TFolder

Postby Patrizio » Tue Jul 19, 2011 11:03 am

Thank you Antonio :D
Patrizio
 
Posts: 90
Joined: Wed Nov 07, 2007 8:56 am
Location: Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 22 guests