mirror of
https://github.com/boxgaming/qbjs.git
synced 2024-05-12 08:00:12 +00:00
Page:
Dom.Event
Pages
Adding Support for a New Keyword
Console.Echo
Console.Log
Console.LogLevel
Dom.Add
Dom.Alert
Dom.Confirm
Dom.Container
Dom.Create
Dom.Event
Dom.Get
Dom.GetImage
Dom.Prompt
Dom.Remove
Export
FS.DownloadFile
FS.ListDirectory
FS.UploadFile
G2D.Bezier
G2D.Curve
G2D.Ellipse
G2D.FillCircle
G2D.FillEllipse
G2D.FillRoundRect
G2D.FillTriangle
G2D.InvertRect
G2D.LineCap
G2D.LineDash
G2D.LineDashOff
G2D.LineWidth
G2D.RotoZoom
G2D.RoundRect
G2D.SaveImage
G2D.Shadow
G2D.ShadowOff
G2D.Triangle
Home
Import
QBasic Language Support
Roadmap
Samples
Storage.Clear
Storage.Get
Storage.Key
Storage.Length
Storage.Remove
Storage.Set
Supported Keywords
Unsupported Keywords
2
Dom.Event
boxgaming edited this page 2023-09-25 13:49:23 -05:00
Table of Contents
Registers an event handler method that will be triggered when the specified event is fired.
Syntax
Dom.Event element, eventType$, eventMethod
Parameters
- The element parameter indicates for which element the event should be registered.
It can be either the object returned from a previous Dom.Create method or Dom.Get method or the String id of the element to remove. - The eventType$ parameter is the name of the event for which the method is being registered (i.e. "click", "change", "mousemove").
- The event method indicates which method or sub should be called when the event is fired.
The sub or function name should be prefixed with "sub_" or "func_" respectively.
Examples
Example1: Create a new html BUTTON element and print a message to the main screen canvas when it is clicked.
Dim panel, btn
panel = Dom.Create("div")
btn = Dom.Create("button", panel, "Push Me")
Dom.Event btn, "click", sub_OnButtonClick
Sub OnButtonClick
Print "The button was clicked."
End Sub
See Also
Dom.Add Dom.Container Dom.Create Dom.Get Dom.GetImage Dom.Remove