Hello all Im trying to make java robot hold down the command key. I have used the following code. robot.keyPress(KeyEvent.VK_META); robot.Delay(5000); robot.keyRelease(KeyEvent.VK_META); This doesant seem to do the trick. Yes I have searched on how to do this but cannot find a working answer. Am I using the wrong keycode? Ive also tried robot.keyPress(KeyEvent.META_MASK); and robot.keyPress(KeyEvent.META_DOWN_MASK); Ive also tried keycodes, 91 and 93.

Member Avatar
Member Avatar
+0 forum 2

I want to make a game that requires the arrow keys to be pressed. How do I detect if a key has been pressed?

Member Avatar
Member Avatar
+0 forum 3

Until now I've been replacing Enter key behaviour in controls (in base classes) with Tab key behaviour with the following code in the keypress event handler : If e.KeyChar = Chr(13) Then SendKeys.Send(vbTab) e.Handled = True End If Although it's worked for me until now, I have serious doubts about the (thread)safety of this approach.

Member Avatar
Member Avatar
+0 forum 4

I'm trying to create a program which will work in the background and can be brought back to the topmost upon a keyboard shortcut. I got stuck when creating the multiple keypress statement, and not sure how to make the shortcut work when the form is not in focus. Here's the shortcut I'm trying to make, but it won't work. Private Sub TakeDown_KeyDown(sender As Object, e As KeyEventArgs) Handles TakeDown.KeyDown If e.KeyCode = Keys.LWin And e.KeyCode = Keys.Z = True Then Me.BackColor = Color.Blue End If End Sub The if I use only one key it will work, but not …

Member Avatar
Member Avatar
+0 forum 5

Private Sub txtPassword_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtPassword.KeyPress Dim NotAllowed As String = "~`@%^&+={[}]()!:,;'><?/|\-.#+()_$*" If e.KeyChar = ChrW(Keys.Enter) Then e.Handled = True End If If e.KeyChar <> ControlChars.Back = True Then If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then e.Handled = True End If End If End Sub hi guys i just wanna ask if this code is true and makes the enter key null

Member Avatar
Member Avatar
+0 forum 10

My problem is that I wish to use a single mouse click (or key press) to "turn on" a set of conditions then I will "turn off" the conditions when a different requirement is met. Alas! Every time I release the mouse button the bool reverts to its initialized state. I do not want it to do that and I do not want to set it to "toggle" on and off with each mouse click either. Here are some examples of what has failed: // first, simple failure bool start = false; if (dbMouseClick()) start = true; // another unsuccessful …

Member Avatar
Member Avatar
+0 forum 1

I am working on a keyboard teaching aid similar to mavis beacon. With the following code i am able to detect if the enter key is pressed on the keyboard. If e.KeyChar = Microsoft.VisualBasic.ChrW(keys.enter) Then MsgBox("Enter key is pressed") End If but what i want to do is that i want to make the keyword "keys.enter" to become a variable name so that the whole code can be called upon as a subroutine to handle all types of letter being pressed by the user so that i dont have to repeat the whole code for the keys needed. Thanks in …

Member Avatar
Member Avatar
+0 forum 5

I want this code to run in the background but still be active: Private Sub frmMain_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress lblTest.Text &= e.KeyChar End Sub

Member Avatar
Member Avatar
+0 forum 5

I working with an application written in Visual Studio C++. Then program is a console application running under the DOS-prompt. The program is something like this. void main () { for ( ;; ) { do_something (); do_something_more () } } Now I need to add some code between do_something () and do_something_more () that checks if any key on the PC-s keyboard is pressed, and if so read that key. The problem is that the program must continue with do_something_more () if no key is used. I can not wait for the keypress, the program must continue executing as …

Member Avatar
Member Avatar
+0 forum 5

I need assistance with using Keypress to only allow a certain range of numbers (1-26) to be typed into the textbox. When ever I do it, it only allows me to press the numbers "1 and 2". I'm very new to VB so the help is much obliged. I know Im doing something very stupid! :P Public Class Form1 Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click Dim intMath As Integer Dim intReadingWriting As Integer Dim intScienceHistoy As Integer Dim intSum As Integer Dim intAverage As Integer intMath = Val(txtMath.Text) intReadingWriting = Val(txtReadingWriting.Text) intScienceHistoy = Val(txtScienceHistory.Text) …

Member Avatar
Member Avatar
+0 forum 7

Hi everybody, How to do the following in java..?? created a frame and one button added to that frame and set the keyboard shortcut to that button.Now my question is how to make that keyboard shortcut will work eventhough focus is not there in that frame? anyone have any idea..

