1 <?xml version="1.0" encoding="utf-8"?>
  2 <page>
  3    <config delay="">
  4       <!--Style the window and make page background transparent for this forum display-->
  5       <setBrowserWindowStyles>
  6          <![CDATA[
  7             { color : 'none' }
  8          ]]>
  9       </setBrowserWindowStyles>
 10       <setPageContentPosition>
 11          <![CDATA[
 12             { left : '', top : '', width : '', height : '', 
 13               addScrollbars : '', transparentPageBG : true }
 14          ]]>
 15       </setPageContentPosition>
 16    </config>
 17 
 18    <myButtons>
 19       <!--Create our click event function. PowerPac's XML engine appends it to the
 20           ToolBook event system to follow whatever actions are already defined if any.-->
 21       <function name="myClick" event="click" 
 22                 params="evt,undef,target,mouseX,mouseY,shiftDown,ctrlDown" useTB="true">
 23          <![CDATA[
 24             /* NOTE: parameter [target] is a reference to which obj is clicked in the group
 25                      target.name is the ToolBook name of object clicked
 26                         use this if the objects in the group have unique names
 27                      target.id is the ToolBook id of object clicked
 28                         use this if the objects in the group are unnamed
 29                      this.name or this.id
 30                         use this to manipulate this group */
 31                         
 32             var myCaption = tbfunction_pgTBObjGet( target.id, 'caption' );
 33             
 34             tbfunction_pgStyleObject('UserEvent', 'backgroundColor,color', 'orange,white');
 35             tbfunction_pgTBObjSet('UserEvent', 'text', 'Last selection: ' + myCaption );
 36             
 37             //Send user event to this group with target.id and caption (delayed 1500ms)
 38             tbfunction_pgTBObjSet( this.name, 'user', target.id + "," + myCaption, 1500, '', true );
 39          ]]>
 40       </function>
 41       
 42       <!--Method for building a user event on a group of ToolBook objects-->
 43       <function name="myUser" event="user" params="evt,value" useTB="true">
 44          <![CDATA[
 45             //Show a prompt
 46             alert('User Event VALUE:   ' + value);
 47             
 48             //Reset color of event field 500ms after prompt closes
 49             tbfunction_pgStyleObject('UserEvent', 'backgroundColor,color', 'white,black', 500);
 50             tbfunction_pgTBObjSet('UserEvent', 'text', 'Waiting for you to click a button ...', 500, '', true);
 51          ]]>
 52       </function>
 53    </myButtons>
 54    
 55    <UserEvent>
 56       <!--Style this ToolBook field-->
 57       <pgStyleObject>
 58          <![CDATA[
 59             { theStyle  : 'padding, height, borderRadius, border',
 60               propVals  : '3px 0px 3px 0px, auto, 8px, 1px solid rgb(176,176,255)' }
 61           ]]>
 62       </pgStyleObject>
 63       <text>
 64          <![CDATA[
 65             Waiting for you to click a button ...
 66          ]]>
 67       </text>
 68    </UserEvent>
 69 </page>