ho fatto solo questo per il Mac, ma l'idea generale è che si sceglie di implementare il proprio IFMXCursorService. Tieni presente che questo è praticamente un approccio tutto o niente. Dovrai implementare anche i cursori FMX predefiniti.
type
TWinCursorService = class(TInterfacedObject, IFMXCursorService)
private
class var FWinCursorService: TWinCursorService;
public
class constructor Create;
procedure SetCursor(const ACursor: TCursor);
function GetCursor: TCursor;
end;
{ TWinCursorService }
class constructor TWinCursorService.Create;
begin
FWinCursorService := TWinCursorService.Create;
TPlatformServices.Current.RemovePlatformService(IFMXCursorService);
TPlatformServices.Current.AddPlatformService(IFMXCursorService, FWinCursorService);
end;
function TWinCursorService.GetCursor: TCursor;
begin
// to be implemented
end;
procedure TWinCursorService.SetCursor(const ACursor: TCursor);
begin
Windows.SetCursor(Cursors[ACursor]); // you need to manage the Cursors list that contains the handles for all cursors
end;
Potrebbe essere un necessario aggiungere una bandiera per la TWinCursorService in modo che impedirà il quadro FMX di ignorare il cursore.
Il tempo è importante quando si registra il proprio servizio cursore. Dovrà essere fatto dopo che FMX chiama TPlatformServices.Current.AddPlatformService (IFMXCursorService, PlatformCocoa);
fonte
2014-09-24 21:28:05
stai cercando una soluzione multipiattaforma? – RRUZ
@RRUZ al momento mi serve per Windows solo per cambiare il cursore su viewport3d – Saeed