Search code examples
delphifiredac

TFDGUIxWaitCursor in formless application


The error I become is:

Object factory for class {3E9B315B-F456-4175-A864-B2573C4A2201} is missing. To register it, you can drop component [TFDGUIxWaitCursor] into your project

Well, I would like to do it if I did not have a VCL-less (not console) application ...

There is just a "script" in DPR file and that's it.

Following does not help:

wCur := TFDGUIxWaitCursor.Create(nil);
conn := TFDConnection.Create(nil);
try
  .....
  conn.Connected := True;
  conn.ExecSQL('blah blah blah');
  conn.Connected := False;
finally
  conn.Free();
  wCur.Free();
end;

Solution

  • There is no need to create TFDGUIxWaitCursor explicitly.

    In your case it is enough to include FireDAC.VCLUI.Wait in uses clause of your project file. All the neccessary initializations and finalizations are performed in initialization and finalization sections of this unit.

    The concept of a wait cursor is abstracted in FireDAC (with the interface IFDGUIxWaitCursor) to work within FireMonkey, VCL and console applications. Therefore there exists different implementation for each kind in different units. Depending on your app-type, you have to choose the appropriate implementation. The designer usually add the right one if you drop a FireDAC component onto a form, frame or datamodule.

    • Console: FireDAC.ConsoleUI.Wait
    • FMX: FireDAC.FMXUI.Wait
    • VCL: FireDAC.VCLUI.Wait