Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Bug in Tk::Scrolled ?
(I posted this in perl modules, also - probably should have been here
instead)

I think there is a bug in Tk::Scrolled when trying to use a balloon.
The tag doesn't seem to get dereferenced properly.  If I do the
same thing with the Tk::Scrollbar, it works ok.  Here is a sample script
that illustrates both methods, and shows the problem when you let the
mouse hover over the lines.  I upgraded to the
latest Perl/Tk(804.027), and it still showed the "bug".

Any ideas?

Boyd
---------------------the script----------
#!/usr/bin/perl -w

use strict;
use Tk;
use Tk::Balloon;

my $mw = MainWindow->new;
my $tw = $mw->Toplevel;

my $sc = $mw->Scrolled('Canvas')->pack;
$sc->createLine(10,10,100,100,-tags=>'line1',-width=>5);
my $bal = $mw->Balloon;
$bal->attach($sc,-msg=>{line1=>'this is line1'});

my $sbx = $tw->Scrollbar(-orient=>'horizontal');
my $sby = $tw->Scrollbar(-orient=>'vertical');

my $cv = $tw->Canvas(
-xscrollcommand=>['set'=>$sbx],
-yscrollcommand=>['set'=>$sby],
);
$sbx->configure(-command=>[xview=>$cv]);
$sby->configure(-command=>[yview=>$cv]);

$sbx->pack(-side=>'bottom',-fill=>'x');
$sby->pack(-side=>'right',-fill=>'y');
$cv->pack(-side=>'left',-fill=>'both');

$cv->createLine(10,10,100,100,-tags=>'line2',-width=>5);
my $bal2 = $tw->Balloon;
$bal2->attach($cv,-msg=>{line2=>'this is line1'});

MainLoop;



Report this thread to moderator Post Follow-up to this message
Old Post
boyd
11-16-04 08:56 PM


Re: Bug in Tk::Scrolled ?
"boyd" <HeWillRejoice@yahoo.com> wrote in message
news:LUrmd.129$Zq3.125@fe61.usenetserver.com...
> (I posted this in perl modules, also - probably should have been here
> instead)
>
> I think there is a bug in Tk::Scrolled when trying to use a balloon.
> The tag doesn't seem to get dereferenced properly.  If I do the
> same thing with the Tk::Scrollbar, it works ok.  Here is a sample script
> that illustrates both methods, and shows the problem when you let the
> mouse hover over the lines.  I upgraded to the
> latest Perl/Tk(804.027), and it still showed the "bug".
>
> Any ideas?

This is a common error. You must ensure you use the "real" canvas widget as
opposed to the frame container.
See changes embedded below.

>
> Boyd
> ---------------------the script----------
> #!/usr/bin/perl -w
>
> use strict;
> use Tk;
> use Tk::Balloon;
>
> my $mw = MainWindow->new;
> my $tw = $mw->Toplevel;
>
> my $sc = $mw->Scrolled('Canvas')->pack;
> $sc->createLine(10,10,100,100,-tags=>'line1',-width=>5);
> my $bal = $mw->Balloon;

my $realcanvas = $sc->Subwidget('scrolled');
$bal->attach($realcanvas,-msg=>{line1=>'this is line1'});


#######> $bal->attach($sc,-msg=>{line1=>'this is line1'});
>
> my $sbx = $tw->Scrollbar(-orient=>'horizontal');
> my $sby = $tw->Scrollbar(-orient=>'vertical');
>
> my $cv = $tw->Canvas(
>      -xscrollcommand=>['set'=>$sbx],
>      -yscrollcommand=>['set'=>$sby],
> );
> $sbx->configure(-command=>[xview=>$cv]);
> $sby->configure(-command=>[yview=>$cv]);
>
> $sbx->pack(-side=>'bottom',-fill=>'x');
> $sby->pack(-side=>'right',-fill=>'y');
> $cv->pack(-side=>'left',-fill=>'both');
>
> $cv->createLine(10,10,100,100,-tags=>'line2',-width=>5);
> my $bal2 = $tw->Balloon;
> $bal2->attach($cv,-msg=>{line2=>'this is line1'});
>
> MainLoop;
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Jack D
11-17-04 01:56 AM


Re: Bug in Tk::Scrolled ?
Thanks, Jack.  Yes, I ran across the Subwidget method later and wondered
it that would fix it.
Boyd

Jack D wrote:
> "boyd" <HeWillRejoice@yahoo.com> wrote in message
> news:LUrmd.129$Zq3.125@fe61.usenetserver.com...
> 
>
>
> This is a common error. You must ensure you use the "real" canvas widget a
s
> opposed to the frame container.
> See changes embedded below.
>
> 
>
>
> my $realcanvas = $sc->Subwidget('scrolled');
> $bal->attach($realcanvas,-msg=>{line1=>'this is line1'});
>
>
> #######> $bal->attach($sc,-msg=>{line1=>'this is line1'});
> 
>
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
boyd
11-19-04 01:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PerlTk archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:58 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.