2014-10-28 87 views

回答

0

可以調用這個子程序幾次終止此操作:

proc highlightView {object} { 
    .c bind $object <Enter> [list %W itemconfigure $object -width 4] 
    .c bind $object <Leave> [list %W itemconfigure $object -width [.c itemcget $object -width]] 
} 

你可以改變顏色使用選項-fill突出對象:

proc highlightView {object} { 
    .c bind $object <Enter> [list %W itemconfigure $object -fill red] 
    .c bind $object <Leave> [list %W itemconfigure $object -fill [.c itemcget $object -fill]] 
} 
1

可以綁定<Leave>事件不做任何變更:

.c bind $object <Leave> [list %W itemconfigure $object -width 1] 

如果你有多種線寬的對象,那麼你需要在一些地方保存先前的寬度或<Leave>事件與適當的寬度綁定:

.c bind $object <Enter> [subst { 
    %W bind <Leave> [list %W itemconfigure $object -width [%W itemcget -width]] 
    %W itemconfigure $object -width 4 
}] 
+0

由於Tk的保證最多隻有一個帆布產品電流(即,已經''ED),只是存儲在一個全球性的價值變量就足夠了。 – 2014-10-28 09:26:31

+0

謝謝Slebetman先生,經過一些修改後正在工作。但是你的想法非常有用。 – 2014-10-28 09:56:44

相關問題