Variable query...

4 views
Skip to first unread message

Simon Galton

unread,
Mar 15, 1996, 3:00:00 AM3/15/96
to

I would like to have a status window with a label containing a message
code (referred to by, say, variable $messagecode) that will autoupdate as
the contents of the variable changes.

I tried:

$cmain->Label(-text => \$messagecode)->pack(-side => 'top');

as a test and got a lovely message about SCALAR info, but that wasn't
what i was fishing for... :)

I plan to have many of these and don't want to have reams of ->configure
statements everywhere - has anyone got any tips?

Thanks!
Simon

Simon Galton - gal...@candu.aecl.ca | I thought I saw Heisenberg this morning,
Atomic Energy of Canada, ITS Dept. | but I'm not certain...
I do not speak for my company, only myself!


--
This article was gatewayed from the p...@guest.wpi.edu mailing list.
Problems? re...@carbon.cudenver.edu. Subscriptions: majo...@guest.wpi.edu

Simon Galton

unread,
Mar 15, 1996, 3:00:00 AM3/15/96
to
On Fri, 15 Mar 1996, Stephen O. Lidie wrote:

> > $cmain->Label(-text => \$messagecode)->pack(-side => 'top');
> >>>>>
>

> make it -textvariable

Fantastic, Stephen. Exactly what I'm looking for!

Eeeet works! Eeet works! They said I was maaaaad! But eet works! Hahahha!

Simon

Simon Galton - gal...@candu.aecl.ca | This is your brain. This is your brain
Atomic Energy of Canada, ITS Dept. | on /bin/sh. Any questions?

KOBAYASI Hiroaki

unread,
Mar 15, 1996, 3:00:00 AM3/15/96
to

From: Simon Galton <gal...@candu.aecl.ca>

>
> I would like to have a status window with a label containing a message
> code (referred to by, say, variable $messagecode) that will autoupdate as
> the contents of the variable changes.

How about this?

#!/usr/local/bin/perl -w
# Slightly modified version of 'Tk-b10-tobe/labelpack'.
# Crazy demo of -labelVariable for Tk::Frame.
# See Tk::Frame::labelVariable.

use Tk;
require Tk::LabEntry;

my $mw = MainWindow->new;

my $canvas_total = 'Entry Text';
my $le_t_text = 'The Label';

$le = $mw->LabEntry(-textvariable =>\$canvas_total,
-labelVariable => \$canvas_total,
-labelPack => [-side => 'left']);

$le->pack(-expand => 1, -fill => 'x');

MainLoop
unless caller;

__END__

========
KOBAYASI Hiroaki -- koba...@sowa.is.uec.ac.jp --
If you feel my english is strange, please correct me.

Simon Galton

unread,
Mar 15, 1996, 3:00:00 AM3/15/96
to

I see I have a lot to look forward to with Tk-10!

It was all so much simpler when you just loaded registers... :)

Simon

Simon Galton - gal...@candu.aecl.ca | This is your brain. This is your brain


Atomic Energy of Canada, ITS Dept. | on /bin/sh. Any questions?
I do not speak for my company, only myself!

--

Reply all
Reply to author
Forward
0 new messages