In an effort to clean up some code that makes heavy use of globals to store the state of GUI checkboxes, I've started taking advantage of value =_NUM:num and ControlInfo. One short fall of this is that I can't seem to find as easy way to directly access the state of checkboxes from XOPs. Before I could do this by simply reading the global associated with the state. Currently I'm still having to store the states in a separate wave which is then accessed by the XOP. This removes some of the connivence of using _NUM:num etc. Is it possible to directly access the parameters associated with setVariable and checkboxes from an XOP?
There is no direct way to do this. Normally XOPs are not intimately involved with user interface. Instead a call to an external function or operation would pass a parameter which might derive from a checkbox state.
If that does not work in your situation I can see two ways to achieve what you want:
1. Have the checkbox action procedure call the XOP to inform it of the checkbox state each time the state changes.
2. Write an external function that calls a user-defined function using the CallFunction XOPSupport routine. The user-defined function will call ControlInfo and return the value of V_value. The XOP gets the user-defined function result from CallFunction.
That makes sense. I realise what I have here is a bit of an edge case. To give a bit of background on the problem, this is in relation to a control panel for a confocal laser microscope. The panel lets the user set the scan size and the pixel resolution of the image etc.. these parameters are then handed off to an XOP which interfaces with a card that controls the piezo scanning stage of the microscope. Currently the image parameters are read from their controls with ControlInfo and then passed as arguments to the XOP function. I was hoping to eliminate the ControlInfo calls and read these parameters directly from the GUI, but it looks like it might just be easier to leave it the way it currently is.
Yeah- I think it's best to leave the GUI management inside Igor procedures, and just use the XOP as an engine to access the instrument. That's how NIDAQ Tools MX does it.
If that does not work in your situation I can see two ways to achieve what you want:
1. Have the checkbox action procedure call the XOP to inform it of the checkbox state each time the state changes.
2. Write an external function that calls a user-defined function using the CallFunction XOPSupport routine. The user-defined function will call ControlInfo and return the value of V_value. The XOP gets the user-defined function result from CallFunction.
November 22, 2014 at 02:55 pm - Permalink
November 23, 2014 at 08:13 am - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
November 26, 2014 at 09:32 am - Permalink