Creating and deleting buttons programmatically

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

Creating and deleting buttons programmatically
 
Guest


Guest


I can't seem to find this information. I was able to do it OK in version 1 VCL edition but not in version 2.

Would you please provide examples of creating and deleting commandbar buttons programmatically. In particular, I also need to specify the order in which they appear on the commandbar. Thanks.

Regards

Mike
Posted 16 Aug, 2004 20:24:37 Top
Eugene Starostin


ADX Team
Add-in Express team


Posts: 430
Joined: 2004-04-05
Hi,

I suppose we should add a link to our HOWTOs to all forum pages. ;)

Look at HOWTOs:
11. How to create a command bar and command bar controls at run time (for Excel).
12. How to create a command bar and command bar controls at run time (for Outlook).
Posted 17 Aug, 2004 02:38:27 Top
Guest


Guest


Hi Eugene

Thanks for the quick answer.

No point in adding the link to the HowTos unless it contains the answer ;)

Where in the example does it show how to delete the button programmatically, and where does it show how to specify where the button appears in the CommandBar, i.e. set the order in which the buttons appear?

Have I missed something? Thanks.

BTW, from the web site, the HowTos link kept sending me to the version 1 HowTos, not version 2's.

Regards

Mike
Posted 17 Aug, 2004 03:53:42 Top
Dmitry Kostochko


Add-in Express team


Posts: 2731
Joined: 2004-04-05
Hi Mike,

The HOWTOS #11 shows how to create command bars and their controls programmatically for ADX 2. This website contains info about Add-in Express 2 only.
Could you please point me where have you found a link to V1.

You can find the HowTo on this page: Delphi Outlook How-Tos

Look at the adxCOMAddInModuleAddInInitialize event handler. I think it is that you need.

Sincerely,
ADX Support Team.
Posted 17 Aug, 2004 04:17:06 Top
Guest


Guest


Hi Dmitry

I've been going to http://www.afalinasoft.com/ and not http://www.add-in-express.com for the HowTos ... so that one is explained ... sorry.

In my application I need to delete/create buttons on the command bar programmatically based upon a combobox selection. None of the HowTos seem to describe this.

I have found CommandBar.Controls.DeleteControl(Index, Temporary) but don't know what Index is. I think it is OfficeIndex. I used OfficeIndex but it always seemed to delete one more button than it should ... the correct button and a button created at design time. It keeps deleting an extra design-time button each time I make a combobox selection.

If, for example, I need to delete 3 buttons, the code calls DeleteControl 3 times but deletes 4 buttons.

I've checked the code quite thoroughly so I'm hoping that either DeleteControl is wrong, or Index is not OfficeIndex.

Regards

Mike
Posted 17 Aug, 2004 05:41:37 Top
Dmitry Kostochko


Add-in Express team


Posts: 2731
Joined: 2004-04-05
Mike,

Index in not OfficeIndex, it is a standard Delphi Index property (TCollectionItem.Index).

Sincerely,
ADX Support Team.
Posted 17 Aug, 2004 05:58:12 Top
Guest


Guest


Hi Guys

Yep ... Index is not OfficeIndex ... I've worked it out and everything works great! Thanks for your help.

Regards

Mike
Posted 17 Aug, 2004 05:59:16 Top