I'm finishing up ABMaterial 3.00 Chipmunk and a new component that has been introduced is ABMSmartWizard.
ABMSmartWizard is a flexible step wizard component. It is easy to implement and gives a neat and stylish interface for your forms, checkout screen, registration steps etc.
Usage example:
Release in a couple of days
ABMSmartWizard is a flexible step wizard component. It is easy to implement and gives a neat and stylish interface for your forms, checkout screen, registration steps etc.
Usage example:
B4X:
public Sub ConnectPage()
...
Dim wizA As ABMSmartWizard
wizA.Initialize(page, "wizA","Previous", "Next", "Finish", "wizA")
wizA.AddStep("stepA1", "Step 1", "Email Address","", BuildContainer("StepA1Cont"), ABM.SMARTWIZARD_STATE_ACTIVE)
wizA.AddStep("stepA2", "Step 2", "Name","", BuildContainer("StepA2Cont"), ABM.SMARTWIZARD_STATE_DISABLED)
wizA.AddStep("stepA3", "Step 3", "Address","", BuildContainer("StepA3Cont"), ABM.SMARTWIZARD_STATE_DISABLED)
wizA.AddStep("stepA4", "Step 4", "Terms and conditions","", BuildContainer("StepA4Cont"), ABM.SMARTWIZARD_STATE_DISABLED)
page.CellR(1,1).AddComponent(wizA)
...
' also add the components to the footer
ABMShared.ConnectFooterFixed(page)
page.Refresh ' IMPORTANT
' NEW, because we use ShowLoaderType=ABM.LOADER_TYPE_MANUAL
page.FinishedLoading 'IMPORTANT
page.RestoreNavigationBarPosition
End Sub
Sub BuildContainer(ID As String) As ABMContainer
Dim cont As ABMContainer
cont.Initialize(page, ID, "")
Select Case ID
Case "StepA1Cont"
cont.AddRowsM(2, True,0,0,"").AddCells12(1,"")
cont.BuildGrid ' IMPORTANT!
Dim emaillbl As ABMLabel = ABMShared.BuildHeader(page, ID & "emaillbl", "Your Email Address")
cont.Cell(1,1).AddComponent(emaillbl)
Dim emailinp As ABMInput
emailinp.Initialize(page, ID & "emailinp", ABM.INPUT_TEXT, "Email address:", False, "input")
emailinp.PlaceHolderText = "write your email address"
cont.Cell(2,1).AddComponent(emailinp)
Case "StepA2Cont"
cont.AddRowsM(2, True,0,0,"").AddCells12(1,"")
cont.BuildGrid ' IMPORTANT!
Dim namelbl As ABMLabel = ABMShared.BuildHeader(page, ID & "namelbl", "Your Name")
cont.Cell(1,1).AddComponent(namelbl)
Dim nameinp As ABMInput
nameinp.Initialize(page, ID & "nameinp", ABM.INPUT_TEXT, "Name:", False, "input")
nameinp.PlaceHolderText = "write your name"
cont.Cell(2,1).AddComponent(nameinp)
Case "StepA3Cont"
cont.AddRowsM(2, True,0,0,"").AddCells12(1,"")
cont.BuildGrid ' IMPORTANT!
Dim addresslbl As ABMLabel = ABMShared.BuildHeader(page, ID & "addresslbl", "Your address")
cont.Cell(1,1).AddComponent(addresslbl)
Dim addressinp As ABMInput
addressinp.Initialize(page, ID & "addressinp", ABM.INPUT_TEXT, "Address:", True, "input")
addressinp.PlaceHolderText = "write your address"
cont.Cell(2,1).AddComponent(addressinp)
Case "StepA4Cont"
cont.AddRowsM(2, True,0,0,"").AddCells12(1,"")
cont.BuildGrid ' IMPORTANT!
Dim termslbl As ABMLabel = ABMShared.BuildHeader(page, ID & "termslbl", "Terms and Conditions")
cont.Cell(1,1).AddComponent(termslbl)
Dim termslbl2 As ABMLabel = ABMShared.BuildParagraph(page, ID & "termslbl2", "Enjoy working with ABMaterial :-)")
cont.Cell(1,1).AddComponent(termslbl2)
Dim chk As ABMCheckbox
chk.Initialize(page, ID & "chk", "I agree with Alwaysbusy!", False, "checkbox")
cont.Cell(2,1).AddComponent(chk)
End Select
Return cont
End Sub
' helper method to set the states
Sub SetWizardStepStates(wiz As ABMSmartWizard, Active As String, wizType As String)
Dim ActiveInt As Int = Active.SubString(5)
For i = 1 To ActiveInt - 1
wiz.SetStepState("step" & wizType & i, ABM.SMARTWIZARD_STATE_DONE)
Next
wiz.SetStepState(Active, ABM.SMARTWIZARD_STATE_ACTIVE)
For i = ActiveInt + 1 To 5
wiz.SetStepState("step" & wizType & i, ABM.SMARTWIZARD_STATE_DISABLED)
Next
End Sub
Sub wizA_NavigationToStep(fromReturnName As String, toReturnName As String)
Dim wizA As ABMSmartWizard = page.Component("wizA")
If fromReturnName.CompareTo(toReturnName) < 0 Then ' to the right
Select Case fromReturnName
Case "stepA1"
Dim cont As ABMContainer = wizA.GetStep("StepA1")
Dim emailinp As ABMInput = cont.Component("StepA1ContEmailInp")
If emailinp.Text.IndexOf("@") = -1 Then
wizA.SetStepState("stepA1", ABM.SMARTWIZARD_STATE_ERROR)
wizA.NavigateCancel(toReturnName) ' important
Else
SetWizardStepStates(wizA, toReturnName, "A")
wizA.NavigateGoto(toReturnName) ' important
End If
Case "stepA2"
Dim cont As ABMContainer = wizA.GetStep("StepA2")
Dim nameinp As ABMInput = cont.Component("StepA2ContNameInp")
If nameinp.Text = "" Then
wizA.SetStepState("stepA2", ABM.SMARTWIZARD_STATE_ERROR)
wizA.NavigateCancel(toReturnName) ' important
Else
SetWizardStepStates(wizA, toReturnName, "A")
wizA.NavigateGoto(toReturnName) ' important
End If
Case "stepA3"
Dim cont As ABMContainer = wizA.GetStep("StepA3")
Dim addressinp As ABMInput = cont.Component("StepA3ContAddressInp")
If addressinp.Text = "" Then
wizA.SetStepState("stepA3", ABM.SMARTWIZARD_STATE_ERROR)
wizA.NavigateCancel(toReturnName) ' important
Else
SetWizardStepStates(wizA, toReturnName, "A")
wizA.NavigateGoto(toReturnName) ' important
End If
Case "stepA4"
' handled in NavigationFinished
End Select
Else If fromReturnName.CompareTo(toReturnName) > 0 Then ' to the left
SetWizardStepStates(wizA, toReturnName, "A")
wizA.NavigateGoto(toReturnName) ' important
Else
wizA.NavigateGoto(toReturnName) ' important
End If
wizA.Refresh ' important
End Sub
Sub wizA_NavigationFinished(ReturnName As String)
Dim wizA As ABMSmartWizard = page.Component("wizA")
Dim cont As ABMContainer = wizA.GetStep("StepA4")
Dim chk As ABMCheckbox = cont.Component("StepA4ContChk")
If chk.State = False Then
wizA.SetStepState("stepA4", ABM.SMARTWIZARD_STATE_ERROR)
wizA.NavigateCancel(ReturnName) ' important
Else
' reset the wizard
cont = wizA.GetStep("StepA1")
Dim emailinp As ABMInput = cont.Component("StepA1ContEmailInp")
emailinp.Text = ""
emailinp.Refresh
cont = wizA.GetStep("StepA2")
Dim nameinp As ABMInput = cont.Component("StepA2ContNameInp")
nameinp.Text = ""
nameinp.Refresh
cont = wizA.GetStep("StepA3")
Dim addressinp As ABMInput = cont.Component("StepA3ContAddressInp")
addressinp.Text = ""
addressinp.Refresh
chk.State = False
chk.Refresh
SetWizardStepStates(wizA, "stepA1", "A")
wizA.NavigateGoto("stepA1") ' important
End If
wizA.Refresh ' important
End Sub
Release in a couple of days