Hello all:
In my application, I'd like to go to my desire directory when I click on different menu item, For example, If I click on the favorite of the menu item, I will go to "/home/stewang/Favourite ", for type of music will go to the path of the "/home/stewang/TypeOfmusic".
But my program does nothing, it always go the path where I
use my application.
Could anyone help me, please.
Thanks
rgds
stewang
In my application, I'd like to go to my desire directory when I click on different menu item, For example, If I click on the favorite of the menu item, I will go to "/home/stewang/Favourite ", for type of music will go to the path of the "/home/stewang/TypeOfmusic".
But my program does nothing, it always go the path where I
use my application.
Could anyone help me, please.
Thanks
rgds
stewang
Code:
menu .mbar
. configure -menu .mbar
menu .mbar.load -tearoff 0
# Add them to the menubar, providing "Alt-style" keyboard
# accelerators simply by indication which character in
# the label to underline.
.mbar add cascade -label "Load" -underline 0 -menu .mbar.load
set ::dir " "
.mbar.load add command -label "Favourite..." -underline 0 -command { set ::dir "/home/stewang/Favourite" } -command openFile
.mbar.load add command -label "TypeOfMusic..." -underline 0 -command { set ::dir "/home/stewang/TypeOfmusic" } -command openFile
.mbar.load add command -label "AgeOfItem..." -underline 0 -command { set ::dir "/home/stewang/AgeOfItem" } -command openFile
proc openFile { } {
set filename [tk_getOpenFile -defaultextension tk -initialdir $::dir ]
}