Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

With Firemonkey, how to give feedback to the user ? (crHourglass)

Usually, when I have a task which takes some time, I use a script like this:

procedure Work;
var
  cPrevious: TCursor;
begin
  cPrevious     := Screen.Cursor;
  Screen.Cursor := crHourGlass;

  try    
  // the task

  finally    
    Screen.Cursor := cPrevious;
  end;
end;

With FireMonkey, Screen doesn't have a property: Cursor.

What is the best way to give some feedback to the user?



I followed the comments and the answer... with a TPanel which has less opacity, and a TAniIndicator (I also blur the other components):

Feedback

Thank you!

like image 469
Whiler Avatar asked Sep 15 '11 07:09

Whiler


3 Answers

Like @mjn pointed out, the glass hour cursor is no more the only wait pattern you can utilize.

For example, in Silverlight/WPF, you can use a busy indicator control, http://www.codeproject.com/KB/silverlight/SilverlightBusyIndicator.aspx

So you may try to do something similar inside FireMonkey. There may be a similar control for you to use already, or you can write your own.

Update: TAniIndicator is the component to use

like image 149
Lex Li Avatar answered Oct 13 '22 00:10

Lex Li


FireMonkey TScreen has no Cursor property, but global Platform instance has a SetCursor method:

uses FMX.Platform, System.UITypes;

... Platform.SetCursor(nil, crHourGlass); try ... finally Platform.SetCursor(nil, crDefault); end;

like image 24
David Berneda Avatar answered Oct 13 '22 00:10

David Berneda


This works for me on XE3, FireMonkey2 running on XP:

`Application.MainForm.Cursor:= crHourGlass;`
like image 35
sergeantKK Avatar answered Oct 13 '22 02:10

sergeantKK