01-29-2021 08:19 AM
Hi everybody,
I'm quite new to DIAdem but I've been discovering the power of this tool in the past weeks. For now, I'm only using VIEW and a lot of scripts.
I have a layout with 3 areas : 2 for graphics and one for a SUD with the ViewConnector object.
I have no problem managing events from my SUD but I still use VIEW built-in features such as Band Zoom and I'd like to detect that the user zooms on a graphic because I want my 2 graphs to have the same X-axis scale at all time. I know which properties I need to monitor in order to detect when the user zooms but I just can't find a way to trigger an event.
The ViewConnector Event_ActiveAreaChanged in my SUD is good for some functionalities but I need to create a custom event for the Band Zoom.
I don't think that my SUD has to be involved in all that but I just can't figure out how to run a monitoring script in VIEW that runs permanently to detect if the user uses the zoom. I thought about running a script in Windows background outside of DIAdem and use the TOCommand object with the method: CmdExecuteSync to read the running DIAdem instance properties. As far as I know, this method do not recognize anything object oriented such as the 2 properties I need to detect the Band Zoom utilisation on my first graph :
View.Sheets("Sheet1").Areas("GraphArea1").DisplayObj.XBegin
View.Sheets("Sheet1").Areas("GraphArea1").DisplayObj.XEnd
I could do all the zoomings from the SUD instead but I would really prefer to keep all the VIEW built-in features and trigger some event in background to accomodate my preferences.
Thank you for your help!
02-01-2021 07:40 AM
I'm sorry again about the triple post of my topic, it was not intentional.
Any suggestion or workaround to fix my problem? Thanks.
02-01-2021 02:16 PM - edited 02-01-2021 02:20 PM
God, I lost so much time because I misinterpreted the word "variant". I thought the methods ending with VarGet of TOCommand object could only get global variables and never thought about checking the help for VariantVarGet which gives me the VIEW object and then I can access all I need from my external script in the end.
If the method was called ObjectVarGet, I wouldn't even have come here to ask 😚. Thanks anyways, but I would have appreciated someone to tell me to read the frickin' manual again!
02-04-2021 05:23 PM
Hi AlexDarsigny,
Typically when you want your custom code to fire based on an event in DIAdem, you register your custom code as a UserCommand, and then you reference your custom code (by name) in the Events collection of the respective panel object-- in this case...
View.Events.OnCursorChanged = "UserCommandFunctionName"
Or if you want to allow multiple callbacks per event, you can use:
Call AddUserCommandToEvent("View.Events.OnCursorChanged","UserCommandFunctionName")
Brad Turpin
Principal Technical Support Engineer
NI