#!/usr/bin/perl -w
# 實驗各種 option 的效果. 此處以 -bg, -text, 與 -bd 為例.
# 當你遇到其他有疑問的 options 時, 不妨多多利用這個程式 (加以修改) 來實驗.

use strict;
my (%W);

# use Tk;				#=NIS=#
# $W{_} = MainWindow->new();		#=NIS=#

use Tcl::Tk qw(:perlTk);		#=MBVK=#
my $interp = Tcl::Tk->new();		#=MBVK=#
$W{_} = $interp->mainwindow();  	#=MBVK=#

$W{_show} = $W{_}->Frame();
$W{_show}->pack(-side=>"left", -fill=>"both");
$W{_show_watchme} = $W{_show}->Label(-relief=>"ridge",
    -text=>"<no files selected>");
$W{_show_watchme}->pack(-side=>"top", -fill=>"both");

$W{_show_bd} = $W{_show}->Scale(-orient=>"horizontal",
    -from=>0, -to=>50, -length=>200, -command=>\&change_bd);
$W{_show_bd}->pack(-side=>"top", -fill=>"both");

$W{_ctrl} = $W{_}->Frame();
$W{_ctrl}->pack(-side=>"left", -fill=>"both");
$W{_ctrl_bg} = $W{_ctrl}->Button(-text=>"-bg",
    -command=>\&change_bg);
$W{_ctrl_bg}->pack(-side=>"top", -fill=>"both");
$W{_ctrl_text} = $W{_ctrl}->Button(-text=>"-text",
    -command=>\&change_text);
$W{_ctrl_text}->pack(-side=>"top", -fill=>"both");

MainLoop();

# =================================================================

sub change_bd {
    $W{_show_watchme}->configure(-bd=>$_[0]);
}

sub change_bg {
    my ($color) = $W{_show_watchme}->cget("-bg");
#    $color = $main->chooseColor(-initialcolor=>$color);
    return unless defined $color;
    $W{_show_watchme}->configure(-bg=>$color);
}

sub change_text {
    my ($fn); #= $main->getOpenFile();
    return unless defined $fn;
    $W{_show_watchme}->configure(-text=>$fn);
}

