Technology
 

KON file

From Unofficial Konfabulator Wiki

A KON file is an XML file with the ".KON" file extension that is used to define a Widget. Every Widget must have exactly one KON file. Most publicly released Widgets "hide" their KON files inside a Widget file.

Contents

[edit] Syntax

XML syntax is pretty simple to learn, especially if you are familiar with another markup language, such as HTML. It's probably simplest to learn by example.


[edit] Examples

The first two examples below do exactly the same thing, using rather different styles of XML.

[edit] Atribute-centric example

Attribute-centric means that the XML is written with a preference for using XML "attributes" instead of "elements," where possible.

<widget debug="on">
  <window name="main" width="320" height="240">
    <image name="background" src="Resources/background.png"
           opacity="127"
           hOffset="0" vOffset="0" width="320" height="240"
           onMouseEnter="background.opacity = 255;"
           onMouseExit="background.opacity = 127;" />
  </window>
</widget>

[edit] Element-centric example

Element-centric means that the XML is written with a preference for using XML "elements" instead of "attributes," where possible.

<widget>
  <debug>on</debug>
  <window>
    <name>main</name>
    <width>320</width>
    <height>240</height>
    
    <image>
      <name>background</name>
      <src>Resources/background.png</src>
      <opacity>127</opacity>
      <hOffset>0</hOffset>
      <vOffset>0</vOffset>
      <width>320</width>
      <height>240</height>
      <onMouseEnter>background.opacity = 255;</onMouseEnter>
      <onMouseExit>background.opacity = 127;</onMouseExit>
    </image>
    
  </window>
</widget>
Rate this article: