B4J Tutorial [ABMaterial] One Page - Subs required

Continuing the One Page, Many Uses example, here we demonstrate how to create and collect the events raised for each Type (Employee, Vehicle, User, etc).

The module form is getting rather large by now... It is best to group each section in a region

B4X:
#Region Vehicle
     '...   All VEHICLE code methods
     ' now you can collapse (hide this section from view 
#End Region Vehicle

Within this region, we define each sub that applies to the BuildPage() sub:

page.AddModalSheetTemplate(BuildVehicleInputSheet)
This InputSheet is our Modal template for adding and editing records - but it is just a skeleton.
We need to create the ADD and EDIT methods (and other button click responses).

Sub AddNewVehicle(Target As String)
Sub EditVehicle(PassedRowsAndColumns As List)

These create the forms for adding (all fields blank)
or editing (all fields populated with results from selected id)

The modal forms have a Save or Cancel button on them. Each button, depending on which form it was created for, will have a unique ID (VehicleCancelBtn).
Sub VehicleCancelBtn_Clicked(Target As String)
Sub VehicleSaveBtn_Clicked(Target As String)


This is the key to creating a page that handles many on_click events...
Create on_click methods (subs) for each unique ID.

VehicleCancelBtn
EmployeeCancelBtn
UserCancelBtn
InspectionCancelBtn
...etc
 
Top