Sergey Chizh
Posts: 73
Joined: 2012-10-23
|
Hi.
ADX version: 9.2.4635
Quite for a long time we have an issue in Excel AddIn. Actually this AddIn is used for all Office apps, but behaves in different way (unfortunately)
So, let's say user opens two documents in Excel. Depending on the document, the Button in AddIn changes its title to X or Y. In fact, ALL Excel windows get the latest button caption. Please watch the video https://www.screencast.com/t/9f8QhxLM2S5H.
In Word we have correct behavior https://www.screencast.com/t/7I2ikDCTGJCp
For both, Excel and Word, we send message from adxExcelEvents.WindowActivate or adxWordEvents.WindowActivate and change the button in OnSendMessage event handler based on ExcelApp.ActiveWorkbook or WordApp.ActiveDocument properties.
Do you have any idea what I am doing wrong? What else might be useful for investigation?
Thank you! |
|
Andrei Smolin
Add-in Express team
Posts: 18793
Joined: 2006-05-11
|
Hello Sergey,
You need to rewrite that mechanism so that it uses the PropertyChanging event of the Ribbon control which is shown differently in different windows. Check section Updating Ribbon Controls at Run Time, see the PDF file in the folder {Add-in Express}\Docs on your development PC.
Andrei Smolin
Add-in Express Team Leader |
|
Sergey Chizh
Posts: 73
Joined: 2012-10-23
|
Hi Andrei,
Thank you! We will try that! |
|
Sergey Chizh
Posts: 73
Joined: 2012-10-23
|
Hi Andrei,
Buttons are updated correctly at Run Time in case of clicking ribbon panel of Excel workbook, but in case of activating any cell, same icons are shown for all workbooks:
https://www.screencast.com/t/Ix5MDhc8XAUb
We added PropertyChanging event on these 3 buttons and trying to have different values for Visible property according to the path of the active workbook ( SourcePath = IO.Path.Combine(ExcelApp.ActiveWorkbook.Path, ExcelApp.ActiveWorkbook.Name)):
https://www.screencast.com/t/agUKVQKk1
What can be helpful in this part?
Thank you |
|
Andrei Smolin
Add-in Express team
Posts: 18793
Joined: 2006-05-11
|
Hello Sergey,
Sergey Chizh writes:
ExcelApp.ActiveWorkbook.Path, ExcelApp.ActiveWorkbook.Name
This isn't correct. You should find the workbook in which the control is being drawn: see e.Context described in section "Determining a ribbon control's context" at https://www.add-in-express.com/docs/net-ribbon-components.php#context.
Andrei Smolin
Add-in Express Team Leader |
|