Sujet : Re: tablelist and unknow
De : csaba.nemethi (at) *nospam* t-online.de (nemethi)
Groupes : comp.lang.tclDate : 06. Oct 2024, 11:34:08
Autres entêtes
Message-ID : <vdtp30$2hfu$1@tota-refugium.de>
References : 1 2 3
User-Agent : Mozilla Thunderbird
Am 05.10.24 um 20:45 schrieb Manfred Stelzhammer:
Sorry, I'm wrong, the workaround does'nt work.
regards
Manfred
Am 05.10.24 um 19:32 schrieb Manfred Stelzhammer:
Hi
>
I found a workaround.
>
I create a proc moveCol.
>
##
proc moveCol {args} {::tablelist::moveCol {*}$args}
##
>
regards
>
Manfred
>
>
Am 05.10.24 um 19:24 schrieb Manfred Stelzhammer:
Hi
>
If I create a tablelist widget with "-movablecolumns 1" an I'll move a column it works ok.
>
But if I have a proc "unknown" I cann't move a column.
>
##
>
proc unknown {args} {puts "unknown : $args"}
>
##
>
If I move in the tablelistwidget a column I get:
>
% unknown : moveCol .tbl 2 1
>
But the position from the column don't change.
>
How can I solve the problem?
>
regards
>
Manfred
>
>
>
>
>
1. As pointed out by daveb, it is dangerous to override the default unknown proc. In addition, your unknown proc just prints its arguments, which, of course, won't change the position of any column.
2. Your "workaround" that uses a proc moveCol:
proc moveCol {args} { ::tablelist::moveCol {*}$args }
works for me as expected. For example,
moveCol .tbl 2 1
does move column 2 before column 1.
3. The above works, but it uses the ::tablelist::moveCol proc, which belongs to the implementation of the tablelist widget, not to its documented, public API. It is much better to use something like
proc moveCol {args} {
lassign $args tbl sourceCol targetCol
$tbl movecolumn $sourceCol $targetCol
}
-- Csaba Nemethi https://www.nemethi.de mailto:csaba.nemethi@t-online.de