Home » Community » Newbie corner » text box action with enter key
text box action with enter key [message #25090] |
Wed, 10 February 2010 02:29 |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
After typing data into a text box how can an action be triggered when the enter key is pushed?
There are several examples in the tutorial and examples directories that work with data put into a text box but I could find none that worked directly with or triggered by the enter key.
A simple example would be two boxes. After text is entered into box 1 and then the enter key is pushed the data can be modified and then box2<<= modify(~box1);
Seems like this is often used and an example in the tutorial would be of benefit to those learning upp.
In Java it is done like this:
public void propertyChange(PropertyChangeEvent e) {
Object source = e.getSource();
if (source == point1Field) {
point1Action();
return;
}
}
edit: The Converter package in tutorial uses:
value <<= THISBACK(ValueChanged);
but that picks up a change for each character and not just when all characters have been typed in and then the enter key pushed.
The characters could be checked for (13,10) OD,OA "\n" but it seems like something easier than this may have been implemented in upp if there are several text boxes. Especially when a string that ends with "\0" or "\n" is pasted into a box and action is not wanted until the enter key is pushed.
[Updated on: Wed, 10 February 2010 04:29] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sat May 18 03:48:08 CEST 2024
Total time taken to generate the page: 0.02877 seconds
|