title: Screen.Cursor in Firemonkey
body: <p>In Delphi 6, I could change the Mouse Cursor for all forms using <code>Screen.Cursor</code>:</p>
  
  <pre><code>procedure TForm1.Button1Click(Sender: TObject);
  begin
    Screen.Cursor := crHourglass;
  end;
  </code></pre>
  
  <p>I am searching the equivalent in Firemonkey.</p>
  
  <p>Following function does not work:</p>
  
  <pre><code>procedure SetCursor(ACursor: TCursor);
  var
    CS: IFMXCursorService;
  begin
    if TPlatformServices.Current.SupportsPlatformService(IFMXCursorService) then
    begin
      CS := TPlatformServices.Current.GetPlatformService(IFMXCursorService) as IFMXCursorService;
    end;
    if Assigned(CS) then
    begin
      CS.SetCursor(ACursor);
    end;
  end;
  </code></pre>
  
  <p>When I insert a <code>Sleep(2000);</code> at the end of the procedure, I can see the cursor for 2 seconds. But the Interface probably gets freed and therefore, the cursor gets automatically resetted at the end of the procedure. I also tried to define <code>CS</code> as a global variable, and add <code>CS._AddRef</code> at the end of the procedure to prevent the Interface to be freed. But it did not help either.</p>
  
  <p>Following code does work, but will only work for the main form:</p>
  
  <pre><code>procedure TForm1.Button1Click(Sender: TObject);
  begin
    Application.MainForm.Cursor := crHourGlass;
  end;
  </code></pre>
  
  <p>Since I want to change the cursor for all forms, I would need to iterate through all forms, but then the rollback to the previous cursors is tricky, as I need to know the previous cursor for every form.</p>
  
  <p>My intention:</p>
  
  <pre><code>procedure TForm1.Button1Click(Sender: TObject);
  var
    prevCursor: TCursor;
  begin
    prevCursor := GetCursor;
    SetCursor(crHourglass); // for all forms
    try
      Work;
    finally
      SetCursor(prevCursor);
    end;
  end;
  </code></pre>