Reputation: 699
Is it possible to create a button, for example, whose callback takes a parameters?
e.g.
button(-text => 'Row1', -command => \&do_something_with('Row 1'));
Tried it on a test program and it doesn't seem to. If that is the case, is there some other way to do what I intend with the example above?
My program needs to create buttons but the number is not known beforehand (depends on a .cfg file).
Upvotes: 1
Views: 191
Reputation: 247250
You probably need an anonymous subroutine that invokes your subroutine with at least one parameter.
button(-text => 'Row1', -command => sub {do_something_with('Row 1', @_)});
Upvotes: 1
Reputation: 21
I failed to understand your question clearly but from what i understood is it something like:
button(-text => 'Row1', -command => \&do_something_with('Row 1'));
ttk::button -text $row -command [list RowOpertaion $row $xyz $abc]
Here RowOperation is a proc with 3 parameters suppose row, abc, xyz. In that proc you can do the needful.
Upvotes: 0