CTRL-TAB and TFolder

Post Reply
Patrizio
Posts: 90
Joined: Wed Nov 07, 2007 8:56 am
Location: Italy
Contact:

CTRL-TAB and TFolder

Post by Patrizio »

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

#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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: CTRL-TAB and TFolder

Post by Antonio Linares »

Patrizio,

We have implemented it for FWH 11.07 modifying Class TControl Method KeyDown() this way:

Code: Select all

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
Patrizio
Posts: 90
Joined: Wed Nov 07, 2007 8:56 am
Location: Italy
Contact:

Re: CTRL-TAB and TFolder

Post by Patrizio »

Thank you Antonio :D
Post Reply