Delphi Buttons – Create an hour glass impression while waiting

Got a chance to receive source code from a software vendor and the button on this program made me smile.

Haven’t though of it that way. But i think it works.

procedure TSFTPClientFrame.btConnectSSHClick(Sender: TObject);
var
  OldCursor: TCursor;
begin
  OldCursor := Screen.Cursor;
  try
    Screen.Cursor := crHourGlass;
    ScSSHClient.Connect;
  finally
    Screen.Cursor := OldCursor;
  end;
end;

The hour glass cursor is within the try row. Once it is done, it revert backs the cursor to the original one used. Pretty awesome.

Just wanted to share

Coffee Cup