Davide Crudo
Posts: 23
Joined: 2005-05-09
|
I have put a commandbar Object in my project and added two components under it (A button and a Listbox).
The issues I have are the following:
1) How can I clear the Listbox when Opening Excel?
(it contains old data) I've tried with OnAddInInitialize but the
following command doesn't work:
adxCB.Controls[1].AsDropdownList.items.clear;
2) After pushing a button that will populate the Lisbox, I cannot
visualize the first item automatically with the command:
adxCB.Controls[1].AsDropdownList.itemindex := 0;
...and I would like to show some caption, like [Choose your Item] from
the list.
Thank you in advance for pointing me where to find more infos on this subject!
Dave |
|
Dmitry Kostochko
Add-in Express team
Posts: 2880
Joined: 2004-04-05
|
Hi Davide,
1) Try to use the OnAddInStartupComplete event instead of OnAddInInitialize. In the OnAddInStartupComplete event all controls are already connected. Also use the code below:
adxCB.Controls[1].AsDropdownList.Clear;
2) adxCB.Controls[1].AsDropdownList.ListIndex := 1;
As for caption: set the Style property to the adxMsoComboLabel and set the Caption property.
|
|
Davide Crudo
Posts: 23
Joined: 2005-05-09
|
Hello,
Adding the following line to the procedure "TAddInModule.adxCBControls0Click(Sender: TObject);"
adxCB.Controls[1].AsDropdownList.itemindex := 0;
Generates the following Error:
A_Retrieve error: the add-in has fired an exception.
Invalid index
Only after registering the Plug-in. Reopening excel doesn't do the same...but the result is that the toolbar cannot be docked.
|
|
Dmitry Kostochko
Add-in Express team
Posts: 2880
Joined: 2004-04-05
|
Hi Davide,
Try the code below:
adxCB.Controls[1].AsDropdownList.ListIndex := 1;
|
|