Example Tclet - Simple Horizontal Rule Painter

written December 1997 being revised June 2006
Google site search


4.0.1   Example Tclet        

On this page we borrow an example from another section. Most tclets just do something on a webpage which can be interesting enough, but the contextual environment of a webpage can allow you to do more interesting things. One example is a a small painter program which allows you to craft a program element by by selecting options and adjusting scales in a tclet.

This is a simple painter that allows you to paint a decorative horizontal line for a webpage. It can also paint a freize of rectangles. The painter allows you to judge colour, relief and proportions of the line intuitively, without having to write your own code, change, and execute it repeatedly. This makes the process creative.

To "paint" the freize move the sliders and select the radiobuttons. Only one radiobutton can be selected at a time and all the rectangles are given the same border.

The sliders all work independantly and are self explanatory. The maximum values of the lefthand column of sliders alter depending on their combined settings. The maximum number of frames across is dictated by the "Frame Width". This is to prevent the image getting too big for this page. This is also why, when you adjust one slider you may see another slider move.

You can drag a slider along its bar to change the value quickly. You can click once on the bar to move the slider one step in that direction. You can also click on the bar and hold to make the slider move toward the mouse pointer.

The complete tcl needed to display this line on a webpage is fully displayed in the text box. You will notice that it reflects every change you make as you paint. When you press the "Save" button this code fragment is saved in your Safe-Tcl temp file directories under the name of "freize.txt". This code fragment can then be copied, as is, into your HTML page.

Because this painter can produce arrays of frames it is tempting to produce complex designs. However this painter was designed to allow you to get simple horizontal rulers simply: the array was just an extension of the single frame.

The colour effect of a freize changes as the borderwidth increases because more of the darker and lighter border shades are seen.This effect can be different for different colours because the border shades selected from the palette may be a little removed from the basic colour. For the same reason a slight change in the colour may not change the border shades. These subtleties will only be of interest to the "colour specialist".


©2000 - 2006 WEBSCOOL This page last updated 02 Jun 2006. All rights reserved - including copying or distribution of any portion of this document in any form or on any medium without authorisation. For more regarding the copyright.