Results 1 to 9 of 9

Thread: Placing a floating list box over a text box [Resolved]

  1. #1

    Thread Starter
    Fanatic Member sbasak's Avatar
    Join Date
    Aug 2001
    Location
    Globe Trotter
    Posts
    524

    Placing a floating list box over a text box [Resolved]

    I'm trying to write a word completion program. For that, I have to place a floating listbox over a text box. The list box should move as the user types in text box.

    I can't figure out how to get the current text (where the cursor is) x,y co-ordinates from a textbox.

    I know that in VB6 it would have been solved by SendMessage API but I've no idea how to do it in VB.NET.

    I tried to call the same API in .NET as well, but unsuccessful

    Any help?

    thanx
    Last edited by sbasak; Jun 1st, 2003 at 07:56 AM.
    Life is a one way journey, not a destination. Travel it with a smile and never regret anything.
    Yesterday is history, tomorrow is a mystery, today is gift - that's why we call it present.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    SndMessage API is still a way to do it , though there is a lengthy way I guess in .NET .Try this demo I've created with API call SendMessage .
    Attached Files Attached Files

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Just to point out , the proj is VB.NET 2003 .

  4. #4

    Thread Starter
    Fanatic Member sbasak's Avatar
    Join Date
    Aug 2001
    Location
    Globe Trotter
    Posts
    524
    Thanx, but I tried with SendMessge, problem is it's neither giving error nor doing the thing I want - ie. it can't return the co-ordinate where my cursor is in my text box
    Life is a one way journey, not a destination. Travel it with a smile and never regret anything.
    Yesterday is history, tomorrow is a mystery, today is gift - that's why we call it present.

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    You can use this to get cursor posititon :
    VB Code:
    1. Me.Cursor.Position.X()
    2. Me.Cursor.Position.Y()

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    aah by the way , put that code in a timer and set its interval to 10ms to get updated very fast .

  7. #7

    Thread Starter
    Fanatic Member sbasak's Avatar
    Join Date
    Aug 2001
    Location
    Globe Trotter
    Posts
    524
    Me.Cursor.Position.X() gives position where the mouse pointer is! But I want the position my text cursor blinks in the textbox [perhaps some people say it as caret position].
    Life is a one way journey, not a destination. Travel it with a smile and never regret anything.
    Yesterday is history, tomorrow is a mystery, today is gift - that's why we call it present.

  8. #8

    Thread Starter
    Fanatic Member sbasak's Avatar
    Join Date
    Aug 2001
    Location
    Globe Trotter
    Posts
    524
    Lastly, it worked with senemessage API.

    THANKS for help
    Life is a one way journey, not a destination. Travel it with a smile and never regret anything.
    Yesterday is history, tomorrow is a mystery, today is gift - that's why we call it present.

  9. #9
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by sbasak
    Me.Cursor.Position.X() gives position where the mouse pointer is! But I want the position my text cursor blinks in the textbox [perhaps some people say it as caret position].
    Thought you are trying to retrieve the text where the cursor is over . Anyways , glad you got to work .

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