Re: Tk::Balloon with life update
Nick Ing-Simmons <[email protected]>
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <[email protected]> |
Gerhard Petrowitsch <[email protected]> writes: >I'm sorry, I'm not experienced in those things. Anyway, here's >the patch: Applied to mainline sources. > >--- Balloon.pm Thu May 30 16:22:28 2002 >+++ BalloonNew.pm Mon Oct 25 16:45:11 2004 >@@ -276,10 +276,12 @@ > my $client = $w->{'client'}; > return if not defined $client or not exists $w->{'clients'}{$client}; > my $msg = $client->BalloonInfo($w, $w->pointerxy,'-balloonmsg'); >- # Dereference it if it looks like a scalar reference: >- $msg = $$msg if UNIVERSAL::isa($msg, 'SCALAR'); >- >- $w->Subwidget('message')->configure(-text => $msg); >+ # if it looks like a scalar reference, use the -textvariable switch >for a 'life update-able' balloon >+ if (UNIVERSAL::isa($msg, 'SCALAR')) { >+ $w->Subwidget('message')->configure(-text => undef, -textvariable => >$msg); >+ } else { >+ $w->Subwidget('message')->configure(-text => $msg, -textvariable => >undef); >+ } > $w->idletasks; > > return unless Exists($w); > >Regards, >Gerhard > > > >|---------+----------------------------> >| | | >| | | >| | | >| | | >| | | >| | Nick Ing-Simmons | >| | <[email protected]> | >| | | >| | Sent by: | >| | [email protected]| >| | .EDU | >| | | >| | 2004-10-25 04:28 PM | >| | Please respond to Nick | >| | Ing-Simmons | >| | | >|---------+----------------------------> > >---------------------------------------------------------------------------------------------------------------------------| > | | > | To: Gerhard Petrowitsch/STN/SC/PHILIPS@PHILIPS | > | cc: [email protected] | > | Subject: Re: Tk::Balloon with life update | > | | > | Classification: | > | | > | | > >---------------------------------------------------------------------------------------------------------------------------| > > > > >Gerhard Petrowitsch <[email protected]> writes: >>This patch works for me ('<' is new, '>' is original code): > >That isn't a 'patch' it is a diff ;-) > >Please do > >diff -u originalfile newfile > >(Use diff -c if you diff doesn't do -u ...) > >> >>279,284c279,282 >>< # if it looks like a scalar reference, use the -textvariable switch >>for a 'life updateable' balloon >>< if (UNIVERSAL::isa($msg, 'SCALAR')) { >>< $w->Subwidget('message')->configure(-text => undef, -textvariable >>=> $msg); >>< } else { >>< $w->Subwidget('message')->configure(-text => $msg, -textvariable >=> >>undef); >>< } >>--- >>> # Dereference it if it looks like a scalar reference: >>> $msg = $$msg if UNIVERSAL::isa($msg, 'SCALAR'); >>> >>> $w->Subwidget('message')->configure(-text => $msg); >> >>The patch could cause a problem with existing code using the reference and >>changing it while the Balloon is displayed, but NOT wanting it to >>show immediately, which is very likely extremely uncommon. >> >>Could this patch be included in the official 'Balloon' code, or would you >>rather prefer to have -ballonmsgvariable / -statusmsgvariable / >>-msgvariable >>switches? >> >>Regards, >>Gerhard >> >>-++**==--++**==--++**==--++**==--++**==--++**==--++**== >>This message was posted through the Stanford campus mailing list >>server. If you wish to unsubscribe from this mailing list, send the >>message body of "unsubscribe ptk" to [email protected] > > >-++**==--++**==--++**==--++**==--++**==--++**==--++**== >This message was posted through the Stanford campus mailing list >server. If you wish to unsubscribe from this mailing list, send the >message body of "unsubscribe ptk" to [email protected] -++**==--++**==--++**==--++**==--++**==--++**==--++**== This message was posted through the Stanford campus mailing list server. If you wish to unsubscribe from this mailing list, send the message body of "unsubscribe ptk" to [email protected]