Button Bars on Folders

Button Bars on Folders

Postby TimStone » Wed Sep 16, 2009 6:11 pm

I was doing a search to see if there are any discussions or samples for using button bars on folders but I couldn't find any.

I have an idea for what I need to do, but I thought I'd ask first to be sure I head down the right path !
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Button Bars on Folders

Postby ukoenig » Wed Sep 16, 2009 8:13 pm

Hello Tim,

The Solution, to include a different Buttonbar on each Folderpage with all Functions You need.
Much better, using the new VTitle-Class with more possible Graphic-Designs ( animated Buttons and more..)

I hope, Daniel will include the Button-Tooltips and the missing Gradient-Parameter .T./.F. for Horiz. and Vert.

I don't use Buttonbars inside the Application, It is only included for a Test :

Image

The Way I do it :
The Buttons are placed animated with Reflex, inside a VTitle on the Main-Dialog.
( I could place it inside a Folderpage as well )

Image

Code: Select all  Expand view

....
....

REDEFINE FOLDER oFld ID 100 OF oDlg TRANSPARENT ;
PROMPTS " Page 1 ", " Page 2 ", " Page 3 ", " Page 4 ", " Page 5  " ;
DIALOGS "Page1", "Page2", "Page3", "Page4", "Page5"   FONT oFoldFont

// Dialog- and FolderGradient

ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( SetImages(oDlg,oFld), ;
   GradBrush( oDlg, { { 0.50, 14853684, 16314573 }, ;
          { 0.50, 16314573, 14853684 } }, .T. ), MAKEBAR(oFld) ) ;
ON PAINT SetFoldGrad( oFld )  

RETURN NIL  

// ----------------------------------------------

FUNCTION MAKEBAR(ofld)
LOCAL oBar1, oBar2, oTitle1
LOCAL oBtn1, oBtn2, oBtn3, oBtn4
LOCAL oBtn11, oBtn12, oBtn13, oBtn14

// using VTitles ( much better ) :
@  0, 0 TITLE oTitle1 size 820, 60 OF  oFld:aDialogs[1] SHADOW BOTTOMLEFT SHADOWSIZE 1 TOPRIGHT
@  20,  20  TITLETEXT OF oTitle1 TEXT "Using VTitles inside Folder-Pages"  ;
FONT oTextFont COLOR CLR_BLACK  

DEFINE BUTTONBAR oBar1 OF oFld:aDialogs[1]  SIZE 80, 67 2007 RIGHT

DEFINE BUTTON oBtn1 OF oBar1 ACTION ( NIL ) ;
FILENAME aPICTURES[9][3] PROMPT "Windows"  TOOLTIP "Windows and Dialog"

DEFINE BUTTON oBtn2 OF oBar1 ACTION ( NIL ) ;
FILENAME aPICTURES[10][3] PROMPT "xBrowse"  TOOLTIP "xBrowse"

DEFINE BUTTON oBtn3 OF oBar1 ACTION ( NIL ) ;
FILENAME aPICTURES[11][3] PROMPT "BTN-Bars"  TOOLTIP "Folder"

DEFINE BUTTON oBtn4 OF oBar1 ACTION ( NIL ) ;
FILENAME aPICTURES[12][3] PROMPT "Folder"  TOOLTIP "Button-Bar"

// ------ Next Page -----

DEFINE BUTTONBAR oBar2 OF oFld:aDialogs[2]  SIZE 80, 67 2007 RIGHT

DEFINE BUTTON oBtn11 OF oBar2 ACTION ( NIL ) ;
FILENAME aPICTURES[9][3] PROMPT "Windows"  TOOLTIP "Windows and Dialog"

DEFINE BUTTON oBtn12 OF oBar2 ACTION ( NIL ) ;
FILENAME aPICTURES[10][3] PROMPT "xBrowse"  TOOLTIP "xBrowse"

DEFINE BUTTON oBtn13 OF oBar2 ACTION ( NIL ) ;
FILENAME aPICTURES[11][3] PROMPT "BTN-Bars"  TOOLTIP "Folder"

DEFINE BUTTON oBtn14 OF oBar2 ACTION ( NIL ) ;
FILENAME aPICTURES[12][3] PROMPT "Folder"  TOOLTIP "Button-Bar"

RETURN( NIL )

// --------- VTitle - Solution ( with 2 Vtitles Vertical ) ----------------------

FUNCTION MAKEBAR1(oDlg)
LOCAL oBar1, oBar2, oBtn1, oBtn2, oBtn3

nSCR0 := oDlg:nWidth()  // Screen-Width
nSCR17 := oDlg:nHeight()  // Screen-Hight - Title-Height
nSCR4 := GetSysMetrics(4)  // Title-Hight ???

