New Class: TFolderEx

User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

New Class: TFolderEx

Post by Daniel Garcia-Gil »

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
Image

* Auto Adjust tabs position
Image

* Data bPopUp, block to evaluate for each tab
Image

* Enable / Disable Tabs
* Show / Hide Tabs

Image

* Alpha Level adjustment

Image

* Colors Tabs and Text

Image

* Tab height and round corner adjustmen

Image

* Bitmap Align
Image

*Tabs Action (ON CHANGE)

Image

Download Sample

Code sample

Code: Select all

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
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: New Class: TFolderEx

Post by ukoenig »

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 :roll:
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.
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: New Class: TFolderEx

Post by Daniel Garcia-Gil »

Uwe..

do you mean about that?

Image
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: New Class: TFolderEx

Post by ukoenig »

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.
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: New Class: TFolderEx

Post by Daniel Garcia-Gil »

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
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
RAMESHBABU
Posts: 591
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Re: New Class: TFolderEx

Post by RAMESHBABU »

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
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: New Class: TFolderEx

Post by Daniel Garcia-Gil »

Ramesh

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

it's in TODO list :D
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: New Class: TFolderEx

Post by nageswaragunupudi »

Daniel
Excellent
Very useful
Regards

G. N. Rao.
Hyderabad, India
User avatar
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Re: New Class: TFolderEx

Post by richard-service »

Hi Daniel,

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

Richard

Harbour 3.2.0dev (r1904111533)/xHarbour 1.2.3 Intl. (SimpLex) (Build 20180818) => Borland C++ v7.4
xHarbour 0.99.71 (SimpLex) => Borland C++ v5.5
MySQL v5.7 /ADS v12
Harbour 3.2.0dev (r1603181642) => Borland C++ v7.4 64bit
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: New Class: TFolderEx

Post by Daniel Garcia-Gil »

Richard

Sorry.. i dont understand

all feed back is useful, for improve class

thanks all for comments
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Re: New Class: TFolderEx

Post by richard-service »

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?
Regards,

Richard

Harbour 3.2.0dev (r1904111533)/xHarbour 1.2.3 Intl. (SimpLex) (Build 20180818) => Borland C++ v7.4
xHarbour 0.99.71 (SimpLex) => Borland C++ v5.5
MySQL v5.7 /ADS v12
Harbour 3.2.0dev (r1603181642) => Borland C++ v7.4 64bit
User avatar
MdaSolution
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: New Class: TFolderEx

Post by MdaSolution »

DAniel,
Can you implement it for a Contexual tab in RibbonBar ?
FWH .. BC582.. xharbour
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: New Class: TFolderEx

Post by Daniel Garcia-Gil »

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
Image


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
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: New Class: TFolderEx

Post by Daniel Garcia-Gil »

Mda..
MdaSolution wrote:Can you implement it for a Contexual tab in RibbonBar ?
i dont thinks so...
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: New Class: TFolderEx

Post by Daniel Garcia-Gil »

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 :D


Download Here

(i like the movie tabs ;-) )
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Post Reply