Boxely - Gadgets Sample

Enable the Subscriptions block here!


Sample Code: Gadgets

Boxely gadgets and library are an efficient way to reuse your code.

  • A gadget is a prototype box containing one of more elements that, as a whole, represent a reusable object or control.
  • The Boxely library is an area or node in which all custom, user-defined gadgets, and other reusable elements are defined.

Additional and detailed information about Boxely gadgets and library and be found in the Boxely User Guide Chapter 1: Getting Started.

The following code shows how gadgets can help you reuse code and become a more efficient Boxely programmer!

<?xml version="1.0" encoding="utf-8" ?>

<?import href="box://ocpToolkit/content/windowingPack/windowGadgets.box"?>
<?import href="box://ocpToolkit/content/core/coreGadgets.box"?>
<?import href="box://ocpToolkit/theme/default/toolkit.box"?>

<appWindow xmlns="http://www.aol.com/boxely/box.xsd"
  xmlns:s="http://www.aol.com/boxely/style.xsd"
  chromeless="true"
  s:height="400" s:width="300"   
  title="One Gadget to Rule Them All" >
  
  <library xmlns="http://www.aol.com/boxely/resource.xsd"
    xmlns:box="http://www.aol.com/boxely/box.xsd"
    xmlns:s="http://www.aol.com/boxely/style.xsd" >
    
    <gadget id="myGadget">
      <parts>
        <box:text id="greeting" value="Hello World!" />
      </parts>
    </gadget> 
  
    <style tag="myGadget" height="100" fill="white" hAlign="center" vAlign="center"
      stroke="black" strokeWidth="1" strokeCornerRadius="4" 
      fillCornerRadius="4" padding="1 4 2 4" margin="10"/>
  
  </library>
   
  <myGadget id="firstInstance" />
  <myGadget id="secondInstance" />
  <myGadget id="thirdInstance" />  

</appWindow>

up next: Layout