I am running Delphi 2010 on both a 64 bit windows machine (Win 7), and a 32 bit windows machine (XP).
I am trying to learn how to use the TRibbon control.
I have been following the example in Marco Cantu's 2009 Handbook and watching YouTube Demos, but my control is not working like that as explained in the book or demos.
I added two tabs, by right clicking the control. However, the TRibbon looked as exactly as it does in my screenshot, when i drop it on the main form. It is not as high as the ones in the books or youtube demos.
I have tried the same thing on my Win 32 laptop running Windows Xp and Delphi 2010 and get the exact same results
here is what it looks like on my machine
here is what it is suppose to look like in a demo
Once again. When it drop it on the form, it does not take the shape and height as that as i see in the demos. Even when i add tabs. Did i do something wrong during my Delphi 2010 installation?
I managed finally to reproduce the problem in Delphi XE (Update 1) on Win7 64 with Aero enabled. It seems that the size gets set wrong in the .DFM file, and because the
Ribbon
doesn't support manual resizing you can't visually fix it in the IDE(although it appears correctly at runtime)or in theObject Inspector
. It occasionally appears correctly at runtime, but it seems that's sporadic as well.It's a nasty bug, because it makes it impossible to design the
Ribbon
. You can addRibbonGroup
items, and assign theActionManager
, and try and design it completely using theStructure Pane
, but of course that's not a practical solution.Fortunately, there's a pretty easy workaround, although it's annoying to have to do. :)I managed twice to get the following workaround to function, but starting over it failed to work several times, so it's a possible way around it (no promises - worked in XE, consistently failed in XE2 Update 2):
Ribbon
and add at least one tab.View as Text
from the context (pop-up) menu.Ribbon
control in the.dfm
text, and change theHeight
from the26
that the IDE assigned to200
. (The next step will adjust it, but that's fine - the200
fixes the immediate problem.)View as Form
, and theRibbon
should display correctly.(I reported it in QC against XE2 Update 2, as the problem also exists there - QC #101642)
I traced it to
TCustomRibbon.GetCaptionHeight
, specificallyIt seems like the
GetSystemMetrics
call is returning something less than26
on certain Win7 configurations (although I can't figure out why yet). There are a couple of commented lines in that method that seem to alter the result, but as I said they've been commented out.The strange part is that in the
TCustomRibbon.Create
, theHeight
is set by a call toGetRibbonMetric(rmFullHeight)
, which sets theResult := cRibbonHeight + GetCaptionHeight;
, andcRibbonHeight
is a constant defined ascRibbonHeight = 117;
.Finally think I've tracked this down. In the declaration of
TRibbon
, there's apublished
property declaration:Because this is the default, it appears that any other value means that the call to
GetRibbonMetric
mentioned above doesn't happen (see theTCustomRibbon.Create
mentioned above), and the strange result from the call toGetSystemMetric
causes the erroneous value26
to be saved as the 'other value`. Wierd; will update the QC in the AM.Addendum: Updated QC report with additional details.
Addendum: QC report opened in May 2012, but does not appear to have been resolved as of XE5 Update 1 (checked Jan 2014).