Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with Button and -command

0 views
Skip to first unread message

Keith

unread,
Nov 22, 2009, 7:02:58 PM11/22/09
to
foreach gg { 1 5 9 } {
button $gx.$gg.expert -text "Expert $gg" -command {tgid_expert $gg}
}

Since $gg is a changing variable how do I use it in -command?
IOW I want button
"Expert 5" to send the -command {tgid_expert 5}
"Expert 9" to send the -command {tgid_expert 9}
when the button is pressed.

There are 60 buttons in this widget.

--
Best Regards, Keith
http://home.comcast.net/~kilowattradio/
Tired of Google Groups?
http://home.comcast.net/~kilowattradio/usenet.html

Donal K. Fellows

unread,
Nov 22, 2009, 8:10:28 PM11/22/09
to
On 23 Nov, 00:02, Keith <kilowattra...@use-reply-to.invalid> wrote:
> Since $gg is a changing variable how do I use it in -command?

The [list] command builds those sorts of script fragments in exactly
the right way:

button $gx.$gg.expert -text "Expert $gg" \

-command [list tgid_expert $gg]

Donal.

0 new messages