Keypress Events

Hi, everybody, it is my first question to you all.
Does anybody have any function that would capture keypress events, or
any information that would be helpful in capturing them? For example,
when a user presses the <down arrow> or F1 key. I am currently using
the AfterValueChange event to capture keys that display.
Thanks,
Scott Watters
Systems Analyst
Carlson Wagonlit Travel - Minneapolis
[email protected]

Hi, Scott.
Here's the information I found on trapping keystrokes - mostly R3 =
specific, but that's OK for you. I pulled the following posts off my =
mailing list archive:
From: <[email protected]>
Date: Fri, 4 Apr 1997 15:57:32 +0800
Subject: Trapping Certain Keystrokes
Hi All,
I have read the manuals, and the online-documentation, but can not seem =
to find anything about trapping keystrokes other than the Function keys.
Our application specifically requires us to trap certain keystrokes, =
such as the navigation keys etc.=20
Does anybody know which event is raised when a key is pressed?
Any insight will be appreciated.
Regards Martin
From: DEVEAUX Manuel <[email protected]>
Date: Fri, 4 Apr 1997 11:43:11 +0200
Subject: RE: Trapping Certain Keystrokes
Hi all,
Actually, I don't think you can trap keystrokes on a UserWindow but on =
some WidGets (like DataFields), you can set to TRUE the 'Validate on =
KeyStroke' option in the properties dialog .
Thus, when the WidGet has the focus and the user send a keystroke, you =
can trap this event with the 'AfterValueChange' event. If someone knows
=
how to trap keystrokes on a UserWindow, I am also interested !
Thanks.
* Manuel -
Manuel Deveaux
Fort=E9 Developer
Mutuelle Pr=E9viade
Nancy, FRANCE
E-Mail : [email protected]
From: Jean-Paul De Baets <[email protected]>
Date: Fri, 04 Apr 1997 14:11:58 +0200
Subject: RE: Trapping Certain Keystrokes -Reply
This is an enhancement request we also posted several months ago. I =
think it is announced for Fort=E9 release 3. But I don't know if we =
will be able to trap ANY keystroke.
Jean-Paul=20
J.P. De Baets
CAP GEMINI Belgium
[email protected]
From: Kerry Bellerose <[email protected]>
Date: Fri, 04 Apr 1997 13:28:14 +0100
Subject: Re: Trapping Certain Keystrokes
Hi Manuel and Martin,
Unfortunately, for Forte V2.0, Manuel is correct. But Forte has added a
=
feature that allows you to trap any keystroke in Forte R3, which is =
currently in beta.
If you are a beta site, look in the Forte Release 3 Beta Features manual
=
page 169, the window class SetAsFunctionKey method.
If you are not a beta site and want this functionality in R2,=20
you would need to do some tricks with menus or data fields, as Manuel =
indicated.
Cheers,
Kerry
From: Lee Wei <[email protected]>
Date: Mon, 7 Apr 97 09:06:23 PDT
Subject: RE: Trapping Certain Keystrokes -Reply
I think all of us want to know if we can indeed trap ANY keys.
The answer is ALMOST, including escape, spacebar, enter, backspace, tab,
=
navigational (up,down,left,right,end,home), digits, alpha, numeric =
keypads, insert, delete.
But not keys such as left shift, right shift, left Alt, right Alt, left =
Ctrl, and right Ctrl (Helpful for games...).
Don't forget that we are talking about release 3.
Lee Wei
Hope this helps,
Dariusz Rakowicz
[email protected]
From: owner-forte-users
Sent: Friday, July 25, 1997 10:46 AM
To: 'Forte Users Group'
Subject: Keypress Events
Hi, everybody, it is my first question to you all.
Does anybody have any function that would capture keypress events, or
any information that would be helpful in capturing them? For example,
when a user presses the <down arrow> or F1 key. I am currently using
the AfterValueChange event to capture keys that display.
Thanks,
Scott Watters
Systems Analyst
Carlson Wagonlit Travel - Minneapolis
[email protected]

