Détecter la rotation de l'écran
bonjour
pour ce faire je me suis fait une méthode :
Code:
1 2 3 4 5 6 7 8 9 10
| function TInfosSystem.getOrientation: TScreenOrientation;
var
ScreenService: IFMXScreenService;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService) then
begin
ScreenService := TPlatformServices.Current.GetPlatformService(IFMXScreenService) as IFMXScreenService;
Result:=ScreenService.GetScreenOrientation;
end;
end; |
je pensais l'utiliser dans le rezise:
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| procedure TfNotes.FormResize(Sender: TObject);
var
Orientation: TScreenOrientation;
begin
orientation:= oInfosSystem.Instance.getOrientation;
case orientation of
TScreenOrientation.Portrait: ShowMessage('Portrait');
TScreenOrientation.Landscape:ShowMessage('Landscape') ;
TScreenOrientation.InvertedPortrait: ShowMessage('InvertedPortrait');
TScreenOrientation.InvertedLandscape:ShowMessage('InvertedLandscape') ;
end;
end; |
Le FormResize est bien joué à l'ouverture de l'application, mais pas à la rotation ce qui est mon but.
Une idée?
Cordialement
André