FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Ribbon Theme
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Ribbon Theme
Posted: Thu Oct 25, 2018 05:48 PM

Silvio,

Thanks for the feedback. I think you mean setTheme() rather than setStyle(). We already pass a style parameter. And there are some complications in adding a setStyle() method since the style is mostly setup in the New() method so you can't do something like:

oRBar:= TRibbonbar():New(…)
oRbar:setStyle(…)

At least you can't without revising the New() method a lot. Actually, there is already a setStyles() method which is called from the New() method and the ribbonbar is already partially painted when the code execution gets to the end of the New() method. I agree it would be nice to be able to call a setStyle() method but it will require lots of work. Anyhow I think you meant setTheme().

I agree that we also need an easier way to set the themes. We should not have to define all the different colors and many of them have to be in an array. This should be simple. However, I would like to start by just getting the style right, then release that version. We also need some comprehensive testing and feedback before moving on to the themes. IMHO

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Ribbon Theme
Posted: Thu Oct 25, 2018 06:50 PM

yes, I confirm SetThemes()

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Ribbon Theme
Posted: Thu Oct 25, 2018 07:29 PM
Please try with and tell me

James Bott wrote:

oRBar:= TRibbonbar():New(…)
oRbar:setStyle(…)
oRBar:Default()

James
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Ribbon Theme
Posted: Fri Oct 26, 2018 02:54 PM

Cristobal,

It is actually oRBar:setStyles() with an "s" at the end. I think it should have been setStyle() since it only changes one style, but changing the name of the method now could break existing code in use now.

It may be useful for changing the theme, but I'm not sure it can handle everything right now. I think there are other parameters that it doesn't have that we may need to change a theme. I will be looking into that more.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Ribbon Theme
Posted: Fri Dec 21, 2018 07:28 PM

But You resolve the problem for new style ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Ribbon Theme
Posted: Fri Dec 21, 2018 11:02 PM

Silvio,

Sorry, no I have been sidetracked on other projects. I do hope to get back to it soon.

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Ribbon Theme
Posted: Tue Feb 19, 2019 12:25 PM
fraxzi wrote:Hi James,

I got it!





Your ribbonbar is pretty beautiful! could you share a small code to us test this ?
I tried to build it joining the parts of the code that you have shared, but I had no success.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Ribbon Theme
Posted: Wed Feb 20, 2019 12:41 AM

Vilian,

Unfortunately, there is no code that I can provide yet.

There are several classes involved, and all need modifications since colors and other attributes are often hardcoded inside codeblocks so it is not even possible to modify these without changing the class code. I have probably spent 50+ hours on it and now I have forgotten a lot since I haven't worked on it since last October due to other pressing projects.

I will put it back on my ToDo list.

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Ribbon Theme
Posted: Wed Feb 20, 2019 12:49 AM

Thank you james!
I will been waiting anxiously for you improvements !!

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Ribbon Theme
Posted: Wed Feb 20, 2019 01:43 AM
Vilian,

Have you tried the code in Fraxzi's post here:

http://forums.fivetechsupport.com/viewtopic.php?f=3&t=36145&start=30#p215907

I have not tried it yet, so I don't know if it will get you what you need--at least for now.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Ribbon Theme
Posted: Wed Feb 20, 2019 11:19 AM

Yes, I tried. But I think is something missing in his code, because i can't build a single prg to try.

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Ribbon Theme
Posted: Mon Apr 01, 2019 07:22 AM

Any solution for ribbonbar 2019 blu style ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Ribbon Theme
Posted: Thu Apr 04, 2019 12:43 PM

