Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. unit uCursor;
  2.  
  3. interface
  4.  
  5. uses Controls, Forms;
  6.  
  7. type
  8. TTmpCursor = class(TInterfacedObject, IInterface)
  9. private
  10. FCursor: TCursor;
  11. public
  12. constructor Create(const ACursor: TCursor);
  13. destructor Destroy; override;
  14. class function SetCursor(const ACursor: TCursor = crHourGlass): IInterface;
  15. end;
  16.  
  17. implementation
  18.  
  19. { TTmpCursor }
  20.  
  21. constructor TTmpCursor.Create(const ACursor: TCursor);
  22. begin
  23. inherited Create();
  24. FCursor := Screen.Cursor;
  25. Screen.Cursor := ACursor;
  26. end;
  27.  
  28. destructor TTmpCursor.Destroy;
  29. begin
  30. if Assigned(Screen) then
  31. Screen.Cursor := FCursor;
  32. inherited Destroy();
  33. end;
  34.  
  35. class function TTmpCursor.SetCursor(const ACursor: TCursor): IInterface;
  36. begin
  37. Result := TTmpCursor.Create(ACursor);
  38. end;
  39.  
  40. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement