This project changes its name and is transferred here
Using the XUI views I realized the need to follow the events of Touch, Drag, Click and Release in a unique way.
In Android I would use this command:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
In B4J I would use this:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
I wanted to create an XUI class that manages things in a standard way, so if we write apps using XUI views we can also have a standard when we write code related to events, without having to use #IF B4A, #IF B4J
jSD_XUI_TouchViewEvent
Author: Star-Dust
Version: 0.02
an example of how to do with this library (Both in B4A and in B4J):
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
HERE B4A Version
			
			Using the XUI views I realized the need to follow the events of Touch, Drag, Click and Release in a unique way.
In Android I would use this command:
			
				B4X:
			
		
		
		Sub EventName_Touch (Action As Int, X As Float, Y As Float)In B4J I would use this:
			
				B4X:
			
		
		
		Sub EventName_MouseDragged (EventData As MouseEvent)
Sub EventName_MouseClicked (EventData As MouseEvent)
Sub EventName_MouseReleased (EventData As MouseEvent)I wanted to create an XUI class that manages things in a standard way, so if we write apps using XUI views we can also have a standard when we write code related to events, without having to use #IF B4A, #IF B4J
In B4A the result is the same that you would get by setting the Touch event with JavaObject.SetOnTouchListener
In B4J the result is the same that you would get the same as creating an Event with o.CreateEvent ("javafx.event.EventHandler", "Event")
jSD_XUI_TouchViewEvent
Author: Star-Dust
Version: 0.02
- ManagerTouchEvent- Events:- TouchEvent (action As Int, Coordinate() As TCoordinate)
 
- Fields:- Action_Down As Int
 
- Action_Drag As Int
 
- Action_LoseTouch As Int
 
- Action_Up As Int
 
- Action_Down As Int
- Functions:- Class_Globals  As String
 
- Initialize (mCallBack As Object) As String
 Initializes the object. You can add parameters to this method if needed.
- IsInitialized  As Boolean
 Verifica se l'oggetto sia stato inizializzato.
- SetTouchEvent (View As B4XView, EventName As String) As String
 
- Class_Globals  As String
 
- Events:
- TCoordinate- Fields:- IsInitialized As Boolean
 Verifica se l'oggetto sia stato inizializzato.
- X As Int
 
- Y As Int
 
- IsInitialized As Boolean
- Functions:- Initialize  
 Inizializza i campi al loro valore predefinito.
 
- Initialize  
 
- Fields:
an example of how to do with this library (Both in B4A and in B4J):
			
				B4X:
			
		
		
		 Globals
    Dim Manager As ManagerTouchEvent
    Private Label1 As Label
    Private Label2 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")
    Manager.Initialize(Me)
    Manager.SetTouchEvent(Label1,"Label1")
    Manager.SetTouchEvent(Label2,"Label2")
End Sub
Sub Label1_TouchEvent (action As Int, Coordinate() As TCoordinate)
 Select action
        Case Manager.Action_Down
               Log($"Label1: Click- X:${Coordinate(0).X} Y:${Coordinate(0).y}"$)     
        Case Manager.Action_Drag ' Drag
               Log($"Label1: Drag- X:${Coordinate(0).X} Y:${Coordinate(0).y}"$)               
        Case Manager.Action_Up ' Release click
               Log($"Label1: Release - X:${Coordinate(0).X} Y:${Coordinate(0).y}"$)
        Case Manager.Action_Click
               Log($"Label1: Click- X:${Coordinate(0).X} Y:${Coordinate(0).y}"$)      
        Case Manager.Action_DoubleClick
               Log($"Label1: DoubleClick- X:${Coordinate(0).X} Y:${Coordinate(0).y}"$)      
        Case Manager.Action_LongClick
               Log($"Label1: LongClick- X:${Coordinate(0).X} Y:${Coordinate(0).y}"$)         
    End Select
End Sub
Sub Label2_TouchEvent (action As Int, Coordinate() As TCoordinate)
    Log($"Label2: ${action}- X:${Coordinate(0).X} Y:${Coordinate(0).y}"$)
End SubHERE B4A Version
Attachments
			
				Last edited: 
			
		
	
							 
				 
 
		 
 
		 
 
		 
 
		