SubName: Screen rotation in services, especially widgets.
Description: Sometimes you need to catch the screen rotation in services and especially widgets. Here is one solution.
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Tags: catch, screen, rotation, service, widget
			
			Description: Sometimes you need to catch the screen rotation in services and especially widgets. Here is one solution.
			
				B4X:
			
		
		
		Sub Process_Globals
  Dim CheckScrOrientation, StoredOrientation As String
  Dim RotateTimer As Timer
End Sub
Sub Service_Create
  RotateTimer.Initialize("SDTime", 500)  '1000 Milliseconds = 1 second
  RotateTimer.Enabled = True
End Sub
Sub SDTime_Tick
  If GetDeviceLayoutValues.Width > GetDeviceLayoutValues.Height Then
      CheckScrOrientation = "Landscape"
  Else
      CheckScrOrientation = "Portrait"
  End If
  If CheckScrOrientation <> StoredOrientation Then
      StoredOrientation = CheckScrOrientation
      'PUT WHATEVER UPDATE/REFRESH ROUTINE OR CALLSUB YOU NEED HERE...
  End If
End SubTags: catch, screen, rotation, service, widget
			
				Last edited: 
			
		
	
							 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		