02-12-2013 04:26 AM
Hi everybody,
I have a problem with an event structure. In fact, I have some value change events on string controls and in order to save data, I use an event (which is triggered by an option on a custom menu or by Ctrl+S). For example, when I am writing something in a string control, if I click on the save option or use Ctrl+S without leaving the string control, the data from this control are not saved.
I understand that the save event is executed before the string control event but I would like to know if there is a way to fix my problem.
Thank you in advance for your answers !
02-12-2013 04:37 AM - edited 02-12-2013 04:41 AM
It is nothing to do with event structure, its to do with your string control. Select this option: http://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/update_value_while_typing/
02-12-2013 04:54 AM - edited 02-12-2013 04:54 AM
Thank you for your answer.
I know this option, but I just hoped that there was an other way to fix the problem because the event of the string control may trigger an error depending on the value of the string and I don't really want to pop an error each time the user type a letter.
02-12-2013 05:16 AM - edited 02-12-2013 05:17 AM
Ok.
One method I can think of is:
Set the update value while typing to true (property node) in your Ctrl + S case and then read the value and then set update value while typing back to false again.
02-12-2013 07:23 AM
I tried your method. It works but there is another problem. To complete my explanation, I have a VI which contains the save event, and this VI uses a subPanel to execute a subVI which contains the string controls (which needs to match a regular expression). So I need to use a global value in order to know in which control the user is typing. But there is a lot of string controls, so that means that I have to wire each control to the global value (because each control triggers an event). And It might take a lot of time, can you think of another way ?
I am sorry to bother you.
Thank you.
02-12-2013 08:20 AM
Ok.
One other way I can think of is to enable update value as you type and then to filter out unwanted value change events. Something like this: http://forums.ni.com/t5/LabVIEW/Labview-slider-event-handling-problems-revisited/td-p/208121/page/2
You may have to use the mouse leave event instead.
More examples can be found here: https://www.google.co.uk/#hl=en&tbo=d&sclient=psy-ab&q=ignore+multiple+event+for+slider+labview&oq=i...
02-12-2013 09:00 AM
Alright, thank you for all your answers.
I can see than in all cases (except the one where the only thing to do is to use the update while typing option), the references of the controls are used, so all the events triggered by the controls needs to be modified (even if it is just to add a wire for the reference). In my case, it will just take to much time (yes, I have that much events... ).
02-12-2013 09:05 AM
We may be able to provide some more information if you can post your code / or even a simplified version of it.
02-12-2013 09:18 AM
Ok.
I am goign to make a very simplified version of my code and post it.
02-12-2013 10:58 AM
Here is a very simplified version of the code. You need to launche Parent.vi, then go to (the menu is in french) Fichier -> Ouvrir. The subVI is opened in the subPanel, then for example if you type something in "Chaine 4" and use Ctrl+S without leaving the "Chaine 4" control, the value won't be saved in the "File.bin" file.
In order to understand my problem, you need to imagine the subVI with much more string controls (therefore muche more events). I mean, much more than you can actually imagine... I have my reasons for having used so many string controls.