Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/VCL/Action Classes    [ Add a report in this area ]  
Report #:  102419   Status: Open
RibbonStyleActnCtrls: No dropdown arrows of Actiontoolbar buttons
Project:  Delphi Build #:  XE, XE2
Version:    16.3 Submitted By:   Werner Pamler
Report Type:  Basic functionality failure Date Reported:  1/7/2012 4:20:55 PM
Severity:    Serious / Highly visible problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All versions Internal Tracking #:   289385
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
Items on an ActionToolbar with nested subitems usually show an arrow to
indicate that there is a "submenu". This works fine for the StandardStyle, XPStyle
and the PlatformDefaultStyle of the Actionmanage.

If one of the new RibbonStyles is selected, however, the arrow is no longer
displayed. Since recently-used-file techniques usually take advantage of this
arrow, such projects cannot use the RibbonStyles.



SYSOP EDIT:

(copied from comment)

There are two ways to get the desired result.

The ribbon style uses enhanced properties so to get a split button to display,
change the ActionClientItems' commandproperties ButtonType property to
btSplit. This property is ignored by the default styles and when using the ribbon
styles, will pick up the desired button control to use.

Alternatively, the following source modification can be made:

Copy the Vcl.RibbonStyleActnCtrls unit locally to your project first.

Around line 1866 in the Vcl.RibbonStyleActnCtrls unit (method name:
TRibbonStyleActionBars.GetControlClass) where the line is:

"else if (AnItem.CommandStyle = csButton) then"

replace the contents between the begin and end for the if condition with:

    if ActionBar.InheritsFrom(TRibbonGroup) then
    begin
      LButtonProps := (AnItem.CommandProperties as TButtonProperties);
      if (LButtonProps <> nil) and (LButtonProps.ButtonType in [btDropDown,
btSplit]) then
      begin
        if LButtonProps.ButtonType = btDropDown then
          Result := TRibbonDropDownButton
        else
        begin
          if LButtonProps.ButtonSize = bsLarge then
            Result := TRibbonLargeSplitButton
          else
            Result := TRibbonSmallSplitButton
        end;
      end
      else if (LButtonProps <> nil) and (LButtonProps.ButtonSize = bsLarge) then
        Result := TRibbonLargeButtonControl
      else
        Result := TRibbonSmallButtonControl;
    end
    else
    begin
      if AnItem.HasItems then
      begin
        if AnItem.Action <> nil then
          Result := TRibbonSmallSplitButton
        else
          Result := TRibbonDropDownButton;
      end
      else
        Result := TRibbonSmallButtonControl;
    end;

This code basically checks to see if the controls are being displayed on a ribbon it
does its normal processing, however if not, then it does what it can do to
determine a suitable control to use for displaying.

NOTE: This doesn't deal with large buttons, that is an exercise left up to the
reader...
Steps to Reproduce:
Run the attached project.
When you select one of the RibbonStyle settings the arrow next to the toolbutton disappears.
Workarounds
None
Attachment
102419.zip
Comments

Jeremy North at 1/10/2012 3:15:52 PM -
There are two ways to get the desired result.

The ribbon style uses enhanced properties so to get a split button to display, change the ActionClientItems' commandproperties ButtonType property to btSplit. This property is ignored by the default styles and when using the ribbon styles, will pick up the desired button control to use.

Alternatively, the following source modification can be made:

Copy the Vcl.RibbonStyleActnCtrls unit locally to your project first.

Around line 1866 in the Vcl.RibbonStyleActnCtrls unit (method name: TRibbonStyleActionBars.GetControlClass) where the line is:

"else if (AnItem.CommandStyle = csButton) then"

replace the contents between the begin and end for the if condition with:

    if ActionBar.InheritsFrom(TRibbonGroup) then
    begin
      LButtonProps := (AnItem.CommandProperties as TButtonProperties);
      if (LButtonProps <> nil) and (LButtonProps.ButtonType in [btDropDown, btSplit]) then
      begin
        if LButtonProps.ButtonType = btDropDown then
          Result := TRibbonDropDownButton
        else
        begin
          if LButtonProps.ButtonSize = bsLarge then
            Result := TRibbonLargeSplitButton
          else
            Result := TRibbonSmallSplitButton
        end;
      end
      else if (LButtonProps <> nil) and (LButtonProps.ButtonSize = bsLarge) then
        Result := TRibbonLargeButtonControl
      else
        Result := TRibbonSmallButtonControl;
    end
    else
    begin
      if AnItem.HasItems then
      begin
        if AnItem.Action <> nil then
          Result := TRibbonSmallSplitButton
        else
          Result := TRibbonDropDownButton;
      end
      else
        Result := TRibbonSmallButtonControl;
    end;

This code basically checks to see if the controls are being displayed on a ribbon it does its normal processing, however if not, then it does what it can do to determine a suitable control to use for displaying.

NOTE: This doesn't deal with large buttons, that is an exercise left up to the reader...

Werner Pamler at 1/11/2012 11:49:57 AM -
Thank you, Jeremy, for these two functional solutions.

Server Response from: ETNACODE01