4. Events¶
Choose Events at the top of the properties to see what the chosen face can answer to, each with a small code box for the Trebol that runs then.
The other events¶
After the action come the events the face’s style fires, each with a line that says when: on-change (its
value changed), on-focus (it took the focus), on-key (a key was pressed while it has the focus),
on-over (the pointer is over it), and so on. A face lists only the events of its own style: a field has
on-change, a button has not.
Type a block in one, [toast "Changed"] in the on-change of the customer field, and the code gets
on-change [toast "Changed"] after the face. The events a face answers to already come first, each with a
× that takes it out; emptying its box does the same.
What a block has at hand depends on the event: in on-change the new value is value, in the on-select of a
table the row chosen is row. The reference says what each event gives.
Find an option narrows the events too: sel leaves on-select.
The view’s events, and a screen’s¶
The view’s events are those of the whole window: on-key gets the keys no face takes, on-find what is asked
in the palette (Ctrl+K). A screen of an app, on the next page, adds on-enter and
on-leave, run when the app goes to it and leaves it.
A tab or a step has no events of its own: its faces have them.
What’s next¶
One screen is not a shop. The next page gives Cog & Chain its screens.
