FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour New Class: TFolderEx
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
New Class: TFolderEx
Posted: Sun Aug 08, 2010 07:04 PM
New Class TFolderEx, is a new folder class, fivewin own without Window API

Download Sample

some (custom) features:
* Multiline Tabs
* bitmap support, from file or resource
* Alpha bitmap support
* Separation tabs


* Auto Adjust tabs position


* Data bPopUp, block to evaluate for each tab


* Enable / Disable Tabs
* Show / Hide Tabs



* Alpha Level adjustment



* Colors Tabs and Text



* Tab height and round corner adjustmen



* Bitmap Align


*Tabs Action (ON CHANGE)



Download Sample

Code sample
Code (fw): Select all Collapse
function main()
   local oWnd
   local oFld, oFld1
   local aMonths := {"January", "February", "March", ;
                     "April", "May", "June", ;
                     "July", "August", "September", ;
                     "October", "November", "December"}
   
    DEFINE WINDOW oWnd TITLE "TFolderex - Testing -"
     
   @ 3, 3 FOLDEREX oFld PIXEL ADJUST;
          PROMPT  "Social", "OS", "Games", "Movies", "Email", "Months", "Setting", "Exit";
          BITMAPS "facebook.bmp", "windows.bmp", "game.bmp", "viddler.bmp", "mail.bmp", "call.bmp", "settings.bmp", "logout.bmp";
          ON PAINT TAB PaintTab( Self, nOption );
          POPUP MenuTabs( Self, nOption );
          ON CHANGE ( If( nOption == 8, If( MsgYesNo( "Do you want exit??" ), ;
                                           oWnd:End(), ( ::SetOption( nOldOption ), ::Refresh() ) ), ) )
          

   //Dialog Social
   @ 3,10 FOLDEREX OF oFld:aDialogs[ 1 ] PIXEL SIZE 450, 190 ;
         PROMPT "Facebook", "MySpace", "Twitter" ;
         BITMAPS "Facebook.bmp", "myspace.bmp", "Twitter.bmp";
         SEPARATOR 20


   //Dialog OS
   @ 3,10 FOLDEREX OF oFld:aDialogs[ 2 ] PIXEL SIZE 450, 190 ;
         PROMPT "", "", "";
         BITMAPS "windows.bmp", "apple.bmp", "ubuntu.bmp";
         ALIGN AL_LEFT, AL_CENTER, AL_RIGHT
         
   //Dialog Mail
   @ 3,10 FOLDEREX OF oFld:aDialogs[ 5 ] PIXEL SIZE 450, 190 ;
         PROMPT "Gamil", "Outlook", "Yahoo";
         BITMAPS "gmail.bmp", "Outlook.bmp", "yahoo.bmp";
         TAB HEIGHT 45 ROUND 5
         
   //Dialog Months
   // Suport Arrays and list
   @ 3,10 FOLDEREX OF oFld:aDialogs[ 6 ] PIXEL SIZE 450, 190 ;
         PROMPT aMonths ;
         TAB HEIGHT 18 ROUND 0;
         ON PAINT TAB ChangeClr( Self, nOption );
         ON PAINT TEXT ChangeTxtClr( Self, nOption )
         
   ACTIVATE WINDOW oWnd;
            ON INIT oFld:Resize()
   
RETURN NIL

FUNCTION PaintTab( o, nOption )

   IF nOption == o:nOver .OR. nOption == o:nOption
      o:SetAlphaLevel( nOption, 255 )
   ELSE 
      o:SetAlphaLevel( nOption, 50 )
   ENDIF 
   
RETURN o:SetFldColors( o, nOption )      


FUNCTION ChangeClr( o, n )
   
   LOCAL nMonth := Month( Date() )
   LOCAL aGrad1 := { { 0.5, nRGB( 255, 255, 255 ), nRGB( 255, 240, 180 ) },;
                     { 0.5,  nRGB( 255, 240, 180 ), nRGB( 255, 200, 140 ) } }

   LOCAL aGrad2 := { { 0.5, nRGB( 255, 255, 255 ), nRGB( 200, 200, 240 ) },;
                     { 0.5,  nRGB( 200, 200, 240 ), nRGB( 100, 100, 240 ) } }

   LOCAL aGrad3 := { { 0.5, nRGB( 255, 255, 255 ), nRGB( 255, 240, 240 ) },;
                     { 0.5,  nRGB( 255, 240, 240 ), nRGB( 255, 200, 200 ) } }

   LOCAL aGradMonth := { { 0.5, nRGB( 255, 255, 255 ), nRGB( 185, 207, 147 ) },;
                         { 0.5,  nRGB( 185, 207, 147 ), nRGB( 85, 107, 47 ) } }
   
   LOCAL hBrush, aGrad 
   
   IF n == nMonth
      aGrad = aGradMonth
   ELSE 
      IF n > 0 .AND. n < 5
         aGrad = aGrad1 
      ELSEIF n > 4 .AND. n < 9
         aGrad = aGrad2 
      ELSE
         aGrad = aGrad3
      ENDIF
   ENDIF
   o:aGradUnSel = aGrad
   hBrush = o:SetFldColors( o, n )
      
RETURN hBrush 

