API Documentation > CorelDRAW > 2025-v26 > Document > IVGDocument
Document.GetUserClick method
Allows a user to click in the document, and returns the x,y coordinate and information about the state of the modifier CTRL, ALT and SHIFT keys at the time of the click
Syntax:
Function GetUserClick(ByRef x As Double, ByRef y As Double, ByRef ShiftState As Long, ByVal TimeOut As Long, ByVal Snap As Boolean, ByVal CursorShape As cdrCursorShape) As Long
Parameters:
Name Type Description
x
Double
y
Double
ShiftState
Long
TimeOut
Long
Snap
Boolean
CursorShape
Remarks:
The GetUserClick method allows the user to specify a point in the document window and return the coordinates of that point back to script. It also retrieves information about the state of the Ctrl, Shift, and Alt keys at the time of the click.
Examples:
The following VBA example retrieves the coordinates of the point where the user clicks and draws a circle at that point. The circle fill depends on the modifier key state. If the Shift is pressed while the user clicked, red is applied. If Ctrl is pressed, green is added. If Alt is pressed, blue is applied. Therefore, pressing Ctrl + Shift + Alt produces a yellow circle. The macro loops until the user presses Esc to abort the procedure or time out interval of ten seconds elapses.
Sub Test()
Dim x As Double, y As Double
Dim Shift As Long
Dim b As Boolean
Dim s As Shape
Dim cr As Long, cg As Long, cb As Long
b = False
While Not b
  b = ActiveDocument.GetUserClick(x, y, Shift, 10, False, cdrCursorEyeDrop)
  If Not b Then

 Set s = ActiveLayer.CreateEllipse(x - 0.1, y - 0.1, x + 0.1, y + 0.1)

 cr = 0

 cg = 0

 cb = 0

 If (Shift And 1) <> 0 Then cr = 255 ' Shift depressed - Add Red


If (Shift And 2) <> 0 Then cg = 255 ' Ctrl depressed - Add Green


  If (Shift And 4) <> 0 Then cb = 255 ' Alt depressed - Add Blue



 s.Fill.UniformColor.RGBAssign cr, cg, cb


  End If


Wend

 
End Sub