|
-
Nov 11th, 2001, 06:19 AM
#1
Thread Starter
New Member
Mouse inactivation
please help !
When a user enters data into a text box, on "enter"Key being pressed, calculations are carried out. How do we stop the user from being able to use a mouse button to go to another text box without first hitting enter, and therefore bypassing the calculation which will need to be done with the data he has just entered into the text field.
Your help would be greatly appreciated !!
-
Nov 11th, 2001, 06:33 AM
#2
PowerPoster
Hi
Can't u just call the calculation subroutine from the Validate event of the textbox?
Regards
Stuart
-
Nov 11th, 2001, 08:59 AM
#3
Fanatic Member
I think this will do it:
PHP Code:
Private Type RECT
left As Long
top As Long
right As Long
bottom As Long
End Type
Private Type POINT
x As Long
y As Long
End Type
Private Declare Sub ClipCursor Lib "user32" (lpRect As Any)
Private Declare Sub GetClientRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT)
Private Declare Sub ClientToScreen Lib "user32" (ByVal hWnd As Long, lpPoint As POINT)
Private Declare Sub OffsetRect Lib "user32" (lpRect As RECT, ByVal x As Long, ByVal y As Long)
Private Sub Form_Load()
Command1.Caption = "Limit Cursor Movement"
Command2.Caption = "Release Limit"
Command3.Caption = "No mouse input!"
End Sub
Private Sub Command1_Click()
'Limits the Cursor movement to within the form.
Dim Client As RECT
Dim upperleft As POINT
'Get information about our wndow
GetClientRect Me.hWnd, Client
upperleft.x = Client.left
upperleft.y = Client.top
'Convert window coördinates to screen coördinates
ClientToScreen Me.hWnd, upperleft
'move our rectangle
OffsetRect Client, upperleft.x, upperleft.y
'limit the cursor movement
ClipCursor Client
End Sub
Private Sub Command2_Click()
'Releases the cursor limits
ClipCursor ByVal 0&
End Sub
Private Sub Command3_Click()
'Disables the mouse input. Use the arrow keys or Tab instead...
Dim Client As RECT
Client.left = 0
Client.top = 0
Client.right = 0
Client.bottom = 0
ClipCursor Client
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Releases the cursor limits
ClipCursor ByVal 0&
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|