Results 1 to 3 of 3

Thread: Mouse inactivation

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Location
    South Africa
    Posts
    8

    Question 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 !!

  2. #2
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    Hi
    Can't u just call the calculation subroutine from the Validate event of the textbox?
    Regards
    Stuart
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

  3. #3
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    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 LonglpRect As RECT)
    Private Declare 
    Sub ClientToScreen Lib "user32" (ByVal hWnd As LonglpPoint As POINT)
    Private Declare 
    Sub OffsetRect Lib "user32" (lpRect As RECTByVal x As LongByVal 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
    .hWndClient
        upperleft
    .Client.left
        upperleft
    .Client.top
        
    'Convert window coördinates to screen coördinates
        ClientToScreen Me.hWnd, upperleft
        '
    move our rectangle
        OffsetRect Client
    upperleft.xupperleft.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
  •  



Click Here to Expand Forum to Full Width