//Title 4 Vertical ( Right )
// Top, Left - Width / Height
@  0, nSCR0 - 90 TITLE oBar1 size 90, nSCR17 of oDlg SHADOW BOTTOMLEFT SHADOWSIZE 1 TOPRIGHT
@  0, nSCR0 - 105 TITLE oBar2 size 15, nSCR17 of oDlg SHADOW BOTTOMLEFT SHADOWSIZE 1 TOPRIGHT

@   50,  15 TITLEIMG OF oBar1 BITMAP c_path + "\Images\preview.bmp"  SIZE 45, 45 REFLEX ANIMA LEVEL 255 ;
       ACTION ( NEW_SKIN(), DLG_BTN1() )
@  130,  20  TITLETEXT OF oBar1 TEXT "Preview"  FONT oProgFont COLOR CLR_BLACK  

@  160,  15 TITLEIMG OF oBar1 BITMAP c_path + "\Images\preview.bmp"  SIZE 45, 45 REFLEX ANIMA LEVEL 255 ;
       ACTION ( NEW_SKIN(), DLG_BTN2() )
@  240,  20  TITLETEXT OF oBar1 TEXT "Preview"  FONT oProgFont COLOR CLR_BLACK  

@   460,  18 TITLEIMG OF oBar1 BITMAP c_path + "\Images\exit.bmp"  SIZE 45, 45 REFLEX ANIMA LEVEL 255 ;
       ACTION ( oDlg:End() )
@   540,  30  TITLETEXT OF oBar1 TEXT "Exit"  FONT oProgFont COLOR CLR_BLACK  

oBar1:lRound := .F.
oBar1:aGrdBack := { { 0.9, 14853684, 16314573 },{ 0.9, 16314573, 14853684 } }
oBar2:lRound := .F.
oBar2:aGrdBack := { { 0.1, 16314573, 128 },{ 0.1, 128, 14853684 } }

RETURN( NIL )

// -----------------------------------------

function SetImages(oDlg, oFld)
local oImageList
   
DEFINE IMAGELIST oImageList SIZE 16, 16
   
oImageList:AddMasked( TBitmap():Define( "colors",,   oDlg ), nRGB( 192, 192, 192 ) )    
oImageList:AddMasked( TBitmap():Define( "write",,     oDlg ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "write",,   oDlg ), nRGB( 192, 192, 192 ) )    
oImageList:AddMasked( TBitmap():Define( "favorite",,     oDlg ), nRGB( 192, 192, 192 ) )    
oImageList:AddMasked( TBitmap():Define( "favorite",,     oDlg ), nRGB( 192, 192, 192 ) )    

oFld:SetImageList( oImageList )
   
return nil  

// ------------------------

FUNCTION GradBrush( oDlg, aColors, lPos )
local hDC, hBmp, hBmpOld, oBrush

if Empty( oDlg:oBrush:hBitmap )
      hDC = CreateCompatibleDC( oDlg:GetDC() )
      hBmp = CreateCompatibleBitMap( oDlg:hDC, oDlg:nWidth, oDlg:nHeight )
      hBmpOld = SelectObject( hDC, hBmp )
      GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, aColors, lPos )
      DeleteObject( oDlg:oBrush:hBrush )
      oDlg:oBrush:hBitmap = hBmp
      oDlg:oBrush:hBrush = CreatePatternBrush( hBmp )
      SelectObject( hDC, hBmpOld )
      oDlg:ReleaseDC()
endif  

RETURN NIL

// --------------------------------------------

FUNCTION SetFoldGrad( oFld )
LOCAL n, oDlg
   
FOR n = 1 to Len( oFld:aDialogs )
   oDlg = oFld:aDialogs[ n ]    
   oDlg:bPainted = { | hDC | GradientFill( hDC, 0, 0, oDlg:nHeight, ;
   oDlg:nWidth, { { 0.50, 14853684, 16314573 }, ;
      { 0.50, 16314573, 14853684 } }, .T. ) }
NEXT

RETURN NIL    
 


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: Button Bars on Folders

Postby TimStone » Fri Sep 18, 2009 3:15 pm

I have a dialog with 7 folders. I decided to use button bars on the dialog and on each folder.

I created one function, with 8 bars, and about 60 buttons, which runs when the dialog is activated.

The result is perfect button bars on the dialog and all folders. It worked without any problems.

I'm doing this because my clients have asked for consistency. Instead of label buttons on the side of a folder, or mixed within, they will now see all of the button controls at the top of the dialog ( folder ) in which they are working, and the buttons will be consistant throughout a rather massive program.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Button Bars on Folders

Postby Antonio Linares » Fri Sep 18, 2009 5:12 pm

Tim,

Very good :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: cmsoft and 67 guests