See Related Forum Messages: Follow the Links Below to View Complete Thread
Moving Mouse By Cursor Keys
Hello VB cracks,
I've encountered a problem while implementing code for moving the mouse by pressing cursor keys. I've done the follwing:
1.) Get the current mouse position with GetCursorPos
2.) Transform the screen coordinates into window coordinates with ScreenToClient
3.) Manipulate the position by adding/subtracting a little to the x- or y-coordinate
4.) Transform the (manipulted) position back to screen coordinates with ClientToScreen
5.) Set the new cursorpos with SetCursorPos
This works very fine but there is a small ugly thing. The value I add/subtract from the cursor position is either too big, so the cursor jumps not very precise or the value is too small, so the cursor is very slow.
Now my idea: The longer you press the key the quicker the mouse move. But I don't know how to do this. There is the point where I need your help. Does anybody have some cool code to do this ? I hope so.
Best regards
Michael Hartmann
Stop The Arrow Keys From Changeing Focus
is there any way that i can stop the arrow keys from changing the focuse of a control on the from. Im trying to make a from where the user can customize his game controls. he does this by holding the key while clicking a command button, but if hes holding the arrow keys the command button does not ever call the click event. I think stoping thoes keys from changeing the focus will make it work.
thank you
Cursor Keys
Is it possible to capture the cursor keystrokes for a form and have them control the focus of textboxes through text1.setfocus ?
Thanks for your help
PS
Trapping Cursor Keys
I dont think it is possible to trap the cursor keys being pressed if you arent in a listbox or similar.
A form with a single command button cannot trap the cursor keys. Am I right or am i wrong?
Help With Moving Cursor
Hey, I'm kinda new but still aspiring Just got VB from my dad (old copy...) and I'm trying to do some cool stuff w/ it
what i'm looking to do is make a program, which when run, with wait "123456" seconds/min, then move the cursor to coordinate (X,Y) on the screen, then 'click', and move again to new coordinates (X,Y) and click again, then close itself.
if anyone can point out any tips, references, or directions, that would be great. It would be even better if you could make a program for me, which I could then edit to my tastes...thanks!
note: i have VB 4, so there might be some compatability issues when i try to edit
note: this is for my own personal use, not commercial, so don't worry about me being a script kiddie
- Cursor Moving
I know how to do the SetCursorPos now. But how would I make the cursor move from it's current position to like plus so many pixels.. So.. Let's say the mouse is at 50, 50. How can I make it move down the Y, let's say 10 pixels, to where the cursor is at. This is kind of hard to explain. :S Simple.. But I'm bad at explaining. :P
And I can't just define the place to move the mouse.. So I need it to SetCursorPos currentx, currenty +10, for example. :S
Cool, I just noticed the GetCursorPos, and I used that to get the current x,y and just do something like mousepotition.y + 10.
Edited by - Do the hokey pokey on 9/17/2004 7:18:34 PM
Stop Txt Moving
can any1 tell me how u stop txt that is in side a pic box moving ever thing u click in the box
Cursor Keys Not Working On Design
hi all,
Know that this should go to ms support, but they really take a lot to find the problem, so i'm guessing whether somebody has had this problem.
For some kind of reason when I insert an ocx in an app (own ocx), and without even running the app, hapens that after some random time the cursor keys do not work anymore, so I have to edit the code going up and down with the mouse and so on. It seems the object properties (no matter the object, it can be a textbox control) has the focus, so when I try to move with the cursors it just goes all over the actual object properties up and down.
again, this should go to ms support, just guessing if anybody has had the same problem.
I am on vb6 sp5
Ps: I guess it does not have anything to do with my ocx because I do not even execute the app.
Trapping Cursor Keys In Listbox
I have a question regarding trapping cursor keys in listboxes and ignoring their action in some cirmumstances.
Is it possible to detect a left arrow press (I can do this) but stop the highlighted line moving up a line or to detect a right arrow press (I can do this too!) but stop the highlighted line moving down a line?
By default the left arrow moves a line UP a listbox and a right arrow moves a line DOWN. I want to stop this happening.
Any help would be fandabidozy.
Cheers in advance
Help Me Navigate TxTextControl V5.0 With Cursor Keys
Hi.
I`m using the Tx Text Control, version 5.0, and i`m previewing a HTML file. I just cant seem to be able to scroll around the document with the cursor keys, although page up/down work ok.
Does anyone have any experience with this control? Or is there perhaps a generic way to call a controls scrollbars from within visual basic. I can handle reading the keyboard ok, i just dont know what to call to simulate a scroll bar drag.
Failing that, how would you go about displaying an html file from within visual basic, and scroll around it?
Thanks,
Alex.
Stop User Using Arrow Keys
How do I stop the user from being able to use the arrow keys on a combo box?
Would I have to capture the keypress in the combo box somewhere?
Edited by - andy99 on 9/26/2003 5:46:54 AM
**RESOLVED**Stop The Darn Blinking Cursor!!!!
Please, can someone please show me how I can stop a cursor from appearing in a textbox?
I have a few textboxes on a form, and all I want is for the user to view them, they are all ready locked...but when the form is opened the cursor automatically goes to the first tab stop....this happens even if I take all the tab stops off....
Please help!
Thank you.
Cursor Focus?
Ok I am having a problem, I have 2 text boxes and one button and when I click the button I want it to input some text in the textbox that has the cursor flashing in it.
Any Help Would Be Great Thanks
Smootly Moving The Cursor
I need to know how to show a smootly moving mouse cursor without actually moving the mouse. I know you can use the SetCursorPos API but it just zips the cursor directly where you want it to go.
I was thinking I could set up some fast moving SetCursorPos calls, but i'm not good with the physics of making it move say...in a parbola, zig zag, randomness, or getting it to land on what i want it to land on.
help will be appreciated.
Moving A Text Cursor...
Hi,
Another (hopefully simple!) problem here - I hava a text box with a lot of text in. How can I position the text cursor at the bottom of the text.?
Many thanks!
Mark-R
Moving Cursor To Last(new) Row In Datagrid
on my form i have textboxes and a datagrid, each column in the datagrid relating to each of the texboxes on the form. When i click the "new" command button, i am blanking out the text in the textboxes to allow for new entry. I also want the cursor in the datagrid to point to a new row (record) (i have set the property of the datagrid to AllowAddNew), how do i do this?
Thanks in advance!
Moving Cursor On FlexiGrid
Hi Guys
Beleive me or not,this Extreme Forum help millions of our beloved daughters and sons of this beutiful world,Programmers, the MOTHERBOARD OF the World Information.
Guys here is my fustration: through other comrade's assistance,I have my FlexiGrid Highlighting the column I entered,So now I want my Highlighting background to move with my cursor as I brows through FlexiGrid,when i scroll down or up.
thanx
Tman
Moving The Cursor To The End Of A Texbox
Hi,
I have a textbox that has the multiline at true
When I click on a button it put a word in the textbox, but
my problem is when I have 30 words it is larger than the textbox and I dont,t see the last word I added in the textbox at the end, so what I would like is that when I add a word, that I see the last word I added at the end in the textbox and not the frist word at the beginning.
thanks
David
Moving Cursor 1 Pixel
Hi i dont know how to do this. I tried setcursorpos and making variables like x and y and then increase x and y. but i dont want to move the cursor like that, it does something chaotic. I just want it to move it one pixel right, or up, etc. Instead of giving it position all the time. is it possible ?
Moving Cursor Within A Combo Box
Hello. I have a VB6 app that, when a user opens a form the focus is on a drop-down. If they hit the space bar (an invalid entry) it slaps their hand with a message box and makes them re-enter. The only problem is that once the message box closes the cursor is in the second position within the combo box. I'm still looking, but I'm not finding how to reset the cursor to the first position.
Thanks!
Ed
Moving Cursor To Next Text Box
I have two text boxes on a form.
I want to be able to type 6 characters in the first text box and press enter. Then the cursor should move to the next text box.
I'm sure there is a simple way to do this but I just cant seem to get it working.
Any help would be much appreciated.
Moving The Mouse Cursor
this has prolly been asked a bazillion times, but what is the simplest what to move the mouse cursor (dont be a smarta$$ and say use the mouse) :P
Moving The Mouse Cursor
this has prolly been asked a bazillion times, but what is the simplest what to move the mouse cursor (dont be a smarta$$ and say use the mouse) :P
Moving Cursor Using VB Program
Hi every one... i think we can access all the resources in d system using VB. Can any one tell me hw we can move the cursor using VB code.... i.e when ever i press a command button the cursor should automatically move to the specified locations on the screen.... thanks in advance...
Moving Cursor In A TextBox
Hi everybody!
I'm trying to write an "On screen keyboard" for an application I have to delelop.
Using buttons I can easly modify the text property of a TextBox control (Text1) writing whatever I want.
I can also start a new line with the code line "Text1.text = Text1.text & vbCrLf" but I cannot move the cursor one char left or right through the string using the Chr(26) or Chr(27)!
If I try "Text1.text = Text1.text & Chr(26)" a non printable char is displayed and the cursor shifts always right .
I would like simply to simulate the arrow keys...
Can anybody help me?
Thanks
maru
Moving Cursor In Text Box
I have a text box in a form. I would like to enter a prefix code (two letters) into the text box, move the cursor to the end of the 2 letters in the text box, and allow the user to finish the entry from there.
How do I move the cursor in the text box to the end of the 2 letters?
Thanks in advance.
Dave Sharp
Moving The Mouse Cursor
I have to bother you again but this time with a different question.
I would like to know what to do i order to move the mouse cursor on the screen without physically touching the mouse. For instance, I would like my application to move the mouse cursor from time to time one inch to the left, and then one inch back to the right again.
Does anybody know if this is considered by the system as if you are physically moving the mouse and, for instance, is preventing the screen saver from launching?
Any ideas would be appreciated.
Thank you for your time, God bless.
Vio
Vio
Pic Box, Object To Stop Moving
what im trying to do is make it so that i have one bit picture box and a pong design interface inside it(this is a final assignment im making a variation of pong) anywho what im trying to do(and tryed everything i've thought of) is to get it so that when you drag the padel down it cannot pass the line at the top or the bottom, and both these lines are drawn, not made at runtime. thanks for help
also after you hit the line you cannot go down or up further then the line, and you can continue moving inside the two lines
Trying To Stop A Form Moving
hi, i am making a program that has docking forms onto the main mdi form. I am trying to make it so that the forms can be docked and undocked. I have so far made a timer that keeps a form in its position all the time but when the user tries to drag the form it flashes and such and then returns to the position wheras i don't want it to move at all, is there any way i can subclass it to stop it moving?
Cursor Keys Don't Work With CreateWindow In UserControl
i am trying to create a control in a usercontrol using createwindow but can't get the cursor keys or tab order to work. this is basically the code i am using. when you run the control and click into the text box the cursor keys do nothing.
Private Sub UserControl_Initialize()
Dim hWndTextBox As Long
Dim lngStyle As Long
'Create the Edit Control
lngStyle = WS_CHILDWINDOW
lngStyle = lngStyle Or WS_VISIBLE
lngStyle = lngStyle Or WS_TABSTOP
lngStyle = lngStyle Or ES_AUTOHSCROLL
hWndTextBox = CreateWindowEx(0, "EDIT", "Mike's Edit Control", lngStyle, 0, 0, 100, 100, UserControl.hwnd, 0, App.hInstance, 0)
End Sub
Stop Auto Key Repeat On Held Keys?
Hi, I've been looking everywhere for this.
I wish to stop keys from auto repeating while being held down in my application. I have searched and searched and found a couple of similar topics, but I can't seem to find the answer. If anybody can help that would be great!
Thanks heaps!
Jenna12
Stop Cursor Change On Form Edges *RESOLVED*
I'm using RemoveMenu to create forms that can be minimized but not resized/maximized. That takes the resize/maximize options from the system menu and stops resizing, but the cursor still changes to an east/west cursor when on the edges of the form. How can I stop the cursor from changing?
Moving A Shape With Keys ?
I want to move a (circle) Shape1 with keys, (up, right, etc). Here is my code that isn't working:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyDown
Case 37 'Left arrow
Shape1.Left = Shape1.Left - 40
Case 38 'Up arrow
Shape1.Top = Shape1.Top - 40
Case 39 'Right arrow
Shape1.Left = Shape1.Left + 40
Case 40 'Down arrow
Shape1.Top = Shape1.Top + 40
End Select
End Sub
Can someone tell me what the problem is ?
fogless.
Get Keys With Out Focus
Hey i was wonder how you could get the keys you type with out the focus on the program for example a game trainer!
Moving Objects To The Mouse Cursor?
I am making a diablo style RPG and I need to implement a mouse system like diablo where you click somewhere and your character will move towards it.
All I need to know tho is how to make objects move to the mouse cursor position.
And I was also wondering how I can use the arrow keys on the keyboard to make them do commands.
Prevent Cursor In Textbox From Moving
like in the thread title,
is there anyways to prevent the cursor from shifting or moving within a textbox??
for example, i press right or left arrow buttons for some reasons, but i do not want to move the cursor in the textbox that is used for input....maybe it is preferable to maintain the cursor at the end of the string that the user typed or backspace.
Moving Cursor To Next Textbox Automatically
I have 8 small textboxes with a maxlength of 1, and I want to make it so when somebody types a character in one of the boxes it automatically moves the cursor to the next box without the user having to press tab or manually click the next box.
Is there an easy way to do this?
Moving A Mouse Cursor Remotely
8 years ago, back when I was learning VB for the first time in highschool, one of the students in the class was messing around with API's, and managed to move my mouse around from another computer! I thought my computer was possesed or something.
Out of curiousity, I would like to see how it was done. It has boggled my mind for years. Thanks in advance.
Moving The Textbox Cursor To The End Of All Text
hello,
i'm making am update client for an online journal website. the website supports bbcode, so in the app i've made buttons like Bold, Italic, Underline, etc...so when you click the button it prints either an opening tag or a closing tag . but when you click the button it and set the focus on the textbox again the cursor in the textbox moves to the beginning.
Code:
Tag$ = "[b]"
txtBody.Text = txtBody.Text + Tag$
txtBody.SetFocus
i know there is a way to keep the cursor at the end of the textbox i just don't know how. could anyone help me out?
thanks
-Dustin
How Can You Move The Cursor W/out Moving The Mouse?
HI,
I have tried using SetCursorPos to adjust the position of the cursor on screen, without the mouse, but I want it to adjust the cursor position relative to something else. E.g. :
FirstMousePosition.X - 10
Where 10 represents an `x` co-ordinate.
Is it possible to do this?
Any Info
Thanks
Mark
Moving Mouse Cursor With Code
I am trying to make the mouse cursor move by using code so that the cursor will move by itself at set intervals. Any ideas would be great.
Finding Cursor Focus
Greetings to All!
I have a form with 2 combo boxes (CBOEmpNo, CBODeptNo) and few other controls.
I have a Search Button, that need to search on Emp Number, if CBOEmpNo has a value. Similarly, I am searching on Dept Numbers, if there is a value on CBODeptNo.
Now, if value exists in both the fields, I need to search based on the position where the cursor is? How do I find in which field the the cursor is located on my form?
Or is there any other logical way to handle?
Thanks and Regards,
Venkat.
Detect Cursor Without Focus
I want the user to be able to click on butons to build a string in a text box, but I also want to know where the cursor is in the text box. The problem is that the text box loses focus when the user clicks on the list box with the items to build the string. So if I have a test to see if the cursor is even in the list box I get an error.
Without a HasFocus property is there a way I can test without using the Setfocus (which resets the Selstart to 0)?
Scott
The worst thing about wearing glasses is them being on your face.
Nothing is impossible, it just looks that way.
How Do I Make A Shape Stop Moving?
I have a shape(Shape1) that you can move with the arrow keys....how do i make the Shape1 cease to move when a certain event happens, even though the arrow keys are still pressed?
thanks for any help!
ListView - Stop Icons Moving
Hi,
I'm using a listview control in the Icon mode, to display a control panel for my application. The only problem is that when a user clicks an icon, when you move the mouse it moves the icon as well.
Is there any way to stop the user moving the icon?
Stop Maximized Form From Moving
I am using a picturebox as a container to act as a mdiparent because only 1 midparent is allowed when I need 2. When I maximize a "child" form, the title bar is still visible which enable the user to move the max form. I get an error when I set moveable=false during runtime. Is there any way to stop the maxed form from moving? Thanks.
How Do I Stop Flickering In Moving Graphics?
I haven't dealt with graphics in vb before, but I know of a common graphics method to reduce/eliminate flicker in animations called double-buffering.
The flicker is caused from clearing the old frame before drawing the new one. To counter this problem you actually would have 2 picture boxes (or whatever you're using) the first one is the visible one that will display the animation. On the second buffer, you do the calculations for the next frame and place all the objects there, then once the frame is ready for display you change the image on the visible buffer to that of the second buffer.
Since I haven't done this in vb before I'm not to helpful in the code department, but hopefully you'll find this method usefull.
Trying To Stop Moving Past Last Record
I am writing a database with a number of tables with forms atttached to each table. I have placed navigation buttons on each form to move to first, last, next, previous. I have set up the code associated with the buttons as "public sub" so it is available for each form to use.
This was working OK except that when I used the NEXT button at the last record it would open a new blank record & keep opening a new blnak record on each click.
To over overcome this I put in an If statement to check if it had moved to a new record. To do this I used the following:
If Me!NewRecord Then ..... etc
Now I get an error "Invalid use of Me key word" I suspect it is because I am using ME in a public sub
How do I overcome the problem of moving passed the last record and still have the coding available to all forms?
The Code is below.
Thnaks for any help.
Public Sub Next_Record_Click()
On Error GoTo Err_Next_Record_Click
DoCmd.GoToRecord , , acNext
If Me!NewRecord Then
' If new record move back to previous
DoCmd.GoToRecord , , acNext
' Send message
MsgBox "This is the last record", , "No More Records"
End If
Exit_Next_Record_Click:
Exit Sub
Err_Next_Record_Click:
MsgBox Err.Description
Resume Exit_Next_Record_Click
End Sub
|