Syntax
X.d = PathGetCursorX()Description
Retrieves the current horizontal coordinate (X position) of the path cursor within the active drawing context. This is the endpoint of the last path segment added (PathAddLine(), PathAddCurve(), PathAddArc()) or the point set by the last PathMoveTo().
Parameters
This command takes no parameters.
Return Value
Returns the current horizontal path cursor position in
device-independent pixels (DIPs) as a floating-point number (Double).
Returns 0.0 or #False if called outside a BeginDraw() / EndDraw() block or before any path commands have
been issued.
Remarks
This function is useful for determining the current position when building complex paths, especially when using relative coordinates or needing to connect subsequent path segments precisely.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
Procedure DrawHandler(Window, EventType, *EventData.PG_EventDraw, *UserData)
DrawClear(RGB(255, 255, 255), 1)
DrawSetStroke(2, #PG_Stroke_Center)
PathMoveTo(20, 50)
PathAddLine(120, 50)
CurrentX.d = PathGetCursorX()
CurrentY.d = PathGetCursorY()
Debug "Path cursor after line: X=" + StrD(CurrentX) + ", Y=" + StrD(CurrentY) ; Should be 120, 50
; Add a curve starting from the current position
PathAddCurve(CurrentX + 30, CurrentY - 40, CurrentX + 70, CurrentY + 40, CurrentX + 100, CurrentY)
CurrentX.d = PathGetCursorX()
CurrentY.d = PathGetCursorY()
Debug "Path cursor after curve: X=" + StrD(CurrentX) + ", Y=" + StrD(CurrentY) ; Should be 220, 50
DrawPathStroke(RGB(0, 100, 0))
DrawSetStroke(1)
EndProcedure
MyWindow = CreateWindow(0, 0, 250, 100, "Path Cursor Example")
If MyWindow
AddEventHandler(MyWindow, #PG_Event_Draw, @DrawHandler())
WindowShow(MyWindow, #True, #PG_WindowShow_ScreenCentered)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
StopProGUI()See Also
PathGetCursorY, PathMoveTo, PathAddLine, PathAddCurve, PathAddArc, BeginDraw, EndDraw
Supported OS
Windows (Direct2D only), Linux (Cairo only)