Я занимаю несколько столбцов в зависимости от длины строки в treectrl и хочу показать третий столбец рядом с первым столбцом.
Я создал виджет дерева с помощью tktreectrl.
Внутри этого я создал несколько столбцов:
(дерево - это путь к дереву-виджету)
set columnID colItem
set columnID2 colzwei
set columnID3 coldrei
set columnID4 colvier
set columnID5 colfuenf
set columnID6 colsechs
$tree column create -expand no -weight 1 -text "Ergebnis:" -tags colItem -font $fontArr(font:12bold) -borderwidth 1
$tree column create -expand no -weight 4 -text "2" -tags colzwei -borderwidth 1 -font $fontArr(font:12bold) -uniform a -width 15
$tree column create -expand no -weight 4 -text "3" -tags coldrei -borderwidth 1 -font $fontArr(font:12bold) -uniform a
$tree column create -expand no -weight 4 -text "4" -tags colvier -borderwidth 1 -font $fontArr(font:12bold) -uniform a -width 15
$tree column create -expand yes -weight 4 -text "5" -tags colfuenf -borderwidth 1 -font $fontArr(font:12bold) -uniform a
$tree column create -expand yes -weight 4 -text "6" -tags colsechs -borderwidth 1 -font $fontArr(font:12bold) -uniform a
Эти столбцы должны быть заполнены несколькими данными.
Я хотел бы иметь, что spanning ведет себя по-разному в зависимости от длины данного текста.
(txt1 и txt2 задаются другой функцией и выглядят так:
txt 1:Grünland-Acker (GrA), Lehmiger Sand (lS), Bodenstufe (II), Wasserstufe (3), Klimastufe 7,9 ° - 7,0 ° C (b), Grünlandgrundzahl 33, Grünlandzahl 29
txt2: 1610 м²)
set itemID [$tree item create -button auto -tags $zel]
.,.
if {[string length $txt1] > 100} {
$tree item span $itemID colItem 3
$tree item span $itemID colfuenf [$tree column count]
} else {
$tree item span $itemID coldrei [$tree column count]
}
Later I configure the text:
if {[string length $txt1] > 100} {
$tree item style set $itemID $columnID styAny $columnID5 styAny
$tree item text $itemID $columnID $txt1 $columnID5 $txt2
} else {
$tree item style set $itemID $columnID styAny $columnID3 styAny
$tree item text $itemID $columnID $txt1 $columnID3 $txt2
}
$tree item element configure $itemID $columnID elemTxtName -font [list $fontArr(font:12normal) {}] -justify right
Данные в третьем столбце (coldrei) отображаются с некоторым пробелом, если открыта часть дерева с длинным текстом.Если я закрою эту часть дерева, данные в третьем столбце будут близки к первому столбцу (всего 15 пикселей второй строки, как и ожидалось).Как я могу получить третий столбец рядом с первым столбцом, даже если часть дерева с длинными данными открыта?
Как это выглядит с частью с открытым длинным текстом (в данном случае это "Bodenschätzung"")
Вот как это выглядит при закрытой кнопке" Bodenschätzung ".
Поэтому я хочу, чтобы другие элементы всегда имели одинаковое пространство между txt1 и txt2 независимо от того, открыта или закрыта кнопка «Bodenschätzung».Как я могу это сделать?