diff --git a/lib/files.tcl b/lib/files.tcl index 8d1d27b..23b58ea 100644 --- a/lib/files.tcl +++ b/lib/files.tcl @@ -398,6 +398,10 @@ namespace eval FileOper { regsub -all {\.|/|\\|\s} $fileFullPath "_" itemName set itemName "$nbEditor.$itemName" set treeItemName [Tree::InsertItem $tree {} $fileFullPath "file" $fileName] + + # переместим указатель на нужный файл в дереве + Tree::SelectItem $treeItemName + if {[winfo exists $itemName] == 0} { NB::InsertItem $nbEditor $fileFullPath "file" Editor::Editor $fileFullPath $nbEditor $itemName diff --git a/lib/notebook.tcl b/lib/notebook.tcl index bacfbd5..338d4fb 100644 --- a/lib/notebook.tcl +++ b/lib/notebook.tcl @@ -38,8 +38,13 @@ namespace eval NB { } proc PressTab {w x y} { + global tree if {[$w identify tab $x $y] ne ""} { $w select [$w identify tab $x $y] + set nbItem [string trimleft [$w select] "$w."] + # puts $nbItem + append treeItemName "file" "::" $nbItem + Tree::SelectItem $treeItemName } else { return } @@ -54,6 +59,7 @@ namespace eval NB { } proc NextTab {w step} { + global tree set i [expr [$w index end] - 1] set nbItemIndex [$w index [$w select]] if {$nbItemIndex eq 0 && $step eq "-1"} { @@ -63,7 +69,14 @@ namespace eval NB { } else { $w select [expr $nbItemIndex + $step] } + set nbItem [string trimleft [$w select] "$w."] + # puts $nbItem + append treeItemName "file" "::" $nbItem + Tree::SelectItem $treeItemName + set txt [$w select].frmText.t - focus -force $txt.t + if [winfo exists $txt] { + focus -force $txt.t + } } } diff --git a/lib/tree.tcl b/lib/tree.tcl index 5d378e6..2cf7fe8 100644 --- a/lib/tree.tcl +++ b/lib/tree.tcl @@ -136,4 +136,12 @@ namespace eval Tree { return [$tree item $item -values] } } + + proc SelectItem {treeItemName} { + global tree + if [$tree exists $treeItemName] { + $tree see $treeItemName + $tree selection set $treeItemName + } + } }