.../...
oRBar:Default()
SetRibbonBarTheme( oRBar, 6 )
// End definition of RibbonBar
DEFINE BUTTONBAR oBar SIZE 22, 22 2010 OF oRBar
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.
.../...
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
.../...
function BuildRibbon( oWnd )
local oRb := TRibbonBar():New( oWnd ), oGroup, oBtn
oRb:SetStyles( .F., .T. ) // New
#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
//----------------------------------------------------------------------------//
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Enrico Maria Giordano and 38 guests