Ribbon Theme

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Ribbon Theme

Post by Silvio.Falconi »

Antonio,
I tried to insert my theme but I have make a confusion..
I use l2016 for ribbonbar and then l2013 for tgroup simulating theme 2019




can you help me to set these colors ?
the color of bar where are the item of menu is gray but it is wrong
Last edited by Silvio.Falconi on Tue Apr 30, 2019 8:38 am, edited 1 time in total.
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 »

rhlawek

I have not tried it in an MDI environment, but it should work the same
Follow the following steps:
1) Fully define RibbonBar, including the call to the function that generates the new style.
2) When defining the Ribbonbar, make sure that there is enough space left in the upper part to place the buttonbar, for this, use the clause TOPMARGIN nTopMarg in the definition of the Ribbonbar.
3) Define the buttonbar but associated with the RIBBONBAR object

Code: Select all

.../...
   oRBar:Default()

   SetRibbonBarTheme( oRBar, 6 ) 
   // End definition of RibbonBar

   DEFINE BUTTONBAR oBar SIZE 22, 22 2010 OF oRBar
 
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
rhlawek
Posts: 165
Joined: Sun Jul 22, 2012 7:01 pm

Re: Ribbon Theme

Post by rhlawek »

Thank you so much.

Making the button bar a child or the ribbon bar fixes most of the painting problems, and all of the clicking behavior problems. And setting the top margin to a larger value does push the top of the ribbon bar tabs down so that the tabs should be visible, but the groups and the buttons on the ribbon bar itself aren't following that down, they are still painting over the top of the tabs. I can change the size of the groups and the buttons, but I haven't figured out what to change to force them down below the tabs again.
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Ribbon Theme

Post by cnavarro »

rhlawek wrote:Thank you so much.

Making the button bar a child or the ribbon bar fixes most of the painting problems, and all of the clicking behavior problems. And setting the top margin to a larger value does push the top of the ribbon bar tabs down so that the tabs should be visible, but the groups and the buttons on the ribbon bar itself aren't following that down, they are still painting over the top of the tabs. I can change the size of the groups and the buttons, but I haven't figured out what to change to force them down below the tabs again.
Please, set height of ribbonbar, look

.../...
local nTopMarg := 24
local nHeight := 128 + nTopMarg

DEFINE RIBBONBAR oRBar WINDOW oWnd ;
PROMPT "One and more", "Two and minus", "Three and more or minus" ;
HEIGHT nHeight TOPMARGIN nTopMarg
.../...
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
rhlawek
Posts: 165
Joined: Sun Jul 22, 2012 7:01 pm

Re: Ribbon Theme

Post by rhlawek »

Thanks again.

I'm going to edit the sample that was provided here to better illustrate the last painting problem.

No matter what I change I can't get the top of the ribbon bar, starting with the tabs but also the ribbon bar background itself, to start painting below the button bar, the ribbon bar seems to want to align to the top of the button bar. Which would be okay, but when I adjust the top margin it pushes down the ribbon bar, but not the groups or the buttons themselves. Things are much improved from when I set out to debug this earlier today, but there is still something I don't fully understand.
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Ribbon Theme

Post by cnavarro »

Ok, I wait your sample
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
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 my posted example if you add this line, then you get a more modern look:

Code: Select all

function BuildRibbon( oWnd )

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

   oRb:SetStyles( .F., .T. )  // New 
Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
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 »

Robert,

Please set oWnd:oTop := nil (after creating the ribbon) and try it again.

Whatever control is placed at oWnd:oTop will try to align itself to the top.
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 »

I just tried that, it actually moves the problem back to where I started before making the suggested change to attach to oRb instead of oWnd. It paints incorrectly and nothing is clickable whether using oRb or oWnd.

Here is the sample code you provided, edited to show the situation. It adds MDI to the windows definition, it adds the button bar attaching to oRb, and it adds and explicitly assigns the values oRb:nTopMargin := 50 and oRb:nTop in SetRibbonBarTheme()

Code: Select all

#include "FiveWin.ch"

#define RB_THEME_DARK         6
#define COLOR_GRAYTEXT       17

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

function Main()

   local oWnd

   DEFINE WINDOW oWnd MDI
   
   oWnd:SetSize( 1200, 800 )

   BuildRibbon( oWnd )

   ACTIVATE WINDOW oWnd CENTER // MAXIMIZED

return nil

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

function BuildRibbon( oWnd )

   local oRb := TRibbonBar():New( oWnd ), oGroup, oBtn, oBar
      
   DEFINE BUTTONBAR oBar SIZE 26, 26 _3D _2010 OF oRb // oWnd  

   DEFINE BUTTON OF oBar ;
          RESOURCE "..\bitmaps\32x32\open.bmp" ;
          FLAT TOOLTIP "Hello world." ;
          ACTION ( MsgInfo( "Hello world.") )

   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:nTopMargin  := 50 
         oRb:nTop        := 28
         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:Refresh()
   oRb:Default()

return nil

//----------------------------------------------------------------------------//
 
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 »

Robert,

As you are using a MDI environment you have to change this line this way:

local oRb := TRibbonBar():New( oWnd:oWndClient )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Ribbon Theme

Post by Silvio.Falconi »

I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
MOISES
Posts: 824
Joined: Wed Aug 22, 2007 10:09 am

Re: Ribbon Theme

Post by MOISES »

Cool, I love that Ribbon in blue!
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: Ribbon Theme

Post by TimStone »

Antonio,

The latest theme from Microsoft ( Ribbon Bar ) is essentially black on grey. The buttons are black outline images ( no color ). The tabs have no color change, and the focused tab is simply the title in bold. The font's are smaller and there are no differences in color with the group labels. The font is smaller. This is the most modern version released recently with Office 365.
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
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 »

Tim,

Could you provide a screenshot ? thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Re: Ribbon Theme

Post by richard-service »

Hi Antonio,

Please look it. office 365

Image
Image
Image
Image
Regards,

Richard

Harbour 3.2.0dev (r1904111533)/xHarbour 1.2.3 Intl. (SimpLex) (Build 20180818) => Borland C++ v7.4
xHarbour 0.99.71 (SimpLex) => Borland C++ v5.5
MySQL v5.7 /ADS v12
Harbour 3.2.0dev (r1603181642) => Borland C++ v7.4 64bit
Post Reply