TadxRibbonControlType

Add-in Express™ Support Service
That's what is more important than anything else

TadxRibbonControlType
 
Andrei Jugovic




Posts: 59
Joined: 2007-02-08
Hi!

I am just trying to ad some RibbonControl to an RibbonTab at runtime.


newButton := myRibbonTab.Controls.Add(*ControlType*).AsRibbonButton;
newButton.Caption := 'My Runtime Button';


I think this would work, but the Add methode requires a parameter of the Type TadxRibbonControlType. I was not able to find any information about that type.

Your documentation gives a very good overview about the general functionality of ADX but I was not able to find any detail information (like the definition of TadxRibbonControlType). Do you have such a documentation of all ADX classes, methodes, parameters and types?

Thanks
Andrei
Posted 20 Apr, 2007 09:16:46 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Andrei,

Please see the definition of the TadxRibbonControlType type below:

[B]type[/B]
  TadxRibbonControlType = (
    rctCommand, rctTab, rctQAT, rctOfficeMenu,
    rctGroup, rctBox, rctButtonGroup,
    rctButton, rctSplitButton, rctLabel, rctCheckBox, rctEditBox, rctComboBox, rctDropDown,
    rctGallery, rctMenu, rctSeparator, rctMenuSeparator, rctDialogBoxLauncher, rctItem);


P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 20 Apr, 2007 12:20:40 Top
Andrei Jugovic




Posts: 59
Joined: 2007-02-08
Hi!

Is there any source (doc, online help, etc.) where I could have found out about that my selfe?

Andrei
Posted 23 Apr, 2007 03:06:11 Top
Andrei Jugovic




Posts: 59
Joined: 2007-02-08
I have just tried to add some Control to a RibbonTab at runtime. Although the code compiles without any errors and the outlook reports no error as well the new controls are not shown an the RibbonTab:

I have placed a TadxRibbonTab on the AddIn Designer and added a TadxRibbon Group with a RibbonButton.

The following code is used to add a Button on runtime:


...
var ribbonGroup: TadxRibbonGroup;
    ribbonButton1: TadxRibbonButton;
    ribbonButton2: TadxRibbonButton;
begin
    ribbonGroup   := adxRibbonTab1.Controls[0].AsRibbonGroup;
    ribbonButton1 := ribbonGroup.Controls[0].AsRibbonButton;
 
    ribbonButton2 := ribbonGroup.Controls.Add(rctButton).AsRibbonButton;
    
    ribbonButton1.Caption := 'test1';
    ribbonButton2.Caption := 'test2';
end;
...


While the Caption of the first Button (added at designtime) is changed to test1 the second Button is not shown. Any Idea what is wrong with this exemple?

Thanks
Andrei
Posted 23 Apr, 2007 05:34:05 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Andrei,

Any Idea what is wrong with this example?


From your code above, it's not quite clear in what event handler this code is executed. Please specify.


Posted 23 Apr, 2007 06:25:29 Top
Andrei Jugovic




Posts: 59
Joined: 2007-02-08
From your code above, it's not quite clear in what event handler this code is executed. Please specify.


The code is used in adxCOMAddInModuleCreate
Posted 23 Apr, 2007 08:51:32 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Andrei,

Try to set the Id property of your button:


  ribbonButton2 := ribbonGroup.Controls.Add(rctButton).AsRibbonButton;
  [B]ribbonButton2.Id := 'MY_UNIQUE_ID';[/B]


Also, I'd recommend using the OnRibbonBeforeCreate event handler instead of OnCreate.


Posted 23 Apr, 2007 10:01:01 Top
Andrei Jugovic




Posts: 59
Joined: 2007-02-08
ribbonButton2 := ribbonGroup.Controls.Add(rctButton).AsRibbonButton;
ribbonButton2.Id := 'MY_UNIQUE_ID';


Thank you very much. This work. But I have encounterd a new very strange problem:

Same as before:
I have placed a TadxRibbonTab on the AddIn Designer and added a TadxRibbon Group with a RibbonSplitButton.


...
var ribbonMenu: TadxRibbonButton;
    newCatMenu: TadxRibbonMenu;
