FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour CTRL-TAB and TFolder
Posts: 90
Joined: Wed Nov 07, 2007 08:56 AM
CTRL-TAB and TFolder
Posted: Mon Jul 18, 2011 03: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 (fw): Select all Collapse
#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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: CTRL-TAB and TFolder
Posted: Tue Jul 19, 2011 07:41 AM
Patrizio,

We have implemented it for FWH 11.07 modifying Class TControl Method KeyDown() this way:
Code (fw): Select all Collapse
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
Posts: 90
Joined: Wed Nov 07, 2007 08:56 AM
Re: CTRL-TAB and TFolder
Posted: Tue Jul 19, 2011 11:03 AM

Thank you Antonio :D

Continue the discussion