[tcltk-perl] RE: widget demo
Brought to you by:
hobbs
From: Konovalov, V. <vko...@sp...> - 2004-09-09 08:35:29
|
> In the widget demo widget_lib/bind.pl (Hypertext) a error occurs on > > @normal = (-background => undef, qw/-relief flat/); > > This will cause errors. If set -background = 'white' > no error occurs. Question is how to set to default background > of a app? To say, this works: perl -MTk -we "$b=tkinit->Button(-bg=>'blue',-command=>sub{$b->configure(-bg=>'black')})-> pack;MainLoop" but this causes core dump when I press button (perl585,Tk804): perl -MTk -we "$b=tkinit->Button(-bg=>'blue',-command=>sub{$b->configure(-bg=>undef)})->pa ck;MainLoop" So I am not surprised it does not work with Tcl::Tk may be you need to save previous value and restore it instead of using undef? Yet I know this could be done with 'option' feature inTk, but I am not sure about details of it, because I never used it yet. > Also, how does someone do something like this. > > $ListBox->bind('<1>','selectLine'); > > then > > my $text= $ListBox->getSelected(); > > $ListBox s a ROText type box. I do it this way: $t->tag('bind','rep','<1>'=>sub { my $l = $t->tagPrevrange('rep','current'); my @sel = $t->tag('ranges','sel'); $t->tag('remove','sel',@sel) if $#sel>-1; if (exists $x{$l}) { print STDERR "[$x{$l}]\n"; call_display_parameters($x{$l}); } }); $t is text widget HTH Best regards, Vadim. |