Home > Archive > Tcl > May 2006 > What is the meaning of the command "tk_getOpenFile" ?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
What is the meaning of the command "tk_getOpenFile" ?
|
|
| maura.monville@gmail.com 2006-05-27, 10:04 pm |
| I found a command "Tcl_GetOpenFile(interp, string, write, checkUsage,
filePtr)" but its name and parameters are not he same as I see here
"tk_getOpenFile" being used.
I could non find any "tk_getOpenFile" in the Tk On-line library . Nor
this is a new Tcl/Tk command as
there is no such proc or routine.
There are 3 uses of this command whose syntax does not coincide:
set track_info(file_name) [ tk_getOpenFile \
-filetypes $track_file_types \
-defaultextension ".PLOT" \
-initialdir "." \
-initialfile $track_info(file_name) \
-title "Track data"]
set hist_info(file_name) [ tk_getOpenFile \
-filetypes $hist_file_types \
-defaultextension ".hbook" \
-initialdir "." \
-initialfile $hist_info(file_name) \
-title "HBOOK files"]
set part_file [tk_getOpenFile -filetypes $types]
I'm . Where can I find an explanation for this command ?
Thank you.
Maura
| |
| Donald Arseneau 2006-05-28, 4:06 am |
| "maura.monville@gmail.com" <maura.monville@gmail.com> writes:
> I found a command "Tcl_GetOpenFile(interp, string, write, checkUsage,
> filePtr)"
That is a C API routine, not the Tk command of almost the same
name. The two do very different things.
> I could non find any "tk_getOpenFile" in the Tk On-line library . Nor
??? It is there in the obvious place: Tk built-in commands.
man n tk_getOpenFile
or use a graphical (html) browser for the docs. It opens a file-selection
dialog, and returns the selected file name when done.
> there is no such proc or routine.
Sure there is.
$ wish
% info command tk_get*File
tk_getOpenFile tk_getSaveFile
> There are 3 uses of this command whose syntax does not coincide:
Looks like the same syntax to me. The third one didn't specify many
options.
--
Donald Arseneau asnd@triumf.ca
| |
|
|
| Gerald W. Lester 2006-05-28, 8:06 am |
| maura.monville@gmail.com wrote:
> I found a command "Tcl_GetOpenFile(interp, string, write, checkUsage,
> filePtr)" but its name and parameters are not he same as I see here
> "tk_getOpenFile" being used.
Yes, so? The first is a C API routine, the second is a Tcl/Tk procedure that
comes with Tk.
> I could non find any "tk_getOpenFile" in the Tk On-line library .
Where in the world are you looking, that has been in Tk for a very long time????
> Nor
> this is a new Tcl/Tk command as
> there is no such proc or routine.
>
> There are 3 uses of this command whose syntax does not coincide:
>
>
> set track_info(file_name) [ tk_getOpenFile \
> -filetypes $track_file_types \
> -defaultextension ".PLOT" \
> -initialdir "." \
> -initialfile $track_info(file_name) \
> -title "Track data"]
>
> set hist_info(file_name) [ tk_getOpenFile \
> -filetypes $hist_file_types \
> -defaultextension ".hbook" \
> -initialdir "." \
> -initialfile $hist_info(file_name) \
> -title "HBOOK files"]
>
> set part_file [tk_getOpenFile -filetypes $types]
>
> I'm . Where can I find an explanation for this command ?
Gee, they all seem to be using the same syntax to me!
Of course the third one is not passing in as many optional parameters as the
first two, but that is why they are optional.
--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
| |
| Aric Bills 2006-05-28, 7:10 pm |
| No offence to Gerald or anyone else, but geniality has always been a
hallmark of the Tcl community. Surely we can answer the questions of
an exasperated newcomer to Tcl in a way that is inviting rather than
exacerbating. Kindness and consideration are in the long-term interest
of Tcl and everyone who uses it.
| |
| Gerald W. Lester 2006-05-29, 8:07 am |
| Aric Bills wrote:
> No offence to Gerald or anyone else, but geniality has always been a
> hallmark of the Tcl community. Surely we can answer the questions of
> an exasperated newcomer to Tcl in a way that is inviting rather than
> exacerbating. Kindness and consideration are in the long-term interest
> of Tcl and everyone who uses it.
My apologies if I have offended you are anyone else.
I encourage you to "take over" attempting to help this "exasperated newcomer
to Tcl".
--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
| |
| Steve Landers 2006-05-29, 8:07 am |
| Aric Bills wrote:
> No offence to Gerald or anyone else, but geniality has always been a
> hallmark of the Tcl community. Surely we can answer the questions of
> an exasperated newcomer to Tcl in a way that is inviting rather than
> exacerbating. Kindness and consideration are in the long-term interest
> of Tcl and everyone who uses it.
It's a timely reminder, but knowing Gerald I'm sure that he didn't
intend to be ungracious (if it was taken that way).
Steve
| |
|
| For what it's worth, the first time I found the tk_* dialogs was in the
C routines section, and not in the Tk section. I didn't know about C
hooks, yet, so it was really confusing.
Maura: after implementing some examples, I think you'll find that it's
pretty easy to use, and very flexible. You can use it with no
parameters at all:
set fp [open [tk_getOpenFile]]
or with several options for a smoother experience for the user. From
the man page:
set types {
{{Text Files} {.txt} }
{{TCL Scripts} {.tcl} }
{{C Source Files} {.c} TEXT}
{{GIF Files} {.gif} }
{{GIF Files} {} GIFF}
{{All Files} * }
}
set filename [tk_getOpenFile -filetypes $types]
if {$filename != ""} {
# Open the file ...
}
| |
| Kevin Kenny 2006-05-29, 7:09 pm |
| maura.monville@gmail.com wrote:
> I could non find any "tk_getOpenFile" in the Tk On-line library . Nor
> this is a new Tcl/Tk command as
> there is no such proc or routine.
I don't know where you were looking, but the manual has it:
http://www.tcl.tk/man/tcl8.4/TkCmd/getOpenFile.htm
Tcl_GetOpenFile is a C function, not a Tcl command. Don't worry about
it unless you're extending Tcl in C code.
--
73 de ke9tv/2, Kevin
|
|
|
|
|