08-18-2017 11:35 AM
@Brandon.Baxter wrote:
Hello Bill, I like the "Key Down?" event because you can discard the character an append whatever you want as an end, like a sync word for example
That's a nice way to handle it, given the "revised" requirements. 😉
08-18-2017 11:53 AM - edited 08-18-2017 11:56 AM
I think we are dealing with a race condition and I would call it a bug. Note that things work fine if we are in execution highlighting mode or if we slightly delay the write to the local variable e.g. as follows:
(input is set to update while typing)
08-18-2017 11:59 AM - edited 08-18-2017 12:02 PM
It also seems to work properly if we use a value property node instead of the local variable to clear the string.
08-18-2017 12:00 PM
I didn't understand the problem either until I started messing with it.
Using a reference updates the control. I do have Update Value While Typing turned on.
08-18-2017 12:18 PM - edited 08-18-2017 12:19 PM
Here is a comparison of two seemingly functionally identical code version (one with a local, one with a value property).
Clearly some gears don't mesh correctly when using a local variable. This should work!
08-18-2017 12:40 PM
Yes, I know this isn't exactly what the Original Poster asked, but (a) this is much simpler, (b) this is trivial to understand, (c) this functionally does the same thing (though you could probably define an "edge" case where this wouldn't work), and (d) this also works if, instead of typing <CR>, you click outside the box to indicate you are done. This (therefore) makes it much more intuitive for the User. You do need to make the String Control a "Limit to Single Line" control, of course ...
Bob Schor
08-18-2017 03:33 PM
Hello Bob I was toying with an idea similar to the one you presented.
The approach I'm going for is like text in an Instant messaging window. I.e. type stuff, enter, type more stuff enter. I started with the solution you posted but I found did not flow well having to click something arbitrary to trigger the value change event. The next thing I did was use a Send button rather than the value change to make it more intuitive to an end user. Ultimately I settled on pressing Enter to send the data to my consumer loop and clear the string because for this situation it is very Intuitive and it keeps the flow going to the end user.
08-18-2017 03:39 PM
In that case, I would just set control to 'limit to single line' and use a 'Send' button that has a binding to the 'Enter' key.
08-18-2017 03:59 PM - edited 08-18-2017 04:01 PM
This is what I settled with. I would have liked to be able to do it without setting "Update Value While Typing". But other than that I'm very happy with the way the UI flows and the way this fits into my code.
08-19-2017 05:55 AM
@Brandon.Baxter wrote:
Hello Bob I was toying with an idea similar to the one you presented.
The approach I'm going for is like text in an Instant messaging window. I.e. type stuff, enter, type more stuff enter. I started with the solution you posted but I found did not flow well having to click something arbitrary to trigger the value change event.
No, no, no! Type <Enter> or "click something arbitrary". I apologize for "telling you too much" -- I thought you'd realize that I was explaining a bonus property of my method, not only is it simpler, trivial to explain, and will do what you want when you hit "Enter", but if the User does decide to "click out", that will also work.
Oh, well. Do it the hard way. Good luck explaining the convoluted logic to someone else.
Bob Schor