Combo Box Default Selection


Recommended Posts

Hello All,

So I am brand new to programming in DAQFactory, but by no means new to programming. My question is this: Is there a way to programatically select the default selection of a ComboBox? Or better yet, have it set on the initial load by default to the first value?

Thank You ahead of time

Link to comment
Share on other sites

There are a number of ways:

1) if you have a "Set Channel" entered, and it has one of the values of your combo, you can do Page.myPage.updateEdits() and the combo will refresh with the current selection

2) you can name the component, then do something like: component.myComponent.strContents = "mySelection"

The reason the combo doesn't automatically fill is because, unlike most applications, SCADA applications have lots of stuff changing in the background. It would be very annoying to the operator if a combo box was changing its contents automatically as a background variable was being changed by some automation loop, while the operator was trying to select from the combo. Because of this, Combo Boxes, along with Edit boxes do not refresh their content with the variable at hand automatically. Instead, the developer decides when they should refresh by simply calling the updateEdits() function.

Link to comment
Share on other sites

  • 2 years later...

Guys,
 
Been trying to use the UpdateEdits() method with my combo without success, I must be doing something wrong.
 
I've assigned a global string variable to the strSetChannel property;
          Filled the combo with a list of data;
                  Assigned the string variable with a valid name from the combo list;
                         Have a button which fires the UpdateEdits() event in the screen where the combo resides;
                                  and the combo doesn't update to the name in the string variable?

 

Checked all my variable names, case and data and all appears normal.

 

Any ideas?

 

Cheers,

Simon

Link to comment
Share on other sites

Hmm, worked fine for me.  What release and maybe post a simple sample?  Note that combo's are updated based on the Value column, not the Prompt column.  So, for example, if you have the default, your variable should contain 0, 1 or 2, not "Combo0", "Combo1", "Combo2"

Link to comment
Share on other sites

  • 5 months later...

Archived

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