Search Results

Search found 307 results on 13 pages for 'keypress'.

Page 3/13 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • prototype/javascript - firefox not firing keypress/keydown event unless focus is in textbox

    - by Chloraphil
    The following works fine on IE6, IE7, and chrome. Not working on ff 3.0.7. <html><head> <script src="prototype.js" type="text/javascript" ></script> <script type="text/javascript"> Event.observe(window, 'load', function(){ Event.observe(document.body, 'keydown', myEventHandler); alert('window load'); }); function myEventHandler(evt) { alert(evt); } </script> </head> <body > <input type="text" /><br><br> </body></html> EDIT: By "not working" I mean myEventHandler is not firing in firefox. EDIT2: Furthermore, it works fine when focus is on the input element. I want it fire for all keydowns.

    Read the article

  • Android: Hiding the keyboard in an overrided "Done" keypress of EditText

    - by Marshall Ward
    Hello, I have used a bit of Android code to override the "Done" button in my EditText field: myEditField.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { mySubroutine(); return true; } return false; } }); Activating the field calls up the keyboard, and pressing "Done" evaluates mySubroutine() successfully. However, the keyboard no longer goes away when I press "Done". How do I restore this default behaviour to the routine?

    Read the article

  • jquery keypress iterate through each loop?

    - by user239831
    hey guys, probably a simpel question, however couldn't find anything online. i have a list with search results and i want to be able to navigate through the list with my up and down keys. if (e.keyCode == 40) { //down //alert('down'); $('#searchresults ul li').each(function() { }); } if (e.keyCode == 38) { //up //alert('up'); } if (e.keyCode == 13) { //enter //alert('enter'); } the searchresults look like this: <ul> <li class="matched"><a href="link1">link1</a></li> <li class="matched"><a href="link2">link2</a></li> <li class="matched"><a href="link3">link3</a></li> </ul> So basically i just want to be able to navigate through my searchresults with the up and down keys. the selection of the current element should maybe just change the background color and when i press enter the linked and matched element is fired. any idea how i can iterate through the searchresults? thank you

    Read the article

  • Getting keypress cursor co-ordinates

    - by nijikunai
    I'm writing a simple browser based ide with intellisense (code completion) support. So whenever the user inserts a dot (.) character, I need to display a div element (as context menu) near the cursor. Can this can be done and if yes how? Thanks in advance!

    Read the article

  • Prevent keypress whilst shift key is held

    - by deifwud
    I'm trying to prevent certain keys from being entered into an input box, but only if that particular key is pressed whilst the shift key is held: $('selector').keydown(function(e) { console.log(e.shiftKey); if (e.shiftKey && e.which == 51) { e.preventDefault(); alert('Disallowed'); } }); The alert fires but the character still appears in the text box. If I remove e.shiftKey from the if statement and press the key (without shift held), the alert fires and the character does not appear in the text box. I've tried searching around for an explanation as to why this happens but to no avail, any help would be greatly appreciated! edit Removing the alert seems to fix the problem (which seems bizarre), I'd really love to know why it behaves in this way though, it doesn't seem to make any sense. Thanks

    Read the article

  • SDL doesn't detect Arrow Keys

    - by Scott
    I am working through the SDL tutorials over at http://lazyfoo.net/SDL_tutorials/index.php and I'm stuck on tutorial 8 where I'm working with key presses. I'm using the following code: //Our Main application loop while(!quit){ if(SDL_PollEvent(&curEvents)){ if(curEvents.type == SDL_QUIT){ quit = true; } //If a key was pressed if( curEvents.type == SDL_KEYDOWN ) { //Set the proper message surface switch( curEvents.key.keysym.sym ) { case SDLK_UP: message = upMessage; break; case SDLK_DOWN: message = downMessage; break; case SDLK_LEFT: message = leftMessage; break; case SDLK_RIGHT: message = rightMessage; break; default: message = TTF_RenderText_Solid(font, "Unknown Key", textColor); break; } } } if( message != NULL ) { //Apply the background to the screen applySurface( 0, 0, background, screen ); //Apply the message centered on the screen applySurface( ( SCREEN_WIDTH - message->w ) / 2, ( SCREEN_HEIGHT - message->h ) / 2, message, screen ); //Null the surface pointer message = NULL; } //Update the screen if( SDL_Flip( screen ) == -1 ) { return 1; } } Where works fine, the default case is reached, for everything BUT pressing the arrow keys. I was wondering if someone could spot what I'm doing wrong.

    Read the article

  • KeyPressed working on N95 but not woking on N86 etc

    - by awaghad-ashish
    I have a customItem in my application and I am using keypressed event for it. Until now, I have been testing my application on N95 and it works perfectly there but the same keypressed event is not working on other nokia phones such as N86 and ExpressMusic. Does anybody know what the issue is. Thanks and regards, Ashish.

    Read the article

  • Can you restrict entering an invalid entries with jquery ui autocomplete

    - by oo
    when using the jquery ui autocomplete, i would thought there would be an option to force only valid key entry based on the list. Is there anyway to not allow invalid keys so you can only enter valid items in the list? if my list has (csharp, java, python) i can start typing "abcds . ." and it lets me type it in. I want only valid entries to be allowed.

    Read the article

  • Javascript keyup doesn't work as expected, it executes in instances where I have not removed my fing

    - by Binni
    I'm trying to create a simple game in javascript and I'm stuck on how to deal with keys. Small example: function keyUpEvent(event) { alert(event.keyCode); } window.addEventListener("keyup", keyUpEvent, false); I'm running Ubuntu 9.10 and testing it in Firefox 3.5 and Chromium. If I press and release a button instantly I get an alert, which is to be expected, but when I press and hold a button I get a small pause and then a series of alert windows, the expected result is that I only get an alert window when I remove my finger from a button. I reason it has something to do with the fact that when I press and hold a button in a text area for example I get one character, small pause, and then a series of characters: dddddddddddddddd. I believe it's possible to get around this or do it more right or whatever since this game for example: http://bohuco.net/testing/gamequery/pong.html seams not to be affected by this. But I notice if I try out the jquery keyup demo ( api.jquery.com/keyup/ ) I get the same problem. How can I implement basic game key event handling?

    Read the article

  • Check if key is pressed using python (a daemon in the background)

    - by Nazarius Kappertaal
    I've created a python script in which an event needs to be executed each time I press the Super (or WinKey) on my keyboard. How can one achieve this without the python process being "focused" - as it is running in the background waiting for the key to be pressed to execute the event? I've seen a lot of posts around the web showing me how to read input - but they have all required one to have the process "focused" and none have showed me how to capture the Super (or WinKey) using a python script. I'm running Ubuntu 9.10.

    Read the article

  • Can you restrict entering invalid keystrokes with jquery ui autocomplete combobox

    - by oo
    when using the jquery ui autocomplete combobox, i would thought there would be an option to force only valid key entry based on the list. Is there anyway to not allow invalid keys so you can only enter valid items in the list? also, is there a way to set a default value of the combobox. if my list has (csharp, java, python) i can start typing "abcds . ." and it lets me type it in. I want only valid entries to be allowed.

    Read the article

  • [iPhone app] Detecting which key has been pressed in UITextField

    - by Dough
    Hi, I have an UITextField object in my view and want to launch a method when user press backspace button and textField is empty. First I have to do is to create a cursor storing text length, so when cursor changes from 1 to 0 there is nothing to do. The only way to launch the method is when text length is 0 - press backspace - remain to 0. How to catch the event of pressing the backspace key in my UITextField ? Thanks in advance !

    Read the article

  • How to move the textbox caret to the right.

    - by monkey_boys
    I would like to change all the characters entered into a textbox to upper case. The code will add the character, but how do I move the caret to the right? private void textBox3_KeyPress(object sender, KeyPressEventArgs e) { textBox3.Text += e.KeyChar.ToString().ToUpper(); e.Handled = true; }

    Read the article

  • JavaScript Keycode 46 is DEL Function key or (.) period sign?

    - by Omar
    Im writing some logic in JavaScript using jquery, where i must check the input content against a REGEX pattern ex: "^[a-zA-Z0-9_]*$" //Alpha-numeric and _ The logic is almost done, i just have a little problem filtering the function key DEL, my logic goes like this: var FunctionsKey = new Array(8, 9, 13, 16, 35, 36, 37, 39, 46); function keypressValidation(key) { if (config.regexExp != null) { if ($.inArray(key, FunctionsKey) != -1) { return true; } else { var keyChar = String.fromCharCode(key); return RegexCheck(keyChar); } } return true; } If the KeyCode is one of those in the array, i let it pass, if not i get the char and compare it against the REGEX. The problem is: in some Browsers the DEL and '.' (period sign) have the same key Code 46. So is there a better logic to filter the function keys or must i write a condition for that case, maybe removing the 46 from the array and try to convert it to char and if is (.) let it go to the Regex function if not let it pass? The other question will be are there more shared Key Codes in some browsers? EDIT: My suggested solution wont work because it doesn't matter which key the user pressed (DEL or period) i always get (.) as CHAR at least on OPERA and FF =(.

    Read the article

  • How can I get jquery .val() AFTER keypress event?

    - by werner5471
    I got: $(someTextInputField).keypress(function() { alert($(this).val()); }); Now the alert always returns the value BEFORE the keypress (e.g. the field is empty, I type 'a' and the alert gives me ''. Then I type 'b' and the alert gives me 'a'...). But I want the value AFTER the keypress - how can I do that? Background: I'd like to enable a button as soon as the text field contains at least one character. So I run this test on every keypress event, but using the returned val() the result is always one step behind. Using the change() event is not an option for me because then the button is disabled until you leave the text box. If there's a better way to do that, I'm glad to hear it!

    Read the article

  • How can I disable the F4 key from showing the items in a ComboBox

    - by Alex
    You might not know this, but pressing the F4 key on a ComboBox makes it's drop-down item list appear. I believe this is the default behavior on Windows. Does anyone know how to override this behavior in WPF (C#)? I know that overriding default behavior is generally seen as bad practice, however in this case I have a rugged-device that runs XP Embedded. It has a handful of prominent Function keys (F1-F6) that need to trigger different events. This works fine, however when focused over a ComboBox the events aren't triggered as the ComboBox drops down. I have tried catching the KeyDown event both on the form and on the ComboBox and listening for the F4 key, however it doesn't get this far as the key press must be handled at a lower level. Any ideas? Thanks.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >