#DEFINE IS_TABLET .F. _Screen.WindowState = 1 LOCAL Test AS AutoCenteredTopForm m.Test = CREATEOBJECT("AutoCenteredTopForm") m.Test.Show() #IF IS_TABLET READ EVENTS #ELSE LOCAL Orientation AS Integer LOCAL CurrentOrientation AS Integer m.CurrentOrientation = _Screen.DisplayOrientation FOR m.Orientation = 0 TO 3 _Screen.DisplayOrientation = m.Orientation WAIT WINDOW "About to rotate..." TIMEOUT 3 ENDFOR _Screen.DisplayOrientation = m.CurrentOrientation _Screen.WindowState = 0 #ENDIF m.Test.Release() m.Test = .NULL. DEFINE CLASS AutoCenteredTopForm AS Form AutoCenter = .T. ShowWindow = 2 && as Top Form Desktop = .T. && on Desktop Caption = "Auto-Centered Top-Form" AlwaysOnTop = .T. Width = SYSMETRIC(1) / 2 Height = SYSMETRIC(2) / 2 FUNCTION Init BINDEVENT(_Screen, "DisplayOrientation", This, "ReCenter") ENDFUNC FUNCTION Destroy UNBINDEVENTS(_Screen, "DisplayOrientation", This, "ReCenter") CLEAR EVENTS ENDFUNC PROCEDURE ReCenter This.AutoCenter = .F. This.AutoCenter = .T. ENDPROC ENDDEFINE