FUNCTION ChangeTxtClr( o, n )
   
   LOCAL nMonth := Month( Date() )
   LOCAL nClr := CLR_BLACK, ;
         nClr1 := CLR_HRED
   
   IF n > 0 .AND. n < 7
      nClr = nClr1 
   ENDIF
      
RETURN nClr
        


FUNCTION MenuTabs( oFld, nOpt )
   LOCAL oMenu

   MENU oMenu POPUP 2007
      MENUITEM oFld:aPrompts[ nOpt ]
      SEPARATOR
      MenuAddItem( "Show", , ;
                    oFld:aVisible[ nOpt ], ,;
                    {|| If( oFld:aVisible[ nOpt ], ;
                            oFld:HideTab( nOpt ), ;
                            oFld:ShowTab( nOpt ) ) } ) 
      MenuAddItem( "Enabled", , ;
                    oFld:aEnable[ nOpt ], ,;
                    {|| If( oFld:aEnable[ nOpt ], ;
                            oFld:DisableTab( nOpt ), ;
                            oFld:EnableTab( nOpt ) ) } ) 
   ENDMENU
   
RETURN oMenu


Method redefine is not supported yet
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: New Class: TFolderEx
Posted: Sun Aug 08, 2010 08:06 PM
Dear Daniel,

great News.
Just one Question : on Dialogs we had to use a Zero-brush, to get the Folder-tabs transparent.

DEFINE BRUSH oBrush0
DEFINE DIALOG oDlg FROM 50, 50 TO 700, 600 OF oWnd PIXEL BRUSH oBrush0 TRANSPARENT

Do we still need it ???

Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: New Class: TFolderEx
Posted: Sun Aug 08, 2010 08:28 PM
Uwe..

do you mean about that?

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: New Class: TFolderEx
Posted: Sun Aug 08, 2010 09:12 PM

Daniel,

Yes, that is what I mean ( TRANSPARENT Tab-Area ).
It seems, we don't need to define a Zero-Brush, or the Brush is still needed to define ?

Best Regards
Uwe :lol:

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: New Class: TFolderEx
Posted: Sun Aug 08, 2010 09:55 PM

Uwe

The tab area is transparent
we need remember, the control's tranparences come from parent brush, no only this, all controls
we don't need define null brush to make transparent tabs area

Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Re: New Class: TFolderEx
Posted: Mon Aug 09, 2010 02:08 AM

Mr.Danial,

Very Good and it looks cool. :D

To go to the next tab in Windows Display Properties Dialog, we press "CTRL+TAB".
Can you add the similar feature to this class also ?

Though it is not shown in the Example, I hope that you must have taken care of
Alt+Short cut key functioning to select a desired tab with Keyboard.

Regards,

  • Ramesh Babu P
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: New Class: TFolderEx
Posted: Mon Aug 09, 2010 02:35 AM

Ramesh

i'm working in this point now....

it's in TODO list :D

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: New Class: TFolderEx
Posted: Mon Aug 09, 2010 02:52 AM

Daniel
Excellent
Very useful

Regards



G. N. Rao.

Hyderabad, India
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: New Class: TFolderEx
Posted: Mon Aug 09, 2010 03:19 AM

Hi Daniel,

I found your sample bitmaps into TAB alwayse touch top side when click.

Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: New Class: TFolderEx
Posted: Mon Aug 09, 2010 03:30 AM

Richard

Sorry.. i dont understand

all feed back is useful, for improve class

thanks all for comments

Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: New Class: TFolderEx
Posted: Mon Aug 09, 2010 03:39 AM
Daniel Garcia-Gil wrote:Richard

Sorry.. i dont understand

all feed back is useful, for improve class

thanks all for comments


Very simple. Look Tab bitmap position touch top line( yellow/blue). Maybe you can fix line heigh.
I remember someone share this class( function 70% ).
How about change OneNote 2007/2010 COLOR TAB and style?
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: New Class: TFolderEx
Posted: Mon Aug 09, 2010 02:05 PM

DAniel,
Can you implement it for a Contexual tab in RibbonBar ?

FWH .. BC582.. xharbour
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: New Class: TFolderEx
Posted: Mon Aug 09, 2010 02:11 PM
Richard...

The bitmap position is fine... maybe i should use a more small bitmap, or if you prefer no paint yellow/blue line
Resize bitmap is not acceptable, with windows api method, we lost alpha channel, with own functions:
ResizeImg( hBmp, nWidth, nHeight ) -> hBmp
ResizeImg( hBmp, nPorcent ) -> hBmp
i dont like effect

i did a new data nBmpTopMargin



i thinks, the bitmap used in this samples maybe are so big for you style, my recommendation for you, use more small bitmap or use new data nBmpTopMargin
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: New Class: TFolderEx
Posted: Mon Aug 09, 2010 02:14 PM
Mda..

MdaSolution wrote:Can you implement it for a Contexual tab in RibbonBar ?


i dont thinks so...
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: New Class: TFolderEx
Posted: Mon Aug 09, 2010 02:27 PM
New samples with some adjustment

RAMESHBABU wrote:Though it is not shown in the Example, I hope that you must have taken care of
Alt+Short cut key functioning to select a desired tab with Keyboard.


is working now :-)


Download Here

(i like the movie tabs :-) )