Link()
Returns an HTML anchor link string with an optional click callback. This is a helper function - use with Append() to add to the page.
Syntax
Result.s = MaterialSB::Link(Text.s, *Callback, Color.s = "")
Parameters
| Text.s | The link text to display. |
| *Callback | Pointer to the procedure to call when clicked. Use #Null for no callback. |
| Color.s | Optional. Text color using Materialize color constants. |
Return Value
Returns an HTML string containing the anchor element.
Remarks
The callback function receives no parameters. Links are created with href="#" by default.
For more control over styling, use Link_ex() which accepts custom class and style attributes.
Example
Procedure OnLearnMore()
MaterialSB::Toast("Learn more clicked!")
EndProcedure
Procedure OnContact()
MaterialSB::Toast("Contact clicked!")
EndProcedure
Procedure Main(Success)
If Success
MaterialSB::Row(MaterialSB::#Grid_Container)
MaterialSB::Col(12)
; Link with callback
MaterialSB::Append(MaterialSB::Paragraph("Click " + MaterialSB::Link("here", @OnLearnMore()) + " to learn more."))
; Colored link with callback
MaterialSB::Append(MaterialSB::Paragraph("Need help? " + MaterialSB::Link("Contact us", @OnContact(), MaterialSB::#Color_Blue) + " today."))
; Link without callback
MaterialSB::Append(MaterialSB::Paragraph("Visit our " + MaterialSB::Link("homepage", #Null, MaterialSB::#Color_Teal) + " for more info."))
; Multiple links in one paragraph
MaterialSB::Append(MaterialSB::Paragraph("Check out our " + MaterialSB::Link("features", @OnLearnMore(), MaterialSB::#Color_Purple) + " and " + MaterialSB::Link("pricing", @OnLearnMore(), MaterialSB::#Color_Orange) + " pages."))
MaterialSB::CloseCurrentParent()
MaterialSB::CloseCurrentParent()
EndIf
EndProcedure
MaterialSB::Download(@Main())