home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!gatech!darwin.sura.net!jvnc.net!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!torn!nott!bnrgate!bcars6a8!bnr.ca!norm
- From: norm@bnr.ca (Norm MacNeil)
- Subject: Re: dynamically changing text on labels
- Message-ID: <1992Dec22.153318.3371@bcars6a8.bnr.ca>
- Sender: usenet@bcars6a8.bnr.ca (Use Net)
- Nntp-Posting-Host: bcarh1ff
- Reply-To: norm@bnr.ca
- Organization: Bell-Northern Research Ltd.
- References: <1992Dec21.190502.23117@choreo.ca> <1992Dec22.143948.18360@cpu.com>
- Date: Tue, 22 Dec 1992 15:33:18 GMT
- Lines: 40
-
- In article <1992Dec22.143948.18360@cpu.com>, gwlester@cpu.com (Gerald W. Lester) writes:
- |> In article <1992Dec21.190502.23117@choreo.ca>, news@choreo.ca (Choreo NetNews Administration Account(Ottawa)) writes:
- |> >I have a window set up with a number of label widgets for presenting info to
- |> >the user which they cannot change. If they press a push button, I would
- |> >like to get the labels updated. The support code is there to reset some
- |> >stuff, but how can I change the labels? Using the label command only gets
- |> >me the expected error that the window exists in the parent.
- |> >
- |> >Any suggestions or other ideas would be helpful.
- |> >
- |> >Thanks, and Happy Holidays to all.
- |>
- |> If you create a label with the command:
- |>
- |> label .my_label -text foo_bar
- |>
- |> to change the label to snafu all you do is:
- |>
- |> .my_label configure -text snafu
- |>
-
- I think an easier way is to use the -textvariable parameter when defining the
- label:
-
- label .my_label -textvariable MyLabelVar
- set MyLabelVar "initial value"
-
- Then, whenever the variabel MyLabelVar changes, it automatically gets updated
- on the screen. I have used this when I wanted a "drop-down" button to display
- values that the user could choose from but the value has to be displayed on
- the screen as well in "read-only" fashion.
-
- Hope this helps,
- Norm.
-
- +-----------------------------------------------------------------------+
- Norm MacNeil Phone: (613) 763-3372
- Data Systems Fax: (613) 765-2854
- Bell-Northern Research Ltd. EMail: norm@bnr.ca (INTERNET)
- #include <disclaimer.std> "Roller bladers do it in-line!"
-