pracro:devas_corner
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
pracro:devas_corner [2010/08/02 14:12] – deva | pracro:devas_corner [2010/08/10 10:49] – deva | ||
---|---|---|---|
Line 5: | Line 5: | ||
<?xml version=' | <?xml version=' | ||
<macro name=" | <macro name=" | ||
+ | |||
+ | < | ||
+ | <script src=" | ||
+ | < | ||
+ | -- inline code | ||
+ | if(regexp(' | ||
+ | then | ||
+ | return 'a string' | ||
+ | else | ||
+ | return ' | ||
+ | end | ||
+ | </ | ||
+ | </ | ||
+ | |||
< | < | ||
function foo() | function foo() | ||
-- this: current widget (widget that triggered the event) | -- this: current widget (widget that triggered the event) | ||
- | -- this.value: current value | ||
- | -- this.name: current name | ||
- | -- this.type: current type (eg. ' | ||
this.setChecked(true) | this.setChecked(true) | ||
Line 16: | Line 27: | ||
foo = getWidgetByName(' | foo = getWidgetByName(' | ||
- | if ( foo && foo.type == ' | + | if ( foo && foo.getType() |
then | then | ||
| | ||
Line 38: | Line 49: | ||
</ | </ | ||
+ | ====The Widget Events==== | ||
+ | Each widget has an event that is inspired by the current '' | ||
+ | Currently the script is referred by its name, and called whenever the widget changes its value.\\ | ||
+ | In the new system, the script attribute is removed and replaced by event attributes. The event attributes will themselves contain lua code and not simply a name. In order to call ' | ||
+ | The return values will no longer be used. Instead widget methods will be added to control the validation state of each widget, eg. setValid(true|false), | ||
+ | Since it is no longer required (due to redundancy) the '' | ||
+ | |||
+ | ====Event Handlers==== | ||
+ | * '' | ||
+ | * '' | ||
+ | * and many more | ||
+ | |||
+ | ====The Widget Object==== | ||
+ | When in a lua function, invoked by an event handler, the calling object (the object invoking the event) will be made available through the value ' | ||
+ | Other object can be retrieved using the '' | ||
+ | <code lua> | ||
+ | function foo() | ||
+ | if (this.value == ' | ||
+ | then | ||
+ | this.setValue(' | ||
+ | end | ||
+ | |||
+ | bas = getWidget(' | ||
+ | if (bas && bas.value == ' | ||
+ | then | ||
+ | bas.setValue(' | ||
+ | end | ||
+ | end | ||
+ | </ | ||
+ | A small number of methods are common to all widget types. These include are: | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | Others are specific to certain widget types, such as (and many more): | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
=====New protocol===== | =====New protocol===== | ||
Line 159: | Line 210: | ||
A macro in resume mode is marked with a distinct colour when committed.\\ | A macro in resume mode is marked with a distinct colour when committed.\\ | ||
A macro already committed, and reopened, is to be opened in edit mode, ie. it is to assume the old values from the commit. | A macro already committed, and reopened, is to be opened in edit mode, ie. it is to assume the old values from the commit. | ||
- | |||
- |
pracro/devas_corner.txt · Last modified: 2011/01/14 14:49 by deva