begin
    ribbonMenu  := adxRibbonTab1.Controls[0].AsRibbonGroup.Controls[0].AsRibbonSplitButton.Controls[0].AsRibbonMenu;
  
  // 1  
  newCatMenu         := ribbonMenu.Controls.Add(rctMenu).AsRibbonMenu;
  newCatMenu.Caption := 'Test0';
  newCatMenu.Id      := 'a648519c9f51a133606fe5bf3fcd3d5e';

  // 2
  newCatMenu         := ribbonMenu.Controls.Add(rctMenu).AsRibbonMenu;
  newCatMenu.Caption := 'Test1';
  newCatMenu.Id      := '4351727b3c4171b28875121f7e91f103';}

  // 3
  newCatMenu         := ribbonMenu.Controls.Add(rctMenu).AsRibbonMenu;
  newCatMenu.Caption := 'Test2';
  newCatMenu.Id      := 'a648519c9f51a133606fe5bf3fcd1111';
end;
... 


This Code is used in OnAddInInitilize.

When I use the code as shown above the RibbonTab is not shown in Outlook. If I use the code without Menu 2 the Tab is shown.

The only difference between the menus are the IDs. So what is the problem with the ID of Menu 2?

You can the problem very clearly if you add just one of the menus. Menus 1 and 3 work fine while the RibbonTab is not shown in Outlook when Menu2 is used... Change the ID of Menu 2 to the ID of Menu 1 or 3 (than there is no more difference) Menu 2 works fine as well...

Changing the name of a menu does not have any influence.

Do you what exactly is the problem? Any Idea, any solution?

Thanks
Andrei
Posted 24 Apr, 2007 12:19:23 Top
Andrei Jugovic




Posts: 59
Joined: 2007-02-08
Hi!

I have just created a TestAddIn for a better understanding of the problem. You can download the source http://aqserver.i24.cc/TestAddIn.rar.

It is a simple Outlook AddIn with a RibbonTab/RibbonGroup/RibbonSplitButton. This is the adxCOMAddInModuleAddInInitialize methode:


procedure TAddInModule.adxCOMAddInModuleAddInInitialize(Sender: TObject);
var myMenu : TadxRibbonMenu;
    newMenu: TadxRibbonMenu;

begin
  // When compiling the AddIn with Menu 2a the RibbonTab is not shown in
  // Oultook 2007. Doing the same with Menu 2b instead of Menu 2a results
  // in no problems. The RibbonTab and the Menu are shown in Outlook.
  // The only difference between Menu 2a and 2b is the ID. What is the
  // problem with the ID of Menu 2a? Are there any known constraints for
  // a valid ID?

  myMenu := adxRibbonTab1.Controls[0].AsRibbonGroup.Controls[0].AsRibbonSplitButton.Controls[0].AsRibbonMenu;

  // Insert Menu 1
  newMenu         := myMenu.Controls.Add(rctMenu).AsRibbonMenu;
  newMenu.Caption := 'Test0';
  newMenu.Id      := 'a648519c9f51a133606fe5bf3fcd3d5e';

  // Insert Menu 2a
  newMenu         := myMenu.Controls.Add(rctMenu).AsRibbonMenu;
  newMenu.Caption := 'Test1';
  newMenu.Id      := '4351727b3c4171b28875121f7e91f103';

  // Insert Menu 2b
  {newMenu         := myMenu.Controls.Add(rctMenu).AsRibbonMenu;
  newMenu.Caption := 'Test1';
  newMenu.Id      := 'a648519c9f51a133606fe5bf3fcd1112';}

  // Insert Menu 3
  newMenu         := myMenu.Controls.Add(rctMenu).AsRibbonMenu;
  newMenu.Caption := 'Test2';
  newMenu.Id      := 'a648519c9f51a133606fe5bf3fcd1111';
end;


Please download the TestAddIn and have a look at it. Any suggestions?

Thanks
Andrei
Posted 25 Apr, 2007 04:31:26 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Andrei,

The Id property cannot start from number.

Please check on the Tools -> Options -> Other tab -> Advanced Options -> Show add-in user interface errors check box in your Outlook 2007.

Posted 25 Apr, 2007 05:01:02 Top