Documentation‎ > ‎Display‎ > ‎

gnocl::splashScreen

A widget that displays a splashscreen for use during an application start up and initialization.

Synopsis

gnocl::splashScreen [-option value...]

Screenshot



Options

-progressBar boolean (default: 1)
Parameter to determine whether or not to display a progress bar at the bottom of the splashscreen.
-appName string (default = "")
The name of the application for which this widget is the splashscreen.
-version string (default = "")
Application version details to be displayed in the splashscreen.
-backgroundImage string (default = "")
Name of image to use as background graphic for the splashscreen.
-mask string (default = "")
Name of bitmap object to use inorder create a non-retangular splashscreen.
-exitCommand string (default = "")
Tcl script to be executed when the splashscreen widget is destroyed.
-byLine string (default = "")
Provide additional information string.
-defaultWidth integer (default = 480)
Override default splashscreen height..
-defaultHeight integer (default = 300)
Override default splashscreen height..
-backgroundColor string (default = "")
Set the background colour for the slashscreen.

Description

A button widget executes a command on mouse click.

Commands

id cget option
Returns the value for one option. The option may have any of the values accepted by configure.
id configure [-option value...]
Configures the widget. Option may have any of the values accepted on creation of the widget.
id delete
Deletes the widget and the associated tcl command, results in the execution of the Tcl script specified by the -exitCommand option.
id class
Return the class for this widget object, i.e. 'splashScreen'.
id push <message>
Push message onto the display stack for the screen.
id progress <values>
Adjust the length of the progress bar. A list comprising of two values is accepted by this command. The first value indicates the step in the progress sequence, and second value the maximum number of steps in the application launch sequence. As these values are stored internally by the widget, the value corresponding to the maximum number of step needs only to be defied once in a script unless it needs changing.

Example


# basic Tcl/Gnocl Script
#!/bin/sh \
exec tclsh "$0" "$@"
package require Gnocl

#---------------
# Cairo Colour Palette
# cairo prefers colour, range 0 - 1.0
#---------------
set WHITE {1 1 1}
set RED {1 0 0}
set GREEN {0 1 0}
set BLUE {0 0 1}
set CYAN {0 1 1}
set MAGENTA {1 0 1}
set YELLOW {1 1 0}

#---------------
# initialize the widget
#---------------
set ss [gnocl::splashScreen ]

#---------------
# test configure command
#---------------
$ss configure -backgroundColor red
#$ss configure -backgroundImage splashScreen.png
$ss configure -onDestroy {
    puts 1
    puts 2
    puts 3
    }

#---------------
# some basic formating offsets
#---------------
set x 12
set y 50

#---------------
# complete the text fields
#---------------
$ss add appName "Jiumoluo" \
    -font "Sans 30 Normal Bold" \
    -color $WHITE \
    -position [list $x 70]
$ss add caption "Translator's Text Editor" \
    -font "Sans 18" \
    -color $WHITE \
    -position [list  $x 95 ]
$ss add version "Version: 0.5.0" \
    -font "Sans 14" \
    -color $WHITE \
    -position [list  $x 120 ]
$ss add byLine  "Created by William J Giddings." \
    -font "Sans 14" \
    -color $WHITE \
    -position [list  $x 140 ]
$ss add copyright "Distributed under the terms of the BSD Licence" \
    -font "Sans 12" \
    -color $WHITE \
    -position [list $x 200 ]

#---------------
# give some loading feedback
#---------------
set max 50
for {set i 0} {$i <= $max} {incr i} {
    $ss push "Loading packages ... $i"
    $ss progress [list $i $max]
    gnocl::update
}

puts "$ss is a  [$ss  class]"

$ss delete

#---------------
# create a simple application
#---------------
set but1 [gnocl::button \
    -text "CLOSE SPLASH" \
    -onClicked {
        catch { $ss delete }
        exit } ]

gnocl::window \
    -child $but1 \
    -onDestroy {
        catch { $ss delete }
        exit }

gnocl::mainLoop




Comments