Recommended Posts

I would like to ask the user for an input with a Variable Value Component and have it span several channels. I have am using the Action Set To and my Action Channel is Channel.*ChannelName1*.timing. I want this to go to another channel (ex: Channel.*ChannelName2*.timing) as well, but putting this in Action Channel doesn't update the second channel. I try to separate the Action Channel's by a simple space, a comma, a period, and a semicolon. Notta. If I add another action Set To, it asks the user for a second input. I cannot allow this.

How can I ask thee user for one input and have it span multiple channels?

Share this post


Link to post
Share on other sites

Two ways: if you always want the input from one to go to a second channel, just use the event of the first channel.  So say you have ChannelA and ChannelB.  In the event for ChannelA put:

ChannelB = ChannelA[0]

Then every time you change channelA, it will also change channelB.  Just DO NOT also put the event in ChannelB!  Otherwise you will get a loop and hang DAQFactory!

The other way would be to use script to ask for the value.  The general template (with added duplication) would be:

private string data = system.entryDialog("Enter a new Value:")
if (!isempty(data))
   channelA = strToDouble(data)
   channelB = strToDouble(data)
endif

Share this post


Link to post
Share on other sites

Brilliant, thanks! FYI, anyone else, the system.entryDialog can take min, max, default, and other stuff. And I wanted to change only the timing aspect of the channels, so my quick script became:

private string datain = system.entryDialog("Channel Timing (all channels):",0.005,,channel.channelA.timing)

if (!isempty(datain))
   channel.channelA.timing = strToDouble(datain)
   channel.channelB.timing = strToDouble(datain)
endif

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now