Water 5-Getting Started and Examples-Level 1 Examples
Simple WaterPad Example
<!-- WaterPad Version 1.1   By Andrew Roach 
     Runs under v5.0 alpha i20050508 
     Creates simple text editor that allows to you edit, save the files
     you've created to disk and retrieve them for further editing.
     Uses Water Rich UI for making the user interface components.
-->

<set thetextarea = ui.<textarea /> />

<method newmethod>
   thetextarea.<set the_value="" />
</method>

<method openmethod>
   <set thefilename = ui.<show_file_dialog /> />
   <if>thefilename.<length />.<more 0 />
      thetextarea.<set the_value=<resource a_uri=thefilename.0 />.content />
   </if>
</method>

<method savemethod>
   <set thefilename = ui.<show_file_dialog /> />
   <if>thefilename.<length />.<more 0 />
      <resource a_uri=thefilename.0 />.<set content=thetextarea.the_value />
   </if>
</method>

ui.<window name="WaterPad" width=640 height=480>
   ui.<menubar>
      ui.<menu name="File">
         ui.<menuitem name="New"  click=newmethod />
         ui.<menuitem name="Open..." click=openmethod />
         ui.<menuitem name="Save As..." click=savemethod />
      </menu>
   </menubar>
   ui.<row>
      ui.<scroll>
         thetextarea
      </scroll>
   </row>
</window>