Created
February 19, 2019 07:10
-
-
Save SimaWB/bfb1249bf74434f082148453c0019d1c to your computer and use it in GitHub Desktop.
temporarily changes the cursor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unit uCursor; | |
interface | |
uses Controls, Forms; | |
type | |
TTmpCursor = class(TInterfacedObject, IInterface) | |
private | |
FCursor: TCursor; | |
public | |
constructor Create(const ACursor: TCursor); | |
destructor Destroy; override; | |
class function SetCursor(const ACursor: TCursor = crHourGlass): IInterface; | |
end; | |
implementation | |
{ TTmpCursor } | |
constructor TTmpCursor.Create(const ACursor: TCursor); | |
begin | |
inherited Create(); | |
FCursor := Screen.Cursor; | |
Screen.Cursor := ACursor; | |
end; | |
destructor TTmpCursor.Destroy; | |
begin | |
if Assigned(Screen) then | |
Screen.Cursor := FCursor; | |
inherited Destroy(); | |
end; | |
class function TTmpCursor.SetCursor(const ACursor: TCursor): IInterface; | |
begin | |
Result := TTmpCursor.Create(ACursor); | |
end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage;