"-command" option, where argument of a procedure has space...
- From: ZB <zbREMOVE_THIS@xxxxxxxxxxxxxxxxxxxx>
- Date: 06 Mar 2008 22:15:29 GMT
Noticed annoying thing:
Created a simple menu using ttk::menubutton, where a commands have been
added to each entry. The command option looked like:
-command "makeThis $parameter"
Procedure makeThis has been defined, that it has just one argument.
The problem was, when $parameter had space inside; there was immediately
"wrong # args" error reported. So I had to change it to:
-command [list makeThis "$parameter"]
But I think, the present "-command" behaviour is buggy. The $parameter is
_one_ string, just (sometimes) with space inside. It should be noticed, and
not treated like this:
-command "makeThis $parameter $another_parameter"
My opinion seems to be confirmed by example:
#v+
tclsh8.5 [~]proc sayit { what } { puts $what }
tclsh8.5 [~]set a "Hallo, boys"
Hallo, boys
tclsh8.5 [~]sayit $a
Hallo, boys
tclsh8.5 [~]
#v-
As you can see, the interactive example works properly; it was "-command"
option, which "evaluated"(?) "makeThis $parameter" to 3 separate strings
- instead of keep just two: procedure name, and (just one!) parameter string.
--
ZB
.
- Follow-Ups:
- Re: "-command" option, where argument of a procedure has space...
- From: Gerhard Reithofer
- Re: "-command" option, where argument of a procedure has space...
- From: Bryan Oakley
- Re: "-command" option, where argument of a procedure has space...
- From: Bruce Hartweg
- Re: "-command" option, where argument of a procedure has space...
- Prev by Date: Re: vwait behavior
- Next by Date: Re: "-command" option, where argument of a procedure has space...
- Previous by thread: Automatic Notification of a File Change
- Next by thread: Re: "-command" option, where argument of a procedure has space...
- Index(es):