Steve Faleiro
Posts: 15
Joined: 2024-09-12
|
I want to add items to a ribbon gallery control after the add-in has loaded. I will be loading these items from a database table.
This is the code I have:
var
grp: TadxRibbonGroup;
gly: TadxRibbonGallery;
ctl: TadxRibbonCustomControl;
begin
grp := adxRibbonTab1.Controls[0] as TadxRibbonGroup;
gly := TadxRibbonGallery(grp.Controls[0]);
ctl := gly.Items.Add(rctButton);
if (ctl <> nil) then
TadxRibbonButton(ctl).Caption := 'template 1';
I'm calling this code once in adxCOMAddInModuleRibbonLoaded event, and want to be able to call it whenever the user chooses. After this code runs, I cannot see any item has been added to the gallery control. So, how to add items?
What is interesting is that on this line:
if (ctl <> nil) then
ctl is nil.
I can't find any forum post or documentation regarding this and I'm surprised that nobody had this same requirement before. Is it that we cannot add items to the gallery control at runtime? If No, then what other control can be used, and how? Basically I need a menu list of items, preferably with images that can be of a custom size just like the ribbon gallery control's items, and I need to be able to update it at runtime. |
|
Dmitry Kostochko
Add-in Express team
Posts: 2887
Joined: 2004-04-05
|
Hello Steve,
I would suggest that you try the TadxRibbonMenu control instead of TadxRibbonGallery. Please have a look at the following thread, this issue was discussed there:
https://www.add-in-express.com/forum/read.php?FID=1&TID=12689
If you have any questions or need more information, feel free to ask. |
|