SPONSORS:






User Tag List

Results 1 to 8 of 8
  1. #1
    Junior Member
    Join Date
    Feb 2000
    Location
    Nottingham, England
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mouse Co-ordinates

    I am testing a windows application and have selected an item in a listbox. I then need to drag that item to a different listbox. The problem is I can't find how to obtain the mouse co-ordinates for the drag as the recorder doesn't pull these back. The co-ordinates will not be the same everytime so I need to get the location of the selected item before I drag it to a different listbox.

    I have looked for a GetLocation () type of command but can't find one, is there any way that I can obtain the co-ordinates before I begin my drag.

    ------------------

  2. #2
    Senior Member
    Join Date
    Nov 1999
    Location
    Eagle, ID,USA
    Posts
    1,035
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mouse Co-ordinates

    When you do the select, can you not use GetPosition() to get the cursor position and then use GetRect to get the coodinates of the control you want to drag to?

    ------------------
    Have you ever noticed? Anybody going slower than you is an idiot, and anyone going faster than you is a maniac.

  3. #3
    Junior Member
    Join Date
    Feb 2000
    Location
    Nottingham, England
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mouse Co-ordinates

    I've thought about this, but this isn't working as GetPosition () isn't working on the specified listbox. I am just getting an error when compiling saying that the function GetPosition is not defined...

    ------------------

  4. #4
    Senior Member
    Join Date
    Nov 1999
    Location
    Eagle, ID,USA
    Posts
    1,035
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mouse Co-ordinates

    Are you calling Cursor.GetPosition() or ListBox.GetPosition(). Should be Cursor.GetPosition();

    ------------------
    Have you ever noticed? Anybody going slower than you is an idiot, and anyone going faster than you is a maniac.

  5. #5
    Guest

    Re: Mouse Co-ordinates

    Have you tried using the BeginDrag or EndDrag methods? Supposedly by using these you can specify an identifiable object such as the folder name, thereby eliminating having to use co-ordinates at all. The only caveat with using these methods is that they can only be used on a listview, treeview or list box. Look in the help files for more information.

    ------------------

  6. #6
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mouse Co-ordinates

    ... and there must be something in the target list or tree to end your drag "on." Otherwise you have to get a RECT on the target and end your drag inside that rect.

    ------------------

    BTW, you do that latter method with EndDragAt()

    [This message has been edited by DJGray (edited 08-01-2002).]

  7. #7
    Senior Member
    Join Date
    Jul 1999
    Location
    Burlingame CA 94010
    Posts
    502
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mouse Co-ordinates

    This is a difficult one to solve.

    In the past, I've had to figure out the number of pixels between rows, the location of the first row, then the position of the desired item in the list. This information allows you to figure out where to start the Drag/Drop operation.

    Hope this helps.


    ------------------
    John W Green
    jwgreen@automationexpertise.com
    http://www.automationexpertise.com

  8. #8
    Junior Member
    Join Date
    Feb 2000
    Location
    Nottingham, England
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mouse Co-ordinates

    Cheers John - This is what I have had to do and I am now able to drap and drop successfully.

    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:25 AM.

Copyright BetaSoft Inc.