OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 30-06-2006, 14:15
gbottesi
Guest
 
Posts: n/a
Default Get the position of the mouse

Hi people. This is the question:

Is there any posibility to get the position of the mouse as it appears in the low left corner in the status bar?

Thanks in advance.

Germán
Reply With Quote
  #2  
Old 30-06-2006, 15:30
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,791
Blog Entries: 15
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Mouse Position

Sure you can get the mouse Position of were a user clicks. This will keep looping until l you press "ESC". Also the messagebox lets you know if the shift, control or Alt key was depressed when clicked.

Code:
Sub MousePosition()

Dim x As Double, y As Double
Dim Shift As Long
Dim b As Boolean
Dim txtKey As String

b = False
txtKey = "No Key"

While Not b
    b = ActiveDocument.GetUserClick(x, y, Shift, 10, False, cdrCursorEyeDrop)
        If Not b Then
            If (Shift And 1) <> 0 Then txtKey = "Shift" ' Shift depressed
            If (Shift And 2) <> 0 Then txtKey = "Ctrl" ' Ctrl depressed
            If (Shift And 4) <> 0 Then txtKey = "Alt" ' Alt depressed
            
            MsgBox "x: " & x & " y: " & y & Chr(13) & txtKey & " was depressed"
        End If
Wend
End Sub
Hope it helps,

Shelby
Reply With Quote
  #3  
Old 17-07-2006, 10:51
gbottesi
Guest
 
Posts: n/a
Default

Thanks shelby, but I was thinking if there's a way to get the mouse position as it moves, like you can see in the lower left corner. If anybody knows, i'll appreciate the answer.
Reply With Quote
  #4  
Old 17-07-2006, 20:55
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default

Well, technically it should be possible. But you will definitely have to use Windows API.

Here is some code that can show you how to translate the current mouse coordinates into the document coordinates:

http://forum.oberonplace.com/showthread.php?t=1058
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Position inch to mm GoodLook CorelDRAW/Corel DESIGNER VBA 2 11-11-2008 00:47
Position of shape.Text.Story.Characters(10) met CorelDRAW/Corel DESIGNER VBA 3 08-12-2005 13:41
Relative position with group RichT CorelDRAW/Corel DESIGNER VBA 12 19-10-2005 15:15
remember the position of a group ivelink CorelDRAW/Corel DESIGNER VBA 7 18-10-2005 09:14
Getting the mouse position Rick Randall CorelDRAW/Corel DESIGNER VBA 1 04-12-2002 09:29


All times are GMT -5. The time now is 12:57.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com