We really need progress with RibbonBar. The current appearance(2007) is looking like a "old" appearance :(

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Ribbon Theme
Posted: Sat Apr 27, 2019 05:02 AM
In order to test differents RibbonBar themes, here you have a generic function to modify the RibbonBar theme on runtime

rbtheme.prg
Code (fw): Select all Collapse
#include "FiveWin.ch"

#define RB_THEME_DARK         6
#define COLOR_GRAYTEXT       17

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

function Main()

   local oWnd

   DEFINE WINDOW oWnd
   
   oWnd:SetSize( 1200, 800 )

   BuildRibbon( oWnd )

   ACTIVATE WINDOW oWnd CENTER // MAXIMIZED

return nil

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

function BuildRibbon( oWnd )

   local oRb := TRibbonBar():New( oWnd ), oGroup, oBtn

   oGroup = oRb:AddGroup( 185, "First", 1 )
   oBtn = oGroup:AddButton( 3, 3, oGroup:nHeight - 19, 90, "One", { || MsgInfo( "One" ) } )
   oBtn:LoadBitmaps( "..\bitmaps\32x32\new.bmp" )
   oBtn = oGroup:AddButton( 3, oBtn:nWidth + 3, oGroup:nHeight - 19, 90, "Two", { || MsgInfo( "Two" ) } )
   oBtn:LoadBitmaps( "..\bitmaps\32x32\open.bmp" )
   
   oGroup = oRb:AddGroup( 185, "Second", 1 )
   oBtn = oGroup:AddButton( 3, 3, oGroup:nHeight - 19, 90, "Three" )
   oBtn:LoadBitmaps( "..\bitmaps\32x32\setup.bmp" )
   oBtn = oGroup:AddButton( 3, oBtn:nWidth + 3, oGroup:nHeight - 19, 90, "Four" )
   oBtn:LoadBitmaps( "..\bitmaps\32x32\quit.bmp" )

   oRb:AddGroup( 185, "Third", 1 )

   SetRibbonBarTheme( oRb, RB_THEME_DARK )
   
return oRb   

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

function SetRibbonBarTheme( oRb, nTheme ) 

   local oDlg, oGroup, oBtn

   do case
      case nTheme == RB_THEME_DARK
         oRb:oFont:End() 
         oRb:SetFont( TFont():New( "Segoe UI", 0, -14 ) )
         
         oRb:nHeight     = 136
         oRb:nHeightFld  =  20
         oRb:hSeparation =   4
         oRb:nLeftMargin =  20
         oRb:nRoundBox   =   0

         oRb:nClrPaneRB    = RGB( 68,   68,  68 )
         oRb:nClrBoxOut    = RGB( 178, 178, 178 )
         oRb:nClrBoxIn     = RGB( 178, 178, 178 )
         oRb:nClrBoxSelOut = RGB( 178, 178, 178 )
         oRb:nClrBoxSelIn  = RGB( 178, 178, 178 )
         oRb:aGrad         = { { 1, RGB( 178, 178, 178 ), RGB( 178, 178, 178 ) } }
         oRb:aGradFld      = { | nOpt | If( nOpt == oRb:nStart, { { 1, RGB( 178, 178, 178 ), RGB( 178, 178, 178 ) } },;
                                                                { { 1, RGB( 178, 178, 178 ), RGB( 178, 178, 178 ) } } ) }
         oRb:aGradHigh     = { { 1, RGB( 178, 178, 178 ), RGB( 178, 178, 178 ) } }  
         oRb:aGradOver     = { { 1, RGB( 0, 114, 198 ), RGB( 0, 114, 198 ) } }
         
         AFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, RGB( 0, 0, 0 ), RGB( 255, 255, 255 ) ) } )
         
         DeleteObject( oRb:hBmpBrushEx )
         DeleteObject( oRb:hBrushEx )
         oRb:hBmpBrushEx = GradientBmp( oRb, oRb:nRight - oRb:nRightMargin - 3, oRb:nBottom - oRb:nTopMargin + 1, oRb:aGrad )
         oRb:hBrushEx    = CreatePatternBrush( oRb:hBmpBrushEx )
         
         for each oDlg in oRb:aDialogs
            
            oDlg:hBack = oRb:hBrushEx
            oDlg:Refresh()
            
            for each oGroup in oDlg:aControls
               if oGroup:IsKindOf( "TRBGROUP" )
                  oGroup:oFont:End()
                  oGroup:SetFont( oRb:oFont )
                  
                  oGroup:nHeight     -= 24
                  oGroup:nClrBoxIn    = RGB( 160, 160, 160 )
                  oGroup:aGradCaption = { { 1, RGB( 160, 160, 160 ), RGB( 160, 160, 160 ) } }
                  oGroup:bClrText     = { | lEnable | If( lEnable, RGB( 0, 0, 0 ), GetSysColor( COLOR_GRAYTEXT ) ) }
                  oGroup:nClrBoxIn    = RGB( 160, 160, 160 )
                  oGroup:nClrBoxOut   = RGB( 160, 160, 160 )
                  
                  DeleteObject( oGroup:hBrushSel )
                  DeleteObject( oGroup:hBrushUnSel )
                  DeleteObject( oGroup:hBack )
                  oGroup:hBrushUnSel  = oDlg:hBack
                  oGroup:hBack        = oDlg:hBack
                  
                  for each oBtn in oGroup:aControls
                     if oBtn:IsKindOf( "TRBTN" )
                        oBtn:oFont:End()
                        oBtn:SetFont( oRb:oFont )
                        
                        oBtn:nHeight       -= 24
                        oBtn:bClrGradNormal = { | lPressed | If( lPressed, { { 1, RGB( 160, 160, 160 ), RGB( 160, 160, 160 ) } },;
                                                                           { { 1, RGB( 160, 160, 160 ), RGB( 160, 160, 160 ) } } ) }
                        oBtn:aClrGradUnder = { || { { 1, RGB( 160, 160, 160 ), RGB( 160, 160, 160 ) } } }   
                        oBtn:aClrGradBack  = { { 1, RGB( 160, 160, 160 ), RGB( 160, 160, 160 ) } }
                        oBtn:nClrBoxIn     = RGB( 160, 160, 160 )
                        oBtn:nClrBoxOut    = RGB( 160, 160, 160 )
                     endif   
                  next
                  oGroup:Refresh()
                  
               endif
            next
         next   
         
   endcase
   
   oRb:Default()

return nil

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


regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM
Re: Ribbon Theme
Posted: Sun Apr 28, 2019 02:34 PM

Antonio,

In the last example given for setting up a ribbon bar, it compiles and runs correctly.

However, I typically use a small button bar above the ribbon bar, but when I add the following to the BuildRibbon function, immediately after the local declarations, the layout is no longer correct, apparently because the top of the ribbon bar location gets pushed down.

DEFINE BUTTONBAR oBar SIZE 22, 22 _3D _2010 OF oWnd

I've tested changing the various positioning values but have not figured out how to do a satisfactory layout. If you can guide me to what needs to be change it would be most helpful.

Also, I typically use a ribbon bar in an MDI window, when I make the window in this sample and MDI window, and add the button bar, the ribbon bar itself isn't clickable at all.

Any pointers on how to address this?