Combobox Component Attributes


Recommended Posts

Hello,

I have a combobox, and two text edit box components; and I want the operator's text (selected in the combobox and typed in the edit box components) to display on another page.

Here is what I have so far:

Global Customer  // Global to be seen by another page
Global Location
Global Unit

Location = Component.txtLocation.strContents // text edit box
Unit = Component.txtUnit.strContents // text edit box

Page.DAQ_Main.UpdateEdits() // derived from another forum post

Customer = Component.cmbCustomer.strContents // combobox component should reflect selection
Page.DAQ_Chart.mtxtCustomer.strContents = Customer + ", " + Location + ", " + Unit // should display in multiline text component // // on another page

?Customer // prints out NaN
?Location // prints out NaN
?Unit // prints out NaN[/CODE]

// Error I get when button clicked!!!

C1097 String operator found when number expected.: Line 11 - Unable to perform quick sequence action

Can I get some advice...

Link to comment
Share on other sites

A couple things. First, you get the NaN's and that error because you declared the three variables as numbers. You want:

global string customer

etc.

Second, updateEdits() is only needed when you want to update all the edit boxes / combo boxes so they match the contents of their Set To channels. So, if you had an edit box with the Set To channel = Customer, doing updateEdits() on that page would fill the edit box with the contents of the Customer variable. Note that strContents doesn't require updateEdits(). Changing strContents immediately changes the contents of the editbox. But if you are using Set To channel, then you don't need the line that says: customer = component.cmbCustomer.strContents.

I'm guessing that you are a VB or VC programmer. Its important to remember in DAQFactory that many things don't require script. For example, if you want a text box that displays a value, you don't write script and set a variable in the component. You instead create a variable value component and set the Expression in that component to the variable holding the value (or the expression that gives the result). Yes, you can do it the script way, but really the script method is designed for unusual cases, not all the time.

Same with how you are treating your edit / combo boxes. You should be able to do what you want with only three lines of script, the three lines that declare the string variables (changing them as I indicated, of course). Then you can just set the Set To channel for your edit/combo to the appropriate variable and they'll be updated when the edit/combo is changed (provided you have On Exit checked for the edit box). Then, to display it on a different page, use a variable value component with this expression:

customer + ", " + location + ", " + unit

Just that. No page.DAQ_Chart....

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.