I have grid control on form and when current record change i need to load RTF stored in DB. It works fine in general, but when i switch records i can see changes of mouse cursor to hourglass and back to regular:
function TComments.GetDocument(AID: integer; ADst: TStream):Boolean;
begin
try
SelectQuery.Close;
SelectQuery.Params.Clear;
SelectQuery.SQL.Text :=
'SELECT Dokument from Kommentarer ' +
'WHERE ID = :ID';
SelectQuery.ParamByName('ID').AsInteger := AID;
SelectQuery.Open;
Result := SelectQuery.RecordCount > 0;
if Result then
(SelectQuery.Fields[0] as TBLOBField).SaveToStream(ADst);
finally
SelectQuery.Close;
end;
end;
If i comment "SelectQuery.Open;" then cursor doesn't switch. I supposed there should be option in TFDQuery (or connection), but i can't find anything. Any help?
UPDATE. As TLama suggested, i placed WaitCursor:TFDGUIxWaitCursor at my form (one place for app) and use it this way:
StoredCursor := WaitCursor.ScreenCursor;
WaitCursor.ScreenCursor := gcrNone;
try
// access DB with queries
finally
WaitCursor.ScreenCursor := StoredCursor;
end;
UPDATE2: Two more ways to do it.
- Set
TFDQuery.ResourceOptions.SilentMode=True
(simplest way to disable hourglass cursor for specific queries, property name is bad, but according to doc it doesn't block any dialogs, only changes of cursor). - Set global variable
FADGUIxSilentMode=True
from unit FireDAC.UI.Intf (not best, but probably simplest way to disable changes of cursor globally for FireDAC).