Ribbon Theme

Post Reply
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Ribbon Theme

Post by James Bott »

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
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Ribbon Theme

Post by Silvio.Falconi »

yes, I confirm SetThemes()
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Ribbon Theme

Post by cnavarro »

Please try with and tell me
James Bott wrote:
oRBar:= TRibbonbar():New(…)
oRbar:setStyle(…)
oRBar:Default()

James
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Ribbon Theme

Post by James Bott »

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
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Ribbon Theme

Post by Silvio.Falconi »

But You resolve the problem for new style ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Ribbon Theme

Post by James Bott »

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
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: Ribbon Theme

Post by vilian »

fraxzi wrote:Hi James,

I got it!

Image
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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Ribbon Theme

Post by James Bott »

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
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: Ribbon Theme

Post by vilian »

Thank you james!
I will been waiting anxiously for you improvements !!
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Ribbon Theme

Post by James Bott »

Vilian,

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

http://forums.fivetechsupport.com/viewt ... 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
Last edited by James Bott on Wed Feb 20, 2019 3:27 pm, edited 1 time in total.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: Ribbon Theme

Post by vilian »

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
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Ribbon Theme

Post by Silvio.Falconi »

Any solution for ribbonbar 2019 blu style ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: Ribbon Theme

Post by vilian »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Ribbon Theme

Post by Antonio Linares »

In order to test differents RibbonBar themes, here you have a generic function to modify the RibbonBar theme on runtime

rbtheme.prg

Code: Select all

#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

//----------------------------------------------------------------------------//
Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
rhlawek
Posts: 165
Joined: Sun Jul 22, 2012 7:01 pm

Re: Ribbon Theme

Post by rhlawek »

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?
Post Reply