DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a Cursor Change Event in DIAdem?

Solved!
Go to solution

Hi all,

 

I am quite new to scripting in DIAdem, so am not so sure of what it is capable of (I am primarily a LabVIEW developer).

 

For the application I have in mind we are going to have multiple video files that have been captured over time. We would like the user to scroll through a 2D channel display and automatically load (and synchronise) the video to the data.

 

I cannot see any way for a script to get the position of the cursor as the user changes it. Is there some form of event published on cursor position change or can I poll the position of a cursor while the user is changing it?

 

Also, while a script is running is it possible for the user to continue with their actions as normal? i.e. interact with graphs etc?

 

Kind regards

Neil

0 Kudos
Message 1 of 7
(4,683 Views)
Solution
Accepted by Neil.Pate

Hi Neil,

 

There is a cursor move event in VIEW that you can customize.  The user can not operate DIAdem while the event script is executing, but he can operate DIAdem normally between cursor moves.  I'm attaching an example that shows how to attach your customer script (as a UserCommand) to the VIEW cursor move event.  It's a little complicated, so feel free to ask clarifying questions.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 2 of 7
(4,673 Views)

Thanks Brad,

 

I have run the State Range.VBS script, and it runs through to completion (and seems to work in regards to the VIEW and data). From that point onwards when I move the cursor I get the StatRangeEvent triggered, this is exactly what I am looking for.

 

Something is not quite right in that the Event does not seem to be processing correctly, but for the purposes of what I am trying to do it is probably good enough.

 

The breakpoints do not seem to work on the event function that is called, is this expected (because I suppose I am not actually running that in debug mode)?

 

Many thanks!

0 Kudos
Message 3 of 7
(4,667 Views)

Hi Neil,

 

Correct, the event script never runs in the debugging VBScript host.  You might try LogFileWrite() to document state information about the script's variables.  This outputs lines of text to the DIAdem log file, which you can view at the bottom of the SCRIPT panel.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 4 of 7
(4,645 Views)

Thanks Brad, I am using that method for debugging.

 

At the moment I am struggling to understand the method of interacting with the objects in a VIEW by using their name. For example I have preconfigured my view, say I have an video item called Cam1, I cannot figure out how to access that object by name. I would like to do something like View.ActiveSheet.Area("Cam1") but that does not work. I am probably missing something very simple. I have scanned quickly through the DIAdem Advanced training material, but have not found what I am looking for.

 

 

 

 

0 Kudos
Message 5 of 7
(4,632 Views)

Hi Neil,

 

If you have DIAdem 2015 or later, you can simply right-click on any VIEW Area and select the context menu "Rename Area..." in order to assign each Area a name of your choosing.  Then you just need to resave your TDV file, after which the method you attempted (with Areas instead of Area) will work just fine:

 

Set VideoArea = View.ActiveSheet.Areas("Cam1")

In earlier versions of DIAdem, you have to assign the VIEW Area names programmatically.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 6 of 7
(4,618 Views)

Perfect, that is just what I needed so now I can acces my areas by name. Smiley Very Happy

 

0 Kudos
Message 7 of 7
(4,612 Views)