Jim Kraai wrote:
> 
> Greetings,
> 
> I had a weird one last night w/ vtcl 1.10 over Linux (RH4.2).
> 
> I made a button and put a command in it, something like this:
> "if {[check_proc "Check proc test string]} {
> "       puts "check was ok, ent(asdf) is $ent(asdf)
> ")
> 
> When I tried to run the script, it gave me a compile error.
> 
> When I looked at the auto-generated code, I saw something like
> this:
> "... \
> "-command \n
> "if\ {\[check_proc\ \"Check\ proc\ test\ string\]}\ \{\n
> "\ \ \ \ puts\ \"check\ was\ ok,\ ent\(asdf\)\ is\ \$ent\(asdf\)\n
> "\)\n\n
> 
> When I expected:
> "... \
> "-command {
> "if {[check_proc "Check proc test string]} {
> "       puts "check was ok, ent(asdf) is $ent(asdf)
> ")}
> 
> Note that the code that I put into the command was not enclosed by
> curly-braces by vtcl.
> 
> check_proc is defined and returns zero or one.  Now, the array,
> ent, is globally defined, and didn't seem to be the problem.  When
> I removed the reference to ent, the problems didn't go away.
> 
> Ultimately, I copied another button that was working and changed
> the code to match what I wanted and everything worked fine.
> 
> My question is, what went awry?  Is this a 'feature' that I can
> exploit in the future?
> 
> Just thought this was interesting and worth note.
> 
> --jim

Mr Jim,
        You have sent the problem in a hurry!! I think now you have already got
the solution. your check_proc procedure may be right, but the if
construct itsef is wrong.
"if {[check_proc "Check proc test string]} {
"       puts "check was ok, ent(asdf) is $ent(asdf)
")
Errors in it.
1.quotes are not completed in 
        "Check proc test string
2.similarly uncomleted quotes in
        puts "check was ok, ent(asdf) is $ent(asdf)
3.body of If loop, is ended in
 ")" (bracket), but it should be "}"  (curly brace)

These are the common mistakes, we human beings usually do, but..

The command that yopu give will be stored as a buffer and will be copied
to the file as it is..
According to your statement, It noticed that
"Check proc test string]} {
    puts "check was ok, ent(asdf) is $ent(asdf)
"
which is under quotes, as argument to your procedure check_proc and it
cleary appended your keystrokes into the file.

That's all
really U have created some nice error. ThanX.

Regards.
Hamps
-- 
>   //// //// / Girish B Hampali Processor Systems (India) pvt ltd<
>  /__/ /__  /  E-mail:[EMAIL PROTECTED] ph:2273090   <         
> /       / /   [EMAIL PROTECTED] [EMAIL PROTECTED]      <
>/    //// /      KEEP  IN TOUCH WITH THE LATEST AROUND           <
---------------------------------------------------------------------------
To unsubscribe from the Visual Tcl mailing list, please send a message
to [EMAIL PROTECTED] with "unsubscribe vtcl [EMAIL PROTECTED]" in the
message body (where [EMAIL PROTECTED] is your e-mail address).

Reply via email to