LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Clear a string control when Enter is pressed

Solved!
Go to solution

Bob,

Please note that (late in the discussion) Brandon stated he wanted to emulate an "Instant messaging window".

The bonus property of your simple, elegant, solution does not fit that paradigm (i.e. "clicking out" sends message.).

 

Consider a user starting a message, then having to respond to other system activity - you would get an incomplete message.

 

steve

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
0 Kudos
Message 21 of 24
(501 Views)

@stevem181 wrote:

Bob,

Please note that (late in the discussion) Brandon stated he wanted to emulate an "Instant messaging window".

The bonus property of your simple, elegant, solution does not fit that paradigm (i.e. "clicking out" sends message.).

 


Yes, I absolutely agree.  I don't know all of the details of Brandon's situation, so he may well need extremely fine-grain control and will have to deal with the complexity this entails, but if his needs are not as complex, Simpler Can Be Better.  If one needs to guard against "clicking out", it might be simpler to add code specifically for this case (with a text label explaining this contingency) ...  It is all a question of coming up with a Good Design (where "Good" is in the Eye of the Beholder, and "This works!" is certainly an acceptable definition ...).

 

Bob Schor

0 Kudos
Message 22 of 24
(483 Views)

Oh, well.  Do it the hard way.  Good luck explaining the convoluted logic to someone else.


Hello Bob, I'm sorry if I offended you in any capacity. It certainly was not my intent and I fully appreciate you taking the time out of your day to suggest a solution, especially one that would simplify code. That being said the I didn't use the value change event because (on my PC at least) when I use the enter key on the numpad, or when I clicked out the event triggers but, but not when I use the enter key above right shift.

 

 

EDIT: with "Limit to Single Line" with works with both Enter keys

0 Kudos
Message 23 of 24
(453 Views)

Ah.  If I understand what you just said, you agree with me that my "simple solution" (where I explicitly say you need to "Limit to a Single Line") works with the Numeric Pad Enter Key, the Keyboard Enter Key (the one above Right Shift), and if you signal you are done entering the number by clicking outside the control.  I'd choose Simplicity and Maintainability, especially since (to my mind) it doesn't matter how the User signals "I'm Done" as long as it is "logical" and unlikely to break the program (I suggest <Ctrl><Alt><Del> would be a really poor "I'm Done" signal ...).

 

Bob Schor

0 Kudos
Message 24 of 24
(421 Views)