Results 1 to 4 of 4

Thread: Textbox dimensions

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Columbus Ohio
    Posts
    217

    Lightbulb

    Does anyone know how to get the x,y value of the current cursor position in a textbox? Preferably with a small api, but any method would be appreciated. Thanks
    Chris

    chrisderson@ameritech.net
    Windows XP RC2 B2526
    Visual Studio.Net Beta 2
    C++, VB, VB.Net, ASP, PHP

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Code:
    Ibeam = Text1.SelStart
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    hmm... the X and the Y you ask?

    Have you tried this?

    Code:
    Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Text1.Text = X & " & " & Y
    End Sub
    oh and for the api to get the screen coordinates

    Code:
    Option Explicit
    Private Type POINTAPI
        X As Long
        Y As Long
    End Type
    Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    
    Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim Pnt As POINTAPI
    GetCursorPos Pnt
    Text1.Text = Pnt.X & " & " & Pnt.Y
    End Sub
    In the first code x = 0 when the mouse is at the left of the textbox, in the second code x = 0 when the mouse is at the left of the screen.

    Have fun!

    [Edited by Jop on 10-20-2000 at 06:22 PM]
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Columbus Ohio
    Posts
    217

    I meant

    Jop i meant the x and y of the blinking cursor, not the mouse
    Chris

    chrisderson@ameritech.net
    Windows XP RC2 B2526
    Visual Studio.Net Beta 2
    C++, VB, VB.Net, ASP, PHP

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