The mandatory example:
$Spc::res_h{ blsc} = "hello"; $Spc::res_h{ hello_title} = { text => "Hello"}; $Spc::res_h{ hello_b1} = { name => "Press me", command => sub { Util::log( "hello world");}};
The BLSCs can be found in the Misc popup menu of the TkI toplevel widget. The GUI is displayed in figure 14.1. It displays a button, 'Press me', which sends the string 'hello world' to the log window of the TkI toplevel widget once it is pressed. Here are some details about the code:
$Spc::res_h{ blsc} = "hello";
hello
.
$Spc::res_h{ hello_title} = { text => "Hello"};
%Spc::res_h
hash. The indexing string is composed of the
generic name (hello
) and the keyword title
.
$Spc::res_h{ hello_b1} = { name => "Press me", command => sub {...}}
hello_b1
is composed of the generic part, the letter 'b', which
selects the button widget, and the number 1. The purpose of appending a number is
to distinguish between several buttons.