Similar Messages

  • List that responds to keypressed events?

    Hi
    I am designing a midlet that needs a list which scrolls down to names based on the input from the phones letter keys (ie if the user presses the 'GHI' key then the names starting with 'G' are shown. the same as in a phones contact-list) However the problem is that there is no keypressed event for j2me Lists or Forms.
    I realy don't want to have to reinvent the List from a Canvas.
    Could anyone tell me the best way to handle this?
    Thanks greatly
    Aharon

    Hmm... the small screen is a big pain, isn't it!
    Suppose you dynamically filter the list of potential entries based on what has been already entered in the TextField? Something like thisString[] allNames = new String[100];
    choiceGroup.deleteAll();
    String filter = textField.getString().trim().toUpperCase();
    for ( int i = 0; i < allNames.length; i++ )
        if ( allNames.toUpperCase().startsWith(filter))
    choiceGroup.append ( allNames[i], null );
    }db
    -- TextField, [i]not TextBox.  TextBox extends Screen, TextField extends Item. ;-)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Listening for keyPressed events from background?

    Is it possible to have a java program running in the background and listen for keyPressed events? I would like for the program to listen for certain keys to be pressed and when they are manipulate the mouse. From what I've looked at so far however it seems the listening component must have focus. Thanks.

    On any OS that would typically involve hooking into the OS itself.
    And then manipulating OS resources as well.
    Putting an app into the 'background' is also OS specific.
    Given that the above is all you want to do then java is not an appropriate language choice. C++ would be better.

  • How can i call mouse click event from keypress event???

    How can i call mouse click event from keypress event???
    I want same GUI changes to be occured at key press.....i.e . button going down & comming up.....
    for calculator

    Put all the code that happens on those events into a method. Then call that method from both events.

  • Can one get keyPressed events anywhere other than in Canvas?

    Hi there,
    I have a form displayed
         display.setCurrent(form);
    but I would like to receive keyPressed events, in particular "game actions" UP DOWN LEFT RIGHT.
    As far as I can tell, this isn't possible unless I have a Canvas displayed. :-(
    The form is displaying data (a couple of string items) and the soft key commands.
    This is only my second MIDP app, so any help would be appreciated.
    Thanks,
    colin

    1. Don't know.
    2. Hopefully you have a backup to restore from. Contacts are separate from iTunes, but if you enabled iCloud, then your contacts should be preserved (if you do not use Outlook, Address Book, etc.)

  • KeyPressed Event in Swing

    In keyPressed Event Iam calling dispatchEvent on the component passing the ActionEvent as argument.
    Iam expecting that, control should come back to actionPerformed as it happens in awt.
    But, it is not behaving like that. Can u guys figure it out Y??
    Here is my sample code:
    public void CancelButtonPressed () {
    ActionEvent actionEvent = new ActionEvent((Object)CancelButton,
         ActionEvent.ACTION_PERFORMED, CStrings.CANCEL);
    CancelButton.dispatchEvent (actionEvent);
    Note: CancelButton is my JButton object instance.
    Iam expecting that after dispatchEvent is called as above java should invoke actionPerformed.
    But it is not.

    I need to construct ActionEvent explicity since actionlisteners are set for the components in one class say A.
    From this class keypressed event is delegated to the other class say b.
    Here B class gets the component. Inour case its JButton. In class B, i cannot call the actionPerformed.
    What I do is.. I will call the dispatchEvent on this component. Thats why Iam creating ActionEvent.
    I hope you got my point.

  • Alt+ key in KeyPressed Event

    hi,
    I would like to get the KeyPressed Event for 'Alt+O' keyEvents. How to find two keystrokes combined. thanks in advance.

    You may want to read the KeyEvent class description in the API documentation.
    http://java.sun.com/j2se/1.4/docs/api/java/awt/event/KeyEvent.html

  • Send a keypress event to JOptionPane ?

    How can I send a keypress event to JOptionPane emulating the "No" selection?
    Thanks
    Andreia

    Actually...I thot about it...and you would not even have to do that....if the timer goes off....and the user did not select "yes", then you just call the method that would have been called when "no" was pressed.....simple.

  • How to handle keypressed event for form

    i have to handle keypressed event of a textfield control.
    I have tried by implementing itemstatechangelistner ........
    but as api specifies its behavior varies from device to device....it is guaranteed that the control is notified when losing its focus. But my requirement is to get notified for every keypressed time.....
    any idea.....pls help me

    Can't be done for TextField. Many devices (example:SE k700i) launch a separate editing screen to change the text in a TextField.
    db

  • Adf javascript clientlistener not capturing the TAB keypress event

    Hi,
    I have client listener attached to a text field to trap the keyPress event. The method is being called for all the key strokes except special keys like TAB, arrow keys, pageup, pagedown etc. Is there any possibility to capture TAB key event.
    <af:clientListener method="myFunctionTosetFocus"
    type="keyPress"/>
    function myFunctionTosetFocus(event) {
    alert('function called....')
    var keyCodePressed = event.getKeyCode();
    if(keyCodePressed == AdfKeyStroke.ENTER_KEY || keyCodePressed == AdfKeyStroke.TAB_KEY) {
    alert('Do some thing here....')
    I can see both the alert messages when I click on the ENTER key. But I cannot see both the alert messages when I cick on TAB key. The same is working without any problems in firefox.
    Thanks and Regards,
    S R Prasad

    Hi Frank,
    I tried with the event.cancel(). Now I can see the event.cancel() working for ENTER key, But not for the TAB key. I tried with the keyDown event in the clientListener and it is working with out any problems in both IE and firefox.
    It is not working as expected in case of keyUp event, If I set the focus to the next tab in the clientListener code, it is executing the clientListener of the destination component if the clientListener event is keyUp.
    Overall it is wotking as expected with the keyDown, But it is not working for the keyUp and keyPress events. All these are working as expected in firefox.
    Thanks and Regards,
    S R Prasad

  • JTree - How do I fire a valueChange Event from a keyPressed Event?

    Hi,
    I have been stumped trying to figure out how to fire a valueChange event in my JTree from a keyPressed event.
    When a user changes tree node using the mouse a valueChange event fires. In my program the valueChange executes some code that must be done. I want to get my JTree to work, so that if a user is nagivating the tree using the keyboard, the code is only executed if they press the enter key.
    Below is a little demo program of what I am attempting to accomplish. Any suggestions would be greating appriciated.
    Thanks,
    Corey
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.tree.*;
    import javax.swing.event.*;
    public class SimpleTreeDemo extends JFrame  {
      public SimpleTreeDemo() {
      public static void main(String args[]) {
        JFrame j = new SimpleTreeDemo();
        DefaultMutableTreeNode category = new DefaultMutableTreeNode("Top of JTree");
        DefaultMutableTreeNode leaf1 = new DefaultMutableTreeNode("leaf1");
        DefaultMutableTreeNode leaf2 = new DefaultMutableTreeNode("leaf2");
        category.add(leaf1); category.add(leaf2);
        final JTree jtree = new JTree(category);
        boolean bflag = false;
        jtree.addTreeSelectionListener(new TreeSelectionListener() {
             public void valueChanged(TreeSelectionEvent e) {
                  System.out.println("valueChanged");
                  if (bflag)
                       // Execute Code
        jtree.addKeyListener(new KeyListener() {
            public void keyTyped(KeyEvent ke) {
              System.out.println("keyTyped");
            public void keyPressed(KeyEvent ke) {
                 System.out.println("keyPressed");
                 if (ke.getKeyCode() == KeyEvent.VK_ENTER)
                      bflag = true;
                    // Fire valueChanged here!
            public void keyReleased(KeyEvent ke) {
                 System.out.println("keyReleased");}
        Container c = j.getContentPane();
        c.add(jtree);
        j.setSize(200,200);
        j.show();

    Try this, it works for me.
    // Tree Key Listener
          tree.addKeyListener(new java.awt.event.KeyAdapter() {
             public void keyPressed(KeyEvent e) {
                tree_KeyReleased(e);
    private void tree_KeyReleased(KeyEvent e) {
          try {
          int keyCode = e.getKeyCode();
          // Get the Tree Path
          TreePath selPath = tree.getSelectionPath();
          if (keyCode == e.VK_DELETE) { //KeyCode - 127
             removeSelectedNode(); // Remove the node
          else if (keyCode == e.VK_ADD) { // Key Code - 107
             tree.expandPath(selPath); // Expand the Node
          else if (keyCode == e.VK_SUBTRACT) { // Key Code 109
             tree.collapsePath(selPath); // Collapse the Node
          else if (keyCode == e.VK_ENTER) {
              // What Ever you want to do here
          else {
          } catch (NullPointerException ex) {
          //System.out.println("Null");
    [/code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • JButton loses Focus after a KeyPressed Event

    Hello.
    I have a simple form with a few textfields and buttons, everyone of this components has a KeyPressed Event associated, but i pressed a key (ENTER) on a button, it loses the focus and the next button catch it (i have a specified order setted).
    The point is this only happens in the buttons, the textfields and receiving the event don't lose the focus.
    Can someone tell what is wrong ?
    Thank you.

    I tryed to make a minimalist example to post here, but i couldn't reproduce the error, so i went back to try figure out what i missed.
    I commented all the lines where i had button.setEnabled(..) and now works great, still don't know why, but it seems at some point the button loses the focus when is setEnabled(false)this is what i was doing:
    private void LoginOKButtonKeyReleased(java.awt.event.KeyEvent evt) {                                         
            if (evt.getKeyCode() == java.awt.event.KeyEvent.VK_ENTER)
               button.setEnabled(false);
               WorkerLogin worker = new WorkerLogin();
               worker.execute();
    public class WorkerLogin extends javax.swing.SwingWorker<LoginResposta, Void>
             * Main task. Executed in background thread.
            @Override
            public LoginResposta doInBackground()
             * Executed in event dispatching thread
            //@Override
            public void done()
                try
                    LoginResposta resposta = get();
                    button.setEnabled(true);
    }Edited by: noe.rocha on Feb 14, 2008 9:56 AM

  • How to press 2 keys with "keyPress" event" at the same time?

    Hi~~
    I 'm now developing a Java Application that need to press 2 key(keyEvent) at the same time, but it seem not to work after trying.
    So, I wonder how to make it work?
    Thank~~

    You can use a "modifier" (Control, Alt, Shift) key in combination with a regular key, but you can't combine regular keys unless you add some custom logic.
    Basically in the keyPressed event you need to store the previous key that was pressed and add some comparison logic to see if the two keys you are monitoring where pressed back to back.

  • How to no allow input japanese in JCombobox but still handle keypress event

    How to no allow input japanese in JCombobox but still handle keypress event?
    I used DocumentFilter to no allow input japanese but when i execute ENTER keypress event no action.
    Please help me. thanks very much

    I don't know about Raspberry but on desktop it would be primaryStage.close() - does that work?

  • Record Keypress events of Virtual Keyboard in Iphone

    Hi. I am working on an IOS eng language dictionary and I need to record keypress events of virtual keyboard so that I can provide users with a dropdownlist (like an autocomplete) of words. I have done it through value changed event of UITextField but I am not getting anywhere with this. Is there any solution?

    Hi. I am working on an IOS eng language dictionary and I need to record keypress events of virtual keyboard so that I can provide users with a dropdownlist (like an autocomplete) of words. I have done it through value changed event of UITextField but I am not getting anywhere with this. Is there any solution?

Maybe you are looking for

  • I seem to have 2 icloud accounts

    When I look at my contacts on my iMac I seem to have 2 iCloud accounts.  One has all my contacts on and the other only has about 10.  When I enter new details on my iPad or iPhone it only backs up to the shortened iCloud account

  • My iphone 5 fell down from the table and now I can't touch screen or do anything with it anymore. Please help me!!!

    My iphone 5 fell down from the table and now I can't touch screen or do anything with it anymore. I send it to Istudio in Thailand and they said it is non authorized so they will not fix for me. I search google and they said that my LCD has problem b

  • Skipped Assignments in Oracle HRMS Payroll

    Hello everyone, I would like to know that can cause an assignment action to be skipped during a payroll run. That is because it happened with many assignments we have in a certain run and we don't know where to start finding out why. Per privacy and

  • Apple server - some address can't receive mai

    I'm running an Xserve with Tiger Server. I've set up about a dozen users and most of them can receive email just fine. I've got one though, that when I send an email to that address from a company Exchange server, it comes back with this: Diagnostic-

  • Help me!  converting to pdf from word, missing pictures and formating?

    I wrote a book, was able to create a press quality pdf without any problem during my free trial of acrobat pro xi, now that I have made edits and have bought acrobat, everytime I create a pdf from this (large) word file, some of the images are missin