139 lines
3.2 KiB
Plaintext
139 lines
3.2 KiB
Plaintext
; MaterialSB Example - Forms
|
|
; This example demonstrates all form components available in MaterialSB.
|
|
|
|
IncludeFile "MaterialSB.sbi"
|
|
|
|
EnableExplicit
|
|
|
|
Procedure OnSubmit()
|
|
Debug "Form submitted!"
|
|
EndProcedure
|
|
|
|
Procedure Main(Result)
|
|
Protected Dropdown, Range
|
|
UseModule MaterialSB
|
|
|
|
SetDarkTheme(#False)
|
|
|
|
; Create a navbar
|
|
Navbar(#Navbar_Shadow1 | #Navbar_Container)
|
|
NavbarAddLogo("Form Example")
|
|
|
|
; Main container
|
|
Row(#Grid_Container)
|
|
Col(12)
|
|
Append("<h3>Form Components</h3>")
|
|
Append("<p>MaterialSB provides a complete set of form components styled with MaterializeCSS.</p>")
|
|
CloseCurrentParent(2)
|
|
|
|
; Text Inputs Section
|
|
Row(#Grid_Container)
|
|
Col(12, 6)
|
|
|
|
Append("<h5>Text Inputs</h5>")
|
|
TextInput("Username", "Enter your username")
|
|
TextInput("Email Address", "", #Input_Email)
|
|
TextInput("Password", "", #Input_Password)
|
|
TextInput("Phone Number", "", #Input_Tel)
|
|
TextInput("Disabled Field", "Cannot edit", #Input_Disabled)
|
|
|
|
CloseCurrentParent()
|
|
|
|
; Textarea
|
|
Col(12, 6)
|
|
|
|
Append("<h5>Textarea</h5>")
|
|
Textarea("Biography", "Tell us about yourself...")
|
|
Textarea("Read-only Notes", "", #Textarea_Readonly)
|
|
|
|
CloseCurrentParent(2)
|
|
|
|
; Checkboxes and Radios
|
|
Row(#Grid_Container)
|
|
Col(12, 6, 4)
|
|
|
|
Append("<h5>Checkboxes</h5>")
|
|
Checkbox("Default checkbox")
|
|
Checkbox("Filled checkbox", #Checkbox_Filled)
|
|
Checkbox("Pre-checked", #Checkbox_Checked)
|
|
Checkbox("Filled & checked", #Checkbox_Filled | #Checkbox_Checked)
|
|
Checkbox("Disabled", #Checkbox_Disabled)
|
|
|
|
CloseCurrentParent()
|
|
|
|
Col(12, 6, 4)
|
|
|
|
Append("<h5>Radio Buttons</h5>")
|
|
Radio("group1","Option 1", #Radio_Checked)
|
|
Radio("group1","Option 2")
|
|
Radio("group1","Option 3")
|
|
Append("<br>")
|
|
Append("<p><strong>With Gap:</strong></p>")
|
|
Radio("group2", "Choice A", #Radio_WithGap | #Radio_Checked)
|
|
Radio("group2", "Choice B", #Radio_WithGap)
|
|
|
|
CloseCurrentParent()
|
|
|
|
Col(12, 6, 4)
|
|
|
|
Append("<h5>Switches</h5>")
|
|
Switch("Off", "On")
|
|
Append("<br><br>")
|
|
Switch("Disabled", "Enabled", #Switch_Checked)
|
|
Append("<br><br>")
|
|
Switch("No", "Yes", #Switch_Disabled)
|
|
|
|
CloseCurrentParent(2)
|
|
|
|
; Select and Range
|
|
Row(#Grid_Container)
|
|
Col(12, 6)
|
|
|
|
Append("<h5>Select Dropdown</h5>")
|
|
Dropdown = Dropdown("Choose your country")
|
|
DropdownAddOption("Choose an option", "", Dropdown, #True)
|
|
DropdownAddOption("France", "fr", Dropdown)
|
|
DropdownAddOption("Germany", "de", Dropdown)
|
|
DropdownAddOption("United Kingdom", "uk", Dropdown)
|
|
DropdownAddOption("Canada", "ca", Dropdown)
|
|
DropdownAddOption("Japan", "jp", Dropdown)
|
|
Init(Dropdown, #Null)
|
|
|
|
CloseCurrentParent()
|
|
|
|
Col(12, 6)
|
|
|
|
Append("<h5>Range Slider</h5>")
|
|
Append("<p>Volume:</p>")
|
|
Range = Range(0, 100, 50)
|
|
|
|
Append("<p>Brightness (0-255):</p>")
|
|
Range(0, 255, 128)
|
|
|
|
CloseCurrentParent(2)
|
|
|
|
; Submit Button
|
|
Row(#Grid_Container)
|
|
Col(12)
|
|
Append("<br>")
|
|
Protected submitBtn = Button("Submit Form", #Button_Large)
|
|
AddClass(submitBtn, #Color_Green)
|
|
ButtonSetCallback(submitBtn, @OnSubmit())
|
|
CloseCurrentParent(2)
|
|
|
|
AutoInit()
|
|
|
|
UnuseModule MaterialSB
|
|
EndProcedure
|
|
|
|
MaterialSB::Download(@Main())
|
|
|
|
; IDE Options = SpiderBasic 3.10 (Windows - x86)
|
|
; CursorPosition = 12
|
|
; Folding = -
|
|
; iOSAppOrientation = 0
|
|
; AndroidAppCode = 0
|
|
; AndroidAppOrientation = 0
|
|
; EnableXP
|
|
; DPIAware
|
|
; CompileSourceDirectory |