Delphi / Object Pascal · Exception

EInvalidOperation Exception

What does EInvalidOperation Exception mean in Delphi / Object Pascal?

Raised when an operation is attempted on a windowed control that requires a window/widget handle but the control has no valid Parent (Parent is nil), or when a drag operation is started directly from a form via BeginDrag instead of from a child control.

EInvalidOperation ExceptionDelphi (VCL)

Condition

Raised when an operation is attempted on a windowed control that requires a window/widget handle but the control has no valid Parent (Parent is nil), or when a drag operation is started directly from a form via BeginDrag instead of from a child control.

Fix

Make sure the control has been added to a parent or has its Parent property set before performing operations that require the underlying handle, and initiate BeginDrag from the actual source control rather than the owning form.

Related exception