No Activation Event fired when clicking through open images
Hi there,
with several images open, I want to track which one is currently the active image. But McApplication.SelectedDataChanged only fires on deactivating an image (Flags parameter is always 255). The same happens with the McImage-Events. The Activate-Event doesn't fire, only the Deactivate-Event.
I want to automatically run code on the active image once the user has clicked into another image.
Thank you.
Regards,
Helga
with several images open, I want to track which one is currently the active image. But McApplication.SelectedDataChanged only fires on deactivating an image (Flags parameter is always 255). The same happens with the McImage-Events. The Activate-Event doesn't fire, only the Deactivate-Event.
Private Sub _application_SelectedDataChanged(Flags As MediaCy.IQL.Application.IMcData.DataTypes) Handles _application.SelectedDataChanged ' ONLY FIRES WHEN LEAVING AN IMAGE myImg = _application.ActiveImage Debug.Print(myImg.Name) End Sub Private Sub myImg_Deactivate(Image As McImage) Handles myImg.Deactivate 'FIRES ON LEAVING THE IMAGE Debug.Print(myImg.Name) End Sub Private Sub myImg_Activate(Image As McImage) Handles myImg.Activate 'NEVER FIRES Debug.Print(myImg.Name) End SubCan anyone direct me how to solve the problem.
I want to automatically run code on the active image once the user has clicked into another image.
Thank you.
Regards,
Helga
Tagged:
0
Best Answer
-
Hi Helga,
The myImg.Activate event is not fired, because myImg is set to the old image at that time.
You can also use McWindows.Activating event (from ThisApplication.Windows) http://projects.mediacy.com/help/html/Events_T_MediaCy_IQL_Application_McWindows.htm
You can get McImage from McWindow using Window.Document.Data property.
Yuri0
Answers
-
Thanks Yuri,the Windows events work perfectly for my purpose.I was misled by the sample addin code (PremierAddin3.zip) which suggests that the _application.SelectedDataChanged event reflects the image that is the ActiveImage. In reality, what is meant to be the active image is actually the image that was the active image!But still, I'm glad I know better now.Best regards,Helga
''' <summary> ''' Handles document activation in the application. ''' </summary> ''' <param name="Flags"></param> ''' <remarks></remarks> Private Sub _application_SelectedDataChanged(Flags As MediaCy.IQL.Application.IMcData.DataTypes) Handles _application.SelectedDataChanged ' Sample code to display active document If _application.ActiveDocument Is Nothing Then Me.Label1.Text = "Active Document is Nothing" Else Me.Label1.Text = "Active Document is " & _application.ActiveDocument.DisplayName End If End Sub
0
Categories
- All Categories
- 961 Image-Pro v9 and higher
- 9 Image-Pro FAQs
- 18 Image-Pro Download & Install
- 448 Image-Pro General Discussions
- 486 Image-Pro Automation (Macros, Apps, Reports)
- 20 AutoQuant Deconvolution
- 2 AutoQuant Download & Install
- 18 AutoQuant General Discussions
- 195 Image-Pro Plus v7 and lower
- 3 Image-Pro Plus Download & Install
- 106 Image-Pro Plus General Discussions
- 86 Image-Pro Plus Automation with Macros
- 19 Legacy Products
- 16 Image-Pro Premier 3D General Discussions
- 26 Image-Pro Insight General Discussions