I would like to add to my component the conditional state when the component cannot be loaded and inform its user (developer) that this component cannot be loaded in design time and target user at runtime (safely somehow, if possible).
How can I prevent the component from loading in its constructor and how to display message (exception) from constructor safely at design time and at runtime ?
constructor TSomeComponent.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
if csDesigning in ComponentState then
if SomeIncompatibleCondition then
begin
// how to display message (exception) about the wrong
// condition and interrupt the loading of the component ?
end;
// is it possible to do the same at runtime ?
end;
Thank you
Raise an exception, eg: