|
Martin Mach
Posts: 3
Joined: 2007-02-19
|
Hej,
I have created a command bar with a menu. I would like to show/hide some entries in the menu according to specific document properties.
So I have created a handler on open document where I try to set up UI. It works fine when I open a document using a File->Open, but when I open a document programatically from the AddIn, I get: Ole error 800A01A8
It is on word 2003.
Thanks for any tip |
|
Posted 19 Feb, 2007 12:04:41
|
|
Top
|
|
Dmitry Kostochko
Add-in Express team
Posts: 2880
Joined: 2004-04-05
|
Hi Martin,
I would suggest using the OnWindowActivate event for changing your controls:
procedure TAddInModule.adxCOMAddInModuleAddInInitialize(Sender: TObject);
begin
if Self.HostType = ohaWord then begin
WordApp.OnWindowActivate := DoWindowActivate;
end;
end;
procedure TAddInModule.DoWindowActivate(ASender: TObject; const Doc: WordDocument; const Wn: Window);
begin
// TODO
end;
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 Feb, 2007 05:55:41
|
|
Top
|
|
Martin Mach
Posts: 3
Joined: 2007-02-19
|
Hej, thanks for the answer, but still no luck :-( What I basically try to do is:
procedure TAddInModule.DoWindowActivate(ASender: TObject; const Doc: WordDocument; const Wn: Window);
begin
adxCommandBar1.Controls[5].AsPopup.Controls[0].Visible := false;
end;
I can change visibility of buttons in the command bar, but when I try it with popup menu item it fails.
P.S. I forgot to mention it is with add in express 2.7 |
|
Posted 21 Feb, 2007 02:56:35
|
|
Top
|
|
Dmitry Kostochko
Add-in Express team
Posts: 2880
Joined: 2004-04-05
|
Hi Martin,
Could you please send me your project (or some test project with the same behavior) for testing? I will try to help.
|
|
Posted 21 Feb, 2007 03:09:04
|
|
Top
|
|
Martin Mach
Posts: 3
Joined: 2007-02-19
|
Hej,
sorry for a late answer, the work may be somewhat too overwhelming sometimes. I have found a workaround for the mentioned problem, in my project I was setting visibility for both command bar buttons and pop up menu entries. If I set visibility of buttons before menu, then I get a crash. If I change the menu items before buttons, it works fine. Strange but works :)
If you are still itnerested in source codes I can try to create a simplified version again.
|
|
Posted 02 Mar, 2007 04:33:58
|
|
Top
|
|
Dmitry Kostochko
Add-in Express team
Posts: 2880
Joined: 2004-04-05
|
Hi Martin,
Sure, I am interested. Please send me the test project. Thank you in advance.
|
|
Posted 04 Mar, 2007 09:14:10
|
|
Top
|
|