Coder Social home page Coder Social logo

jam-software / ribbonframework Goto Github PK

View Code? Open in Web Editor NEW
196.0 54.0 57.0 35.42 MB

Delphi wrapper and standalone Designer for the Windows Ribbon Framework

License: Other

Pascal 79.92% PowerShell 0.41% C++ 19.67%
windows ribbon framework desginer delphi

ribbonframework's Introduction

Windows Ribbon Framework for Delphi

This Delphi library allows Delphi developers to use of the Windows Ribbon Framework in their Delphi applications. This library uses the native Windows library to implement the Ribbon functionality. It does not emulate the Ribbon user interface like other Delphi component sets do (or Delphi's built-in Ribbon emulation components).

The Windows Ribbon Framework is the new User Interface library introduced with Windows 7, but is also available for Vista users through the Vista Platform Update (which is installed through regular Windows updates and so present on most Vista and Server 2008 machines). This library allows you to create ribbon applications similar to Office 2010. In fact, the WordPad and Paint accessories that ships with Windows 7 and later use the Ribbon framework, also the Microsoft Movie Maker shipped with the Live Essentials Addon.

Screenshot

This has the advantage that your ribbon will always look and behave exactly as Microsoft intended it. This also makes it easier to take advantage of improvements that Microsoft will make to the Ribbon Framework in the future. A further advantage is that you can use this library in open source projects since it does not depend on commercial third party libraries.

There are also some disadvantages though. The most notable one is that applications using the Windows Ribbon Framework will only display a ribbon when running on Windows 7 or later, or on Windows Vista with the Platform Update. If your application needs to support older Windows versions too, then you will also need to provide an additional "traditional" user interface, for example consisting of menus and toolbars.

Also, the method for creating Ribbon User Interfaces may be unfamiliar to Delphi developers: a Ribbon User Interface is completely defined in XML (not unlike XAML). There is no way to create ribbon controls at run-time, which also means that there is no way to design a ribbon visually in Delphi. A special designer appplication however ships with these components, it will create the XML for you.

Features

This Delphi library is much more than a simple header translation. It has the following features:

  • Complete translation of the UI Ribbon header files. You can use these for low-level access to the Ribbon API. Although you probably won't need this because the library comes with a class library that is much easier to use.
  • A class library that provides higher-level access to the Ribbon API. This makes working with the Ribbon API much easier and takes care of most of the nasty implementation details.
  • A control for dropping on any existing VCL form that automatcally loads the ribbon and maps ribbon comamnds to equally named VCL Actions.
  • Delphi-versions of the UI Ribbon Samples from the Windows SDK. There are low-level versions of these samples that use the Ribbon API directly, as well as medium-level versions that use the Delphi Ribbon class library. You will see that it takes much less code when you use the class library.
  • A feature-complete semi-visual Ribbon Designer. This application lets you create the Ribbon XML files without needing to write XML. You can completely design and test the ribbon in this application. It will also compile the Ribbon to a resource file and create Delphi source files with the constants you need to access the ribbon commands.
  • The Ribbon Designer comes with a WordPad template that lets you quickly create a Ribbon that looks virtually identical to the WordPad accessory that comes with Windows 7.

Download

Download latest version

Bug Reporting and Support

Our issue tracker is intended to file bugs, it is not a support forum. Please use e.g. stackoverflow.com to get support. IMPORTANT: Before submitting bugs, make sure you are using the latest version. When submitting bugs, please include a screenshot of the problem or the exact error messages and exception call stacks, and a sample project or steps how to replicate the problem with one of the included sample projects.

Getting Started

Supported platforms: RAD Studio / Delphi XE3 and higher.

Installing the Windows Ribbon Framework for Delphi:

  1. Open the project "Package\UIRibbonPackage.dproj"
  2. Right click on "UIRibbonPackage.bpl" and click "Install"
  3. Go to "Tools > Options > Environment Options > Delphi Options > Library > Library Path > [...]" Browse to the "Lib" folder of this framework, press "OK", "Add", "OK", "OK"

Creating and adding a ribbon for your existing form:

  1. Run "Designer\Bin\RibbonDesigner.exe" and create your ribbon. Name of the ribbon commands equally to the VCL actions they should trigger.
  2. Save the ribbon XML file to your project's folder and hit the "Build" button
  3. Add the resulting .PAS file to the uses of your form
  4. Drag the TUIRibbon control from RAD Studios's tool palette on your form
  5. Assign your TActionManager to the ActionManager property of the TUIRibbon control

Please refer to our wiki for detailed instructions. This framework was originally developed by Eric Bilsen

License

License file

ribbonframework's People

Contributors

crayon2000 avatar daniel-tr avatar gabr42 avatar joachimmarder avatar karooma avatar lionelgross avatar markwilliams1234 avatar neslib avatar romankassebaum avatar saschaschaefer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ribbonframework's Issues

Adapt sample projects that use deprecated TRibbonForm

To do:

  • Add to search path of project: ......\Lib
  • Adapt "Ribbon\CompileRibbon.BAT" to use new powershell script
  • Remove the .RC and .H files in the subfolder "Ribbons" from VC
  • Use unit "UIRibbon" instead of "UIRibbonForm"
  • No longer use TRibbonForm but derive from TForm.
  • Add a TUIRibbon control with name "Ribbon" to the form and assign the correct resource name
  • If the form has overriden RibbonLoaded(), add Sender: TObject as param and assign it to Ribbon.OnLoaded
  • Remove .RES file, no longer need in XE3+ from VC
  • Remove .RC file from project files
  • Add .pas and .res file generated by batch

No Compiler messages generated.

Message handler only assigned if the application receives a file parameter.

Handler is not assigned if the RibbonDesigner.exe is run without parameters.

FCompiler.OnMessage := RibbonCompilerMessage

needs to be moved in the TformMain.create event.

c++ Builder Berlin 10.1 (update 2) not work with TurboPack/RibbonFramework

I created empty VCL Forms Application (C++ builder), On mainForm i put TUIRibbon and try to compile,
First issue is that on Unit1.h is missing #include <UIRibbon.hpp> instead there is line with #include "UIRibbon.h" which is from $(BDS)\include\windows\sdk\UIRibbon.h and seem to me that is generated from UIRibbon.idl. if i put line #include <UIRibbon.hpp> after #include "UIRibbon.h" i can compile source. Then i added "SimpleRibbonUI.pas" from samples directory. I built project. when i run under debbuger i got
"Project Project1.exe raised exception class EOleException with message "Unspecified error". if i click continue i got new error window with message: "An error occurred while trying to load Ribbon resource "APPLICATION": Unspecified error.
I look Project1.exe with VisualStudio and this resources are visible:

slika

binary data of APPLICATION_RIBBON looks like this:

slika

Any Idea?

Fix/Enhancement: Ribbon designer hard wired to windows 7 sdk path settings

The ribbon designer code is partly hard wired to windows 7 sdk path settings and fails to work on windows 10.
I suggest to:

  • Add an option to specify the path to windows power shell.
  • Remove unnecessary checks for Delphi compiler inside the code as the user can specify that in the settings dialogue.
  • Remove unnecessary checks for windows sdk path and tools and the download button as it is specific to windows 7 only.

Let me if I can be of any help.

Karim Kouni.

Is there something missing on site ?

Joachim...

The description on how to use the framework is actually correct and complete ? Because yesterday I spent 10 hours following the instructions on the site and redoing the project and can not bind controls to the code. I used the most common example (no Actions) without success.
I asked a question on Stackoverflow but no one answered so far (http://stackoverflow.com/questions/39999961/windows-ribbon-framework-for-delphi-fail-on-linking-to-commands). I did the following steps (I'm using Delphi 10.1 Berlin):

  1. I jump this part (according to the instructions Delphi 10.1 don't need it)

    Go to "Project | Options".
    Go the the Application page.
    Uncheck "Enable runtime themes". Don't worry, your application will still be theme-aware because we will use a custom manifest (I did not find the informations for this !).

  2. Choose "Project | Add to project...".
    In the File Open dialog box, choose the "Resource file (*.rc)" file type.
    Open the file "UIRibbon.rc" in the Lib directory of the Ribbon Framework.

  3. Drop the TUIRibbon control from your RAD Studio toolbox on your main form.

  4. Add the .PAS file created by the Ribbon Designed to the uses of your form. It is named equally to the XML file in which you saved the ribbon design.

OK. I compiled the source code and the Ribbon has been shown correctly.

  1. I added the file "Ribbon\RibbonMarkup.pas" to the project and a "uses RibbonMarkup" on Implementation section of unit.
  2. I pointed to the Ribbon Lib folder under "Options / Options / Delphi options / Library / Library Path.
  3. I declared in Type the functions:
    procedure RibbonLoaded;
    procedure CommandCreated(const Sender: TUIRibbon; const Command: TUICommand);
  4. In private:
    FCmdCut : TUICommandAction;
    FCmdCopy : TUICommandAction;
    procedure CutExecute(const Args: TUICommandActionEventArgs);
    procedure CopyExecute(const Args: TUICommandActionEventArgs);
  5. The implementation of functions:

procedure TfrmPrincipal.CommandCreated(const Sender: TUIRibbon;
const Command: TUICommand);
begin
inherited;

case Command.CommandId of

CmdCut:
  begin
    FCmdCut := Command As TUICommandAction;
    FCmdCut.OnExecute := CutExecute;
  end;

CmdCopy:
  begin
    FCmdCopy := Command As TUICommandAction;
    FCmdCopy.OnExecute := CopyExecute;
  end;

end;
end;

procedure TfrmPrincipal.RibbonLoaded;
begin
inherited;
Color := ColorAdjustLuma(Ribbon.BackgroundColor, -25, False);
end;

procedure TfrmPrincipal.CopyExecute(const Args: TUICommandActionEventArgs);
begin
pgcTelas.ActivePageIndex := 2;
end;

procedure TfrmPrincipal.CutExecute(const Args: TUICommandActionEventArgs);
begin
pgcTelas.ActivePageIndex := 1;
end;

The controls do not run the code. Do I forgot something ?

Adalberto Josรฉ Brasaca
System Analyst
[email protected]
Piracicaba - Brazil

Can't biuld/preview ribbon

I can't build any ribbon, even from samples folder. When i try to build or preview ribbon, text field on the button of ribbondesigner.exe blink ones on red and nothing else happen. I use Delphi XE8 on Windows 10 Pro and my path from ribbondesigner are:
C:\Program Files (x86)\Windows Kits\10\bin\x86\uicc.exe
C:\Program Files (x86)\Embarcadero\Studio\16.0\bin\DCC32.EXE
they don't detect automatically. Does path for uicc.exe should contain "Windows Kits\10"? Downloaded Windows SDK was for Windows 7.

Crash when calling TUIRibbon.SetRecentItems()

Not sure if I'm doing something wrong, but I crash when I call SetRecentItems() when TUIRibbon attempts to set fRecentItems at line 1311, the actual crash happens in GetCommand() on line 742

function TUIRibbon.GetCommand(pAction: TCustomAction): TUICommand;
var
  lElement: TRibbonMarkupElement;
begin
  if (not Self.Visible) then
    exit(nil);
  for lElement in Self.RibbonMapper do begin  // <<<--- crashes here
    if (lElement.Name = pAction.Name) then begin
      Self.TryGetCommand(lElement.ID, Result);
      Exit(Result);
    end;
  end;
  Exit(nil);
end;

because RibbonMapper apparently is nil.

Any ideas?

Combobox text is not updated

The combobox component that is not part of the active tab when the program is loaded is not updated. For example, I define that some strings should already appear as default (be shown) when the tab to which they belong were selected. However, the part of the text remains blank. Only by clicking another tab and returning to this is that the user interface is updated. I put a combo box on the default tab that appears when the program is loaded and it did not happen.

ribbon1
ribbon2
ribbon3

Ribbon Designer - Cannot compile ribbon file under windows 10

Hi,
The included power shelll script Generate.Ribbon.Markup.pas.ps1 cannot be compiled on windows 10. the message windows flashes in red than nothing, no error message either. I tried the xml files in the samples folder but no luck. Windows 10 sdk is installed, ribbon compiler and dcc32 paths set correctly.
Everything works fine under windows 7.

Any ideas, can I bypass the power shell script and generate the ribbonmarkup.pas using an alternate method.

Many thanks for the great component. It almost made regret purchasing Devexpress components.

Karim Kouni.

Problems creating button groups

What is the correct way to do this ?

I have tried several attempts to get this to work.

I create a group in the view, then add buttons to it OK, but the MS complier always shows errors and refuses to compile it.

I can't see how to create a set of size definitions that compiler will be happy with when button groups are included.

Can you create a tutorial or provide an example in the samples as to how this can be achieved !

Ta

Support command line build using RibbonDesigner.exe

Syntax:

RibbonDesigner.EXE "Path\To\Ribbon.xml" /BUILD

Make sure console output is redirected to parent console. This makes makefiles and build scripts independent of the PowerShell script, which might get integrated in the RibbonDesigner at some day.

Action link on TUICommandAnchor does not work

The tutorial should be noted that this instruction classes TUICommandAnchor addition has no additional settings or events to TUICommand. But TUICommand offers ActionLink.

Background is that I would have to perform a action when Tab changing

Settings save/load should be decoupled from the component

While a new user might appreciate that ribbon state is automatically stored/preserved, the current implementation doesn't allow any flexibility in that manner. We are, for example, storing ribbon configuration in registry, not in file system, and with the current implementation we cannot prevent TUIRibbon from automatically doing its save/restore magic parallel to ours.

I propose making the following changes:

  • RibbonSettingsFilePath is determined once when component is instantiated and not on every access so the application can overwrite the setting.
  • Options property should be added which would contain a set of configuration options TUIRibbonOptions, initially consisting of one option: roAutoPreserveState. Initially this option can be enabled to preserve the backwards compatibility. Auto store/preserve magic would be bypassed if this options is not set.

I can implement these changes if they make sense. [I will certainly disable the automatic save/restore in my fork as it gives me problems.]

Generics in class hierarchy of VCL action causes strange errors in designer

Maybe more a Delphi issue than one of this project, but I put it here for documentation purposes.

I recently have used generics in this way for creating base classes for certain actions:

   TRibbonAction<T:TUICommand> = class(TCustomAction)
   private
     fUICommand: T;
   public
     property UICommand: T read fUICommand write fUICommand;
   published
     property Caption;
     property OnExecute;
     property OnHint;
     property OnUpdate;
   end;

   TRibbonCollectionAction = class(TRibbonAction<TUICommandCollection>)
   end;

   procedure Register;
   begin
     RegisterActions('Ribbon Framework', [TRibbonCollectionAction, TRibbonFontAction, TRibbonColorAction], nil);
   end;

While building and installing such packages works without errors, the Delphi designer throws strange errors when double clicking e.g. on events:

Exception class EModuleError with message 'Cannot find implementation of method CmdListUpdate'. Process bds.exe (14988)

204922a0 +058 coreide220.bpl       Updaters            839   +2 TMethodSymbol.SourcePos
21ce8610 +00c delphicoreide220.bpl PasMgr             8788   +1 TPascalFormUpdater.ShowMethodSymbol
21ce8b8b +013 delphicoreide220.bpl PasMgr             8888   +1 TPascalFormUpdater.ShowMethod
21d014b7 +00b delphicoreide220.bpl DelphiModule       1677   +1 TPascalCodeMgrModHandler.ShowMethod
210d5de1 +005 designide220.bpl     ComponentDesigner  4457   +0 TComponentRoot.ShowMethod
210ae2e4 +158 designide220.bpl     DesignEditors      2106  +21 TMethodProperty.SetValue
210ade95 +0a9 designide220.bpl     DesignEditors      1998  +12 TMethodProperty.Edit
208cef86 +13a coreide220.bpl       PropInsp            902  +18 TPropertyInspector.PropListEditDblClick
21291199 +015 vclide220.bpl        IDEInspListBox      624   +2 TInspListBox.DoEditDblClick
21292a36 +002 vclide220.bpl        IDEInspListBox     1196   +0 TInspListBox.EditDblClick
50683575 +015 vcl220.bpl           Vcl.Controls       7366   +1 TControl.DblClick
506836f0 +034 vcl220.bpl           Vcl.Controls       7409   +4 TControl.WMLButtonDblClk
50682fe9 +2bd vcl220.bpl           Vcl.Controls       7245  +91 TControl.WndProc
50687b91 +5e9 vcl220.bpl           Vcl.Controls      10079 +158 TWinControl.WndProc
212908eb +037 vclide220.bpl        IDEInspListBox      361   +7 TPropInspEdit.WndProc
506871b0 +02c vcl220.bpl           Vcl.Controls       9786   +3 TWinControl.MainWndProc
50172d80 +014 rtl220.bpl           System.Classes    16882   +8 StdWndProc
76af3e4b +00b user32.dll                                        DispatchMessageW
507cb41f +0f3 vcl220.bpl           Vcl.Forms         10352  +23 TApplication.ProcessMessage
507cb462 +00a vcl220.bpl           Vcl.Forms         10382   +1 TApplication.HandleMessage
507cb795 +0c9 vcl220.bpl           Vcl.Forms         10520  +26 TApplication.Run

Seen on XE7 and XE8. Is this something that is supposed to work or am I doing something wrong?

Steps for reproducing the problem:

UIRibbon shrinks when high dpi support is enabled in application settings

The ribbon height and font size shrink when high dpi support is enabled in delphi 10.1 berlin, see following images:

Resolution 1920 x 1080 - high dpi 100% zoom

1920 x1080 - high dpi 100 zoom

Resolution 1920 x 1080 - high dpi 125% zoom

1920 x1080 - high dpi 125 zoom

Resolution 1920 x 1080 - high dpi support off 100% zoom

1920 x 1080 - no high dpi support 100 zoom

Resolution 1920 x 1080 - high dpi support off 125% zoom

1920 x 1080 - no high dpi support 125 zoom

Cheers.

TUICommandColorAnchor.SetColorType corrupts icon

Calling SetcolorType(ctRGB) corrupts the on screen icon.

The lower half of the associated icon disappears.

Also happens when setting the colour (probably because this also calls SetColorType).

Explose Loaded property

May I suggest to expose TUIRibbon's FLoaded as a property? It saves us from using ribbon external loaded state variables all over the place.

ColorPicker not displaying any modifications

I have a drop down color picker in my ribbon XML, configured like this:

  <DropDownColorPicker CommandName="rcmdTEFormatColor" 
                       ColorTemplate="StandardColors" 
                       ChipSize="Large" 
                       IsAutomaticColorButtonVisible="false" 
                       IsNoColorButtonVisible="true" 
                       Columns="8" 
                       StandardColorGridRows="6" />

in the OnCommandCreate event, I attempt to modify the anchor command as follows

procedure TMyForm.OnRibbonCommandCreate(const Sender: TUIRibbon; const Command: TUICommand);
const colorCount = 88;
var cmd:TUICommandColorAnchor;
    i: Integer;
    colors: TArray<TColor>;
    tooltips: TArray<String>;
begin
  if not ((Command.CommandId = myCommandId) and (Command is TUICommandColorAnchor)) then
    exit;

  cmd := Command as TUICommandColorAnchor;

  SetLength(colors, colorCount );
  SetLength(tooltips, colorCount );

  for i := 0 to (colorCount -1) do begin
    colors[i] := clBlue;
    tooltips[i] := 'True Blue';
  end;

  cmd.OnExecute := OnColorPickerExecute;
  cmd.ColorType := ctRgb;
  cmd.Color := clRed;

  cmd.StandardColors := ribbonColors;
  cmd.StandardColorTooltips := ribbonColorTooltips;

  cmd.MoreColorsLabel := 'Add Color';
end;

Yet it does not show any of my colors or tool tips, nor does is show the color I set, it only shows the modified MoreColorsLabel. And the OnColorPickerExecute event handler is being called correctly.

Any ideas, I must be missing something obvious?

Modifiying a TRibbonCollectionAction while the gallery is open will cause it to be cleared completetly

Using TRibbonCollectionAction.Add() or TRibbonCollectionAction.Remove() while the gallery is currently open, will cause the gallery to be cleared by the framework.

image

The official documentation by Microsoft states that
"When the application replaces the gallery collection provided by the framework with a custom collection, the application should implement the
IConnectionPointContainer interface. If IConnectionPointContainer is not implemented, then the application is unable to notify the framework of changes in the custom collection that require dynamic updates to the gallery control" (Source: https://msdn.microsoft.com/en-us/library/windows/desktop/dd742868(v=vs.85).aspx#IUICollectionChangedEvent)

Maybe implementing this interface would solve the problem. However, implementing this interface would be quite a bit of work, for a rather small issue. And I'm not sure if it would be the actual solution...

Unfortunately, it is also not possible to directly determine the state of the gallery (dropped down, or not).

Win10 + D10 Seattle Errors

*\trunk\Samples\High Level\05 Font Control* at Win10 + D10 Seattle Errors
First chance exception at $74D3DAE8. Exception class EOleException with message 'Unspecified error'. Process FontControl.exe (3476)

Ribbon Compiler does not build anything with Windows 7 SDK

Hi,

I recently had to change from my development engine (Windows Server 2012 with Win 8.1 SDK - English) back to a Windows 7 (with Windows 7 SDK - German) engine.
Thereupon I recognized that the ribbon compile process does not generate any file output on my Windows 7 machine. It works flawlessly under Windows 8.1 SDK. Is there a chance to get some debug output from the powershell script?
Compiler is from Delphi 10 Seattle

  • After creating a new project the compile process starts
  • nothing is created except for the .dpr file

image
image

Any ideas?

cheers
Marco

Occasional access violation in TUICommandCollection.Destroy() at program termination

There are unfortunately no deterministic steps for reproducing this AV. Any ideas are welcome.

exception class    : EAccessViolation
exception message  : Access violation at address 0000000000418648 in module 'Tests.exe'. Read of address 00000000417128B8.

main thread ($3d4):
00418648 Tests.exe    System                      36030   +6 @IntfClear
01b54b5b Tests.exe    UIRibbonCommands             3744   +4 TUICollection.Destroy
0040e985 Tests.exe    System                      15718   +5 TObject.Free
01b4fef8 Tests.exe    UIRibbonCommands             2270   +1 TUICommandCollection.Destroy
0040e985 Tests.exe    System                      15718   +5 TObject.Free
01b86776 Tests.exe    UIRibbon                     2261   +3 {System.Generics.Collections}TObjectDictionary<System.Cardinal,UIRibbonCommands.TUICommand>.ValueNotify
01b8573b Tests.exe    UIRibbon                     1950  +12 {System.Generics.Collections}TDictionary<System.Cardinal,UIRibbonCommands.TUICommand>.Clear
01b85491 Tests.exe    UIRibbon                     1831   +1 {System.Generics.Collections}TDictionary<System.Cardinal,UIRibbonCommands.TUICommand>.Destroy
0040e985 Tests.exe    System                      15718   +5 TObject.Free
00494711 Tests.exe    System.SysUtils             25149   +3 FreeAndNil
01b7b952 Tests.exe    UIRibbon                      634   +3 TUIRibbon.Destroy
006c3d4d Tests.exe    Vcl.Controls                 8390  +23 TWinControl.Destroy
0087e4fe Tests.exe    Vcl.Forms                    3060   +3 TScrollingWinControl.Destroy
00880212 Tests.exe    Vcl.Forms                    3732  +33 TCustomForm.Destroy
0040e985 Tests.exe    System                      15718   +5 TObject.Free
00888294 Tests.exe    Vcl.Forms                    6818   +1 TCustomForm.CMRelease
0040f0ae Tests.exe    System                      16489  +10 TObject.Dispatch
006c0e43 Tests.exe    Vcl.Controls                 7232  +91 TControl.WndProc
006c8457 Tests.exe    Vcl.Controls                10038 +153 TWinControl.WndProc
00881e19 Tests.exe    Vcl.Forms                    4427 +206 TCustomForm.WndProc
006c767a Tests.exe    Vcl.Controls                 9750   +3 TWinControl.MainWndProc
005ef1b3 Tests.exe    System.Classes              16617   +8 StdWndProc

App crashes on Windows 7

Any idea why my app might crash in the resource loading step of the ribbon with "There was a problem loading resource APPLICATION" when started on Windows 7 (ultimate)? Does Windows 7 have any prerequisites that have to be met? My ribbon is rather complex, the resource file is about 10MB, all images are 32 bit bitmaps, not PNG.

TUIRibbon.LoadSettings and SaveSettings leak TStreamAdapter

The current implementation leaks the TStreamAdaptor:

function TUIRibbon.SaveSettings(const Stream: TStream): Boolean;
var
  ComStream: IStream;
begin
  Result := Assigned(FRibbon);
  if (Result) and fLoaded then
  begin
    ComStream := TStreamAdapter.Create(Stream, soReference);
    Result := Succeeded(FRibbon.SaveSettingsToStream(ComStream));
  end;
end;

I suggest to change it to something like this

function TUIRibbon.SaveSettings(const Stream: TStream): Boolean;
var
  ComStream: TStreamAdapter;
begin
  Result := Assigned(FRibbon);
  if (Result) and fLoaded then
  begin
    ComStream := TStreamAdapter.Create(Stream, soReference);
    try
        Result := Succeeded(FRibbon.SaveSettingsToStream(ComStream));
    finally
        ComStream.Free;
    end;
  end;
end;

Same for the LoadSettings() method.

Building the ribbon files is slower than in V1.0

Building the ribbon files in the Designer is significantly slower than in V1.0, as reported by @gabr42

Most of the time is consumed inside the foreach-loop of the Powershell script. Ideas to improve performance:

  • Split string instead of using regex
  • Assemble output file content in memory instead of appending each line to the file

Sample projects with actions don't respond to mouse clicks

Project: "TextPad" In High Level folder
Ribbon does not respond to mouse clicks.
Delphi XE8
The OnCommandCreate event (TFormMain.RibbonCommandCreate in the project) is never fired. Stepping through the code I noticed in unit UIRibbon in procedure TUIRibbon.DoCommandCreated the line

if not Assigned(Self.RibbonMapper) or not Self.RibbonMapper.TryGetItem(pCommand.CommandId, lMarkupItem) then // Get the corresponding TAction for the given Ribbon command
exit;

always exits because RibbonMapper is always nil. It appears that this event must fire to be able to link the ribbon to the Delphi actions.

Support dynamically changing images

I'm not quite sure why, but it seems really difficult to change images for a command. First, the SmallImage, LargeImage properties are nil unless NO image is assigned to the command. If you assign an image at design time, these member are nil.

Also, the TUICommand.OnUpdateImage event is utterly confusing (and I think really not working). How is one supposed to update the image using this callback? There's now way to pass a new image out of it, is there? What's NewValue supposed to contain? There might be a good reason but it's a little difficult to understand.

What I would like to do is proactively set images like I change action captions which Just Works(tm).

I've experimented a little and it seems I can just make the Small/Large/Image properties writable with a setter like this:

procedure TUICommand.SetSmallImage(const Value: TUIImage);
begin
  if (FSmallImage <> Value) then begin
    FSmallImage.Free;
    FSmallImage := Value;

    FFramework.InvalidateUICommand(FCommandId, [UIInvalidationsProperty], @UI_PKEY_SmallImage);
  end;
end;

When I want to change the image I just load a new TUIImage and set it. Of course this should be much more streamlined and abstracted but it works just like I wanted.

Is there a reason why images are not writable?

Recent Items - Random access violation on child form close

Hi,

I have an MDI form with a number of MDI child. I want to the file name associated with the child form before the form is closed. I put the code to add the recent item in the child form OnCloseQuery event handler. I am getting random access violation and memory leaks either when closing the main form or any of the child forms. I pinned down the problem to FRecentItems field that was nil when calling AddtorecentItems TUIRibbon method.

For the time being I wrapped the AddtorecentItems call in a try except block.

Any ideas how can I fix this problem.

Many thanks.
app-accessviolation-on formclose query
app-memory leaks

Change to AddToRecentItems for application consistency

I made this change to give the same operation as other applications.

Currently the recent items list displays the full path to the items, which usually means the actual filename is cut off. Not a very useful if you can't see the name.

This extracts the filename for the lable text and puts the full path into the description, it displays as a tooltip when hovered over.

`procedure TUIRibbon.AddToRecentItems(const pPath: string);
var lItem: TUIRecentItem;
begin
lItem := TUIRecentItem.Create;
lItem.LabelText := ExtractFilename(pPath);
litem.Description:=pPath;

fRecentItems.Items.Add(lItem);
end;
`

The RecentItems execute action should be changed to use the description field rather than the labeltext....eg

Openfile(UIRibbon1.GetSelectedRecentItem.Description)

Move/copy License file to root directory

Would you be able to move/copy the license file from Doc/License.txt to the root directory?

From what I've seen elsewhere, that's the standard place to put it (and where GitHub recommends) so putting it in a well known place means people don't need to search too hard to find out if your library can be used commercially.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.