09-23-2021 04:57 AM
I tried use property node "Value" of combobox, but it good for "strings[]", not "strings and values[]".
Task: change combo box in interface when input data from Python node.
09-23-2021 05:00 AM
Hi Lugaro,
@Lugaro wrote:
I tried use property node "Value" of combobox, but it good for "strings[]", not "strings and values[]".
What have you tried? (Mind to attach code? LV2017 preferred!)
Where did you fail?
What's wrong with using "strings[]"? Which "value" did you set?
Is there a typedefinition involved?
09-23-2021 05:40 AM - edited 09-23-2021 05:41 AM
Now I cant give code.
Why not string[]:
User must see in combo box "COM1: Serial USB" and "COM10: Virtual port". Combo box must return only "COM1" or "COM10".
So: STRING "COM1: Serial USB" , VALUE "COM1".
Where I fail:
If I make "value" - "COM1: Serial USB" . Return combobox value is "COM1:". Need "COM1".
09-23-2021 05:44 AM
09-23-2021 07:28 AM
The little arrow in the string output that you have circled is and indication that there is more data than it is showing. Expand the box out to be as long as the one that has the info on it and you should see everything.
09-23-2021 07:46 AM
@GerdW wrote:
Hi Lugaro,
first you should remove that glaring race condition in your code!
Reading the combobox in parallel to writing its properties will most likely give unexpected results...
Oh it's worse than "most likely give unexpected results". It can give 'expected results' most of the time, even for years; then for no "apparent" reason, start giving unexpected results.
09-23-2021 08:02 AM
To add into the what could go wrong in parallel code. Every time you make a change, even a minor one, to your code it gets recompiled. The order which parallel items end up happening can be changed depending on the compile operation. Thus it is aways best to have explicit order of operation.
A single frame sequence with all of the stuff that you expect to happen before the loops starts with something from it being wired to the edge of your main loop is how I handle this. It does not have to be used in the main loop just wired up to it.
09-23-2021 08:15 AM
@Tom_Powers wrote:
To add into the what could go wrong in parallel code. Every time you make a change, even a minor one, to your code it gets recompiled. The order which parallel items end up happening can be changed depending on the compile operation. Thus it is aways best to have explicit order of operation.
A single frame sequence with all of the stuff that you expect to happen before the loops starts with something from it being wired to the edge of your main loop is how I handle this. It does not have to be used in the main loop just wired up to it.
No, it's not "aways best to have explicit order of operation". Rules that say 'Always this..' or 'Never that...' are brainless. What's really best is to use your brain to figure out what to do instead of relying on some simplistic rule.
09-23-2021 08:40 AM - edited 09-23-2021 08:43 AM
@Lugaro wrote:
Why not string[]:
User must see in combo box "COM1: Serial USB" and "COM10: Virtual port". Combo box must return only "COM1" or "COM10".
So: STRING "COM1: Serial USB" , VALUE "COM1".
Where I fail:
If I make "value" - "COM1: Serial USB" . Return combobox value is "COM1:". Need "COM1".
The race condition is of course a glaring problem. There's also another thing I think... When using "Strings And Values []" property, the String is what you want to be displayed in the combo box and the Value is what the combo box actually outputs. If you also change the value of the combo box with a Value or Value Signaling property node or a local variable, it messes that all up by writing both the string and value. Whereas if the combo box value is chosen using the dropdown, the correct output will result ("3" in this case).
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
09-23-2021 10:10 AM
@Lugaro wrote:
Now I cant give code.
Why not string[]:
User must see in combo box "COM1: Serial USB" and "COM10: Virtual port". Combo box must return only "COM1" or "COM10".
So: STRING "COM1: Serial USB" , VALUE "COM1".
Where I fail:
If I make "value" - "COM1: Serial USB" . Return combobox value is "COM1:". Need "COM1".
Why not just use Value with the long string and cut the string at colon?