Documentation‎ > ‎Commands‎ > ‎

gnocl::stockItem

Create an icon stock item from defined sources.

Synopsis

gnocl::stockItem subcommand [-option value...]

Description

  This function expands on the range of icons available to a particular script. To obtain a list of all available stock items, use the command gnocl::info allStockItems.

Commands

gnocl::stockItem add [-option value...]
Returns the value for the specified option. The option may have any of hte values accepted by configure.

Options

-label string (default: "")
Label by which the stock item is to be accessed.

-icon percent-string (default: "")
Image to be shown, can be either a file (prefix "%/") or a pixbuf (prefix "%?").

gnocl::stockItem remove [-option value...]
Removes specified stockitems from the available inventory.
TO BE IMPLEMENTED.

Example

 
#---------------
# test-stockitems.tcl
#---------------
# Created by William J Giddings
# 06-Oct-2010
#---------------

#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

package require Gnocl
#----- create stock item from an existing buffer -----#
set pb1 [gnocl::pixBuf load -file [pwd]/georgie.jpg]

gnocl::stockItem add \
    -label Georgie \
    -icon "%?$pb1"

#----- create stock item from disk objects  -----#
gnocl::stockItem add \
    -label News \
    -icon "%/[pwd]/news.png"

gnocl::stockItem add \
    -label White \
    -icon "%/[pwd]/night1.png"

gnocl::stockItem add \
    -label Black \
    -icon "%/[pwd]/night2.png"

#----- display the whole lot  -----#
set box [gnocl::box]
set but1 [gnocl::button -icon "%#News" -text News]
set but2 [gnocl::button -icon "%#White" -text White]
set but3 [gnocl::button -icon "%#Black" -text Black]
set but4 [gnocl::button -icon "%#Georgie" -text Black]
$box add [list  $but1 $but2 $but3 $but4 ]
gnocl::window -child $box
gnocl::mainLoop
Comments