Page 6 of 11

Re: Ribbon Theme

Posted: Thu Oct 25, 2018 5:48 pm
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

Re: Ribbon Theme

Posted: Thu Oct 25, 2018 6:50 pm
by Silvio.Falconi
yes, I confirm SetThemes()

Re: Ribbon Theme

Posted: Thu Oct 25, 2018 7:29 pm
by cnavarro
Please try with and tell me
James Bott wrote:
oRBar:= TRibbonbar():New(…)
oRbar:setStyle(…)
oRBar:Default()

James

Re: Ribbon Theme

Posted: Fri Oct 26, 2018 2:54 pm
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

Re: Ribbon Theme

Posted: Fri Dec 21, 2018 7:28 pm
by Silvio.Falconi
But You resolve the problem for new style ?

Re: Ribbon Theme

Posted: Fri Dec 21, 2018 11:02 pm
by James Bott
Silvio,

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

Re: Ribbon Theme

Posted: Tue Feb 19, 2019 12:25 pm
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.

Re: Ribbon Theme

Posted: Wed Feb 20, 2019 12:41 am
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.

Re: Ribbon Theme

Posted: Wed Feb 20, 2019 12:49 am
by vilian
Thank you james!
I will been waiting anxiously for you improvements !!

Re: Ribbon Theme

Posted: Wed Feb 20, 2019 1:43 am
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

Re: Ribbon Theme

Posted: Wed Feb 20, 2019 11:19 am
by vilian
Yes, I tried. But I think is something missing in his code, because i can't build a single prg to try.

Re: Ribbon Theme

Posted: Mon Apr 01, 2019 7:22 am
by Silvio.Falconi
Any solution for ribbonbar 2019 blu style ?

Re: Ribbon Theme

Posted: Thu Apr 04, 2019 12:43 pm
by vilian
We really need progress with RibbonBar. The current appearance(2007) is looking like a "old" appearance :(

Re: Ribbon Theme

Posted: Sat Apr 27, 2019 5:02 am
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

Re: Ribbon Theme

Posted: Sun Apr 28, 2019 2:34 pm
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?