New Class: TFolderEx

New Class: TFolderEx

Postby Daniel Garcia-Gil » Sun Aug 08, 2010 7: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
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  Expand view  RUN

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

Re: New Class: TFolderEx

Postby ukoenig » Sun Aug 08, 2010 8: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 :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
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: New Class: TFolderEx

Postby Daniel Garcia-Gil » Sun Aug 08, 2010 8:28 pm

Uwe..

do you mean about that?

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

Re: New Class: TFolderEx

Postby ukoenig » Sun Aug 08, 2010 9: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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: New Class: TFolderEx

Postby Daniel Garcia-Gil » Sun Aug 08, 2010 9: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
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: New Class: TFolderEx

Postby RAMESHBABU » Mon Aug 09, 2010 2: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
User avatar
RAMESHBABU
 
Posts: 625
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Re: New Class: TFolderEx

Postby Daniel Garcia-Gil » Mon Aug 09, 2010 2:35 am

Ramesh

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

it's in TODO list :D
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: New Class: TFolderEx

Postby nageswaragunupudi » Mon Aug 09, 2010 2:52 am

Daniel
Excellent
Very useful
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10648
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: New Class: TFolderEx

Postby richard-service » Mon Aug 09, 2010 3:19 am

Hi Daniel,

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

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 804
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: New Class: TFolderEx

Postby Daniel Garcia-Gil » Mon Aug 09, 2010 3:30 am

Richard

Sorry.. i dont understand

all feed back is useful, for improve class

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

Re: New Class: TFolderEx

Postby richard-service » Mon Aug 09, 2010 3: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 (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 804
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: New Class: TFolderEx

Postby MdaSolution » Mon Aug 09, 2010 2:05 pm

DAniel,
Can you implement it for a Contexual tab in RibbonBar ?
FWH .. BC582.. xharbour
User avatar
MdaSolution
 
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: New Class: TFolderEx

Postby Daniel Garcia-Gil » Mon Aug 09, 2010 2: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
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
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: New Class: TFolderEx

Postby Daniel Garcia-Gil » Mon Aug 09, 2010 2:14 pm

Mda..

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


i dont thinks so...
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: New Class: TFolderEx

Postby Daniel Garcia-Gil » Mon Aug 09, 2010 2: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 :D


Download Here

(i like the movie tabs ;-) )
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Otto and 31 guests