Member Avatar
Member Avatar
+0 forum 2

I need to highlight the current key pressed in my C# application. To get the keyboard keys code during keyDown and keyUp events i tried returning the keycodes as protected override void OnKeyDown(KeyEventArgs keyEvent) { // Gets the key code lblKeyCode.Text = "KeyCode: " + keyEvent.KeyCode.ToString(); } Other way i tried was to check if each key that i need is pressed namespace test { public partial class Form1 : Form { public Form1() { InitializeComponent(); // Create a TextBox control. Button enterBtn = new Button(); this.Controls.Add(enterBtn); enterBtn.KeyPress += new KeyPressEventHandler(keypressed); } private void keypressed(Object o, KeyPressEventArgs e) { // …

Member Avatar
Member Avatar
+0 forum 1

Ive been playing around with a couple of scripts both of which work well on their own. The first is a basic alertbox that uses a hotkey; [Code] <script> $(document).jkey('o', function(){ alert('Pressed o');}); </script> [/code] The second is a custom alert box which displays after clicking on a link. How can I incorporate the jkey function from the first script to trigger the alert box in the second script? ie. I want to trigger the custom alert box by pressing 'O' [code] <html> <style type="text/css"> .alert { display:none; position:absolute; top:1px; left:1px; width:300px; background-color:white; border-style:solid; border-width:1px; padding:15px 20px 5px 20px; } …

Member Avatar
+0 forum 0

Ok this question is more like 'what is the term used for such as event?'. What I am trying to do with open a application config form in login window which is activated by combonation of keys pressed. for example alt+c or ctrl+alt+x. I tried using every term i can think of to search for a solution but no luck so can someone please tell me what term i need to used to find solution for such.

Member Avatar
Member Avatar
+0 forum 14

Hi! Since my last thread hasn't been answered and I simply cannot wait until it gets answered, how can I validade what is being written on a textbox? I need to know when the user types a "-" (minus) char. And when he do so, an message appears (preferably an ballon or a tooltip) and says that is illegal to type this char in particular. How can I catch it? Thanks.

Member Avatar
Member Avatar
+0 forum 9

Hi, I have added a keypress event as [CODE] jQuery('#body').keypress(function(){currentTime= new Date().getTime(); });[/CODE] but when I open a pop up window which have a iframe contains a rich text area not capturing this event. Any ways to handle parent event in child element? Any suggestion?

Member Avatar
+0 forum 0

Hi, I have a piece of code which loops through checked checkboxes to do something with each of them. After each turn in the loop I want to pause before it continues to the next checkbox until the user enters a piece of text into the text box. I have tried something like this but haven't had any sucess, I'm still quite new to VB.Net so please bare with me! [CODE] Private keypressed as Boolean = False Private Sub txtCurrentCaptcha_keyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtCurrentCaptcha.KeyDown If e.KeyCode = Keys.Enter Then keypressed = True End If End …

Member Avatar
Member Avatar
+0 forum 8

Okay, this is just a simple trick to determine whether CAPS is pressed because some people here use API to determine whether the CAPS Lock is pressed. [QUOTE] KeyDown and KeyUp don't detect exactly the same information as KeyPress. KeyPress detects a character in its KeyAscii parameter, but KeyDown and KeyUp detect a physical keystroke in their KeyCode parameter. [LIST] [*]KeyUp and KeyDown can detect keystrokes not recognized by KeyPress, such as function, editing, and navigation keys. [*]KeyPress can distinguish between different ASCII characters generated by the same physical keystroke. [/LIST] [/QUOTE] Where did I get KeyCode = 20? Try …

Member Avatar
Member Avatar
+0 forum 7

How can I prevent the beep sound when I use the SendKey command in NumericUpDown1 Box? Here is the code: [CODE] Private Sub NumericUpDown1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles NumericUpDown1.KeyPress Static SAME As Short = TB2 TB1 = SAME - NumericUpDown1.Value If e.KeyChar >= "0" And e.KeyChar <= "9" Then SendKeys.Send("ENTER") End If TextBox1.Text = TB1 End Sub[/CODE]

Member Avatar
+0 forum 0

Hello all, i want to know some textbox case. I want to make my textbox (example textbox1) only can be written by numeral, if there was non numeral input, textbox1 not allow or just being ignored. Thanks for attention or help :)

Member Avatar
Member Avatar
+0 forum 3

I use Visual Basic 2008 I had this code in Visual Basic 6.0 that the replace the ASCII value of [COLOR="Red"]decimal point [/COLOR]for the ASCII value for a [COLOR="red"]comma[/COLOR][CODE] Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 46 Then KeyAscii =44 End Sub [/CODE] But this does not work Visual Basic 2008 This I have so far! [CODE] Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If e.KeyCode = Keys.Decimal Then [B][COLOR="Green"] 'But what code should come here?[/COLOR][/B] End If End Sub [/CODE]

Member Avatar
Member Avatar
+0 forum 1

hello friends, I am making a GUI for a certain fill up form using netbeans..here I need disable a "next" button until all the text fields are filled up...I have tried writing a method that which is called during every keypress event in a text box that checks whether the rest of the text boxes are non empty and the status of the text box from which the key press event came from and then enables the button.but this method gets a bit messy since it has to look for too many conditions to get around the problem of user …

Member Avatar
Member Avatar
+0 forum 1

Hi, I'm pretty sure this would be something I'd need javascript for. What i want to do is to recognize when a user presses the enter key while active on a text area and to insert a new line

Member Avatar
Member Avatar
+0 forum 4

Hi. This may seem simple to most but has consumed 3 days so far and a bit of $$ trying to learn simple how to use Enter as a Tab (Yes I know it is a Fau-par but I need it regardless). The idea is to move the focus to the next TextBox (don't worry about the Case 38, 58 etc too much I). I have 6 large books on VB.NET 2003 and have been googling for days with no joy. Please help. Thank you. My Code: [CODE]Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load '(Unrelated …

Member Avatar
Member Avatar
+0 forum 1

Hi all, I'm trying to capture an event when tab is pressed in a textbox using visual studio.net, and am having a hard time. I can capture anything else, inluding the keys that are difficult like instert, alt, and the arrow keys. Here is the MSDN page that did not help: [url]http://msdn.microsoft.com/en-us/library/system.windows.forms.keypresseventargs.keychar.aspx[/url]. I have set up breakpoint for keyup, keydown, keypress, and leave events, but the tab key does not set them off. I capture the enter key this way: [CODE] void textBox1_KeyPress( Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e ) { if(e->KeyChar == '\r') MessageBox::Show("enter key pressed"); } [/CODE] Thanks in advance.

Member Avatar
Member Avatar
+0 forum 2

Hey Daniweb; Ive scoured the internet for scripts that make a <div> follow the mouse, and have found one that seems to work well. However, I want the <div> to stop moving when the CTRL or the SHIFT key is pressed, I dont care which. Hopefully, I can have a div that follows the mouse at an offset that contains some click-able items, so a menu is always by your mouse. Ive tried now more than a few times to put together a piece of code that can achieve this, but none have worked. Can somebody write a script that …

Member Avatar
Member Avatar
+0 forum 1

I have no idea how to move a bitmap with the arrow keys. Here is my code [CODE] #include <windows.h> #include <tchar.h> #include <stdlib.h> #include <string.h> #include "Menu.h" #include "Icon.h" LPCTSTR ClsName = L"App"; // Class name LPCTSTR WndName = L"WindowsAPI"; // Window title HWND hwnd; // Handle to our main window //////////////////////////////////////////////////// LRESULT CALLBACK WndProcedure(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam); //////////////////////////////////////////////////// INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nCmdShow) { MSG Msg; // Structure to hold messages for our WinProc WNDCLASSEX WndClsEx; // Our WNDCLASSEX structure used to define a window // Define our window WndClsEx.cbSize …

Member Avatar
Member Avatar
+0 forum 24

Hi, I need to create a visual basic program that does all the functions of the calculator program in windows. I need to be able to make the program display the keys pressed by the user on the keypad (only the numbers 0 - 9) and it should also still be able to do the functions even though the numbers were inputted through the keypad and not through the buttons on the calculator, so far Ive been able to create all the functions except the square root and negative sign, i can do that on my own but I would …

Member Avatar
Member Avatar
-1 forum 4

Alright, I have been struggling with this for a while. I just sort of want to grasp and test out everything I have learned, but that's hard to do when they don't seem to work. Basically all I want to do is cause an event [MessageBox] when I hit a key. In this case, Enter. I think the event will be very helpful with a lot of the apps I plan on making. I have searched all over and on here and used all the examples, but nothing works. Here is what I got: (Tester is the TEXTBOX) [code=c] private …

Member Avatar
Member Avatar
+0 forum 7

i'm a little confused with the keypress thing.. this is how i write my code.. if(KEY_DOWN(VK_UP)){ // my statement ... } now what i want to achieve is, i want my statement to execute only once when i press up key. instead what happens is it keep executing till i release the key. i thought using bool might just help, but it didn't. i'm sure there's a way to get around this.. can someone help me please..

Member Avatar
Member Avatar
+0 forum 1

The End.