Neatware Header
Home   Products   Forums   Partners   Buy   Company   Contact   Blog   

Event

When an event is ignitated its associated tasks are executed. In Snaml Generic WML _do and _onevent commands implement the event binding.

1. Normal Events

  • _do

    _do command completes actions on the current card. It links a widget such as a button, a key, or a voice command to an action. _do command may appear in a card or a template. The _do command in a card will override the _do command in a template if they have the same name.

    _do "type='type' label='label' name='name' optional='boolean'"
      go|prev|noop|refresh
    do_

    'type' is a required attribute. ?? It has the value 'accept' which accepts the command; 'prev' which goes to backward; 'help' which do help; 'reset' which clears the states; 'options' which requests for options; 'delete' which deletes an item; 'unknown' which do nothing; 'vnd.*' which specifies vendor's type.

    'label' attribute specifies a string to indicate a user widget. It will be invalid if a widget can not be dynamically labeled. 'name' attribute specifies the name of event binding. The default value is equal to the value of type attribute. If 'optional' attribute has a true value, the _do command will be ignored. Its default value is false.

    _card "id='first_card'"
      _do "type='accept' label='Card2'"
        __go "href='#second_card'"
      do_
      quote "Click Card2 and goto it"
    card_
    _card "id='second_card'"
      quote "Second Card"
    card_
    	
  • _onevent

    It specifies an event binding of a command in its content. The 'type' attribute specifies the name of an intrinsic event.

    _onevent "type='type'"
      go|prev|noop|refresh
    onevent_
    
  • __postfield

    __postfield specifies a field name and its value. It is used to send a URL request to a server.

    __postfield "name='name' value='value'"
    

    The 'name' attribute specifies the field name and it is required. The 'value' attribute specifies name value.

2. Intrinsic Events

  • ontimer

    It may be an attribute of _card or _template command. It may also be a type value of _onevent command. Usually, it is used with the __timer command. When the timer expired this event is actived.

  • onenterforward

    It may be an attribute of _card or _template command. It may also be a type value of _onevent command The event is actived when __go command is executed.

  • onenterbackward

    It may be an attribute of _card or _template command. It may also be a type value of _onevent command. The event is actived when _prev command is executed.

    _card "id='card_wait' ontimer='#card_stop'"
      # when user enters this card with prev task
      # onenterbackward occurs
      _onevent "type='onenterbackward'"
        __prev
      onevent_
    card_
    
  • onpick

    It may be an attribute of the _option command. The event is actived when a user selects an item.