onChangeToken: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Add description of onChangeToken frame event)
 
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 8: Line 8:
Create a frame that has this special html tag in it:
Create a frame that has this special html tag in it:


<source lang="html4strict">
<syntaxhighlight lang="html4strict">
<link rel='onChangeToken' type='macro' href='macroLink'>
<link rel='onChangeToken' type='macro' href='macroLink'>
</source>
</syntaxhighlight>


Replace {{code|macroLink}} by an actual macroLinkText-call to a macro of your choice (the returned value of {{func|macroLinkText}}).
Replace {{code|macroLink}} by an actual macroLinkText-call to a macro of your choice (the returned value of {{func|macroLinkText}}).
Line 19: Line 19:
[[Forms tutorial#Events]]
[[Forms tutorial#Events]]
[[Category:Event]]
[[Category:Event]]
[[Category:Macro Function]]

Latest revision as of 23:59, 4 July 2023

This event is triggered whenever a token is changed.

As a frame-based event, a frame containing the event code has to be opened.

This event can be tricky. It can be fired many times, and can result in loops if the event handler goes on to itself modify tokens.

Set up

Create a frame that has this special html tag in it:

<link rel='onChangeToken' type='macro' href='macroLink'>

Replace macroLink by an actual macroLinkText-call to a macro of your choice (the returned value of macroLinkText()).

The changed token's ID is passed to the macro as the value of macro.args.

See Also

Forms tutorial#Events