What's the magic to using Incr Tcl
- From: Andrew Falanga <af300wsm@xxxxxxxxx>
- Date: Fri, 29 Jun 2007 08:01:52 -0700
Hi,
I'm trying to learn to use the [incr Tcl] package and I seem to be
having some difficulty. I've downloaded a tutorial of sorts that I
found a link to from the main [incr Tcl] web site. It's called,
"Object-Oriented Programming with [incr Tcl]." I've figured out that
I must use a "package require Itcl" in my script to load the package.
however, then the interpreter bails saying that the command "class" is
unknown. I've also tried "Class" although none of the examples in
this tutorial use an upper case C in the word class.
So, after one brings in the functionality with "package require", how
does one actually use the package? I'm also using the manual pages on-
line from http://www.tcl.tk/man/itcl3.1/index.html and there it is
mentioned that the command name for class is "class". So, below is
the very simple script I've put together to familiarize myself with
this package, please tell me what I'm doing wrong.
Oh, nearly forgot, in case it's important, I'm using ActiveState TCL
on Windoze. Is it possible I'm getting the wrong package?
Thanks,
Andy
puts [package require Itcl]
Class myClass {
variable int
constructor { i } {
puts "C-tor for myClass called: setting int to $i"
set int $i
}
destructor {
obliterate
}
method SetInt { i } {
set int $i
}
method ShowInt { } {
puts $int
}
method obliterate { } {
puts "inside destructor: obliterate"
unset int
}
}
myClass mc1 78
mc1 ShowInt
mc1 SetInt 33421
mc1 ShowInt
delete object mc1
.
- Follow-Ups:
- Re: What's the magic to using Incr Tcl
- From: Troy . Tanzer
- Re: What's the magic to using Incr Tcl
- From: Helmut Giese
- Re: What's the magic to using Incr Tcl
- From: Jeff Godfrey
- Re: What's the magic to using Incr Tcl
- Prev by Date: Re: A widget for the user's editor of choice
- Next by Date: Re: What's the magic to using Incr Tcl
- Previous by thread: tiny improvement of text widget ?
- Next by thread: Re: What's the magic to using Incr Tcl
- Index(es):
Relevant Pages
|