Results 1 to 4 of 4

Thread: [Resolved by krtxmrtz] MouseMove over right hand edge of textbox.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2004
    Posts
    308

    Resolved [Resolved by krtxmrtz] MouseMove over right hand edge of textbox.

    Hi,

    I've an annoyance that perhaps you can help with ?

    I want to know when the mouse is over the right hand edge of a control (nominally a text box). The left and width are pixels while value is in TWIPS (or vice-versa). Anyone got a suggestion ? I need to use the mousemove to change the mousepointer and to enable the user to stretch the textbox.

    Thanks in advance.

    Chubby..
    Last edited by Chubby; Aug 3rd, 2005 at 05:33 AM.

  2. #2
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: MouseMove over right hand edge of textbox.

    Quote Originally Posted by Chubby
    Hi,

    I've an annoyance that perhaps you can help with ?

    I want to know when the mouse is over the right hand edge of a control (nominally a text box). The left and width are pixels while value is in TWIPS (or vice-versa). Anyone got a suggestion ? I need to use the mousemove to change the mousepointer and to enable the user to stretch the textbox.

    Thanks in advance.

    Chubby..
    I have found this code for manually resizing it horizontally (place a textbox named Text1 in a form):
    VB Code:
    1. Dim EnableResizing As Boolean
    2. Dim Tp As Single
    3. Private Sub Form_Load()
    4.     EnableResizing = False
    5.     Tp = Text1.Top
    6. End Sub
    7.  
    8. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    9.     If MousePointer = 9 Then
    10.         EnableResizing = True
    11.     End If
    12. End Sub
    13.  
    14. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    15.     If Y < Tp + Text1.Height And Y > Tp And (Abs(X - Text1.Left) < 120 Or Abs(X - Text1.Left - Text1.Width) < 120) Then
    16.             MousePointer = 9
    17.     Else
    18.             MousePointer = 0
    19.     End If
    20.     If EnableResizing Then
    21.         If Abs(X - Text1.Left) < 120 Then
    22.             Text1.Move X, Tp, Text1.Width - X + Text1.Left, Text1.Height
    23.         ElseIf Abs(X - Text1.Left - Text1.Width) < 120 Then
    24.             Text1.Move Text1.Left, Tp, X - Text1.Left, Text1.Height
    25.         End If
    26.     End If
    27. End Sub
    28.  
    29. Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    30.     EnableResizing = False
    31. End Sub
    32. Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    33.     If Y < Text1.Height And Y > 0 And (X < 120 Or Text1.Width - X < 120) Then
    34.             MousePointer = 9
    35.     Else
    36.             MousePointer = 0
    37.     End If
    38. End Sub
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2004
    Posts
    308

    Resolved Re: MouseMove over right hand edge of textbox.

    krtxmrtz,

    Your time and effort is most appreciated. The code you posted up, found or-not works a treat and is exactly what I'm looking for.

    Thanks very much.


    Chubby..

  4. #4
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: MouseMove over right hand edge of textbox.

    Quote Originally Posted by Chubby
    krtxmrtz,

    Your time and effort is most appreciated. The code you posted up, found or-not works a treat and is exactly what I'm looking for.

    Thanks very much.


    Chubby..
    You're most welcome.

    Fortunately I had already worked on this some time ago and all I had to do was pull it back from my data bank.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

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