Questions tagged [incr-tcl]

[incr Tcl] is an object system package for the Tcl programming language.

[incr Tcl] (often abbreviated to “itcl” for ease of typing) is an object system for Tcl. It is usually used as an extension package — loaded with package require Itcl — and was originally developed for Tcl 7.* but which has been updated subsequently for the faster Tcl 8 system model. It provides a model of objects that is a hybrid between the command-focussed model of Tcl and the class model of (pre-template) C++. It is probably the most commonly used object system for Tcl, though many others exist.

Itcl also has the distinction of having inspired a number of features in the core Tcl language. These notably include namespaces and ensembles, as well as the TclOO object system that is present from Tcl 8.6 onwards. Note that a version of [incr Tcl] (4.0) is also supplied with Tcl 8.6 so as to make it far easier for existing code that depends on itcl, and that is built on top of the TclOO core.

25 questions
3
votes
2 answers

Static function inheritance in [incr Tcl]

Inheritance in incr Tcl doesn't work as expected. Consider the code below. package require Itcl ::itcl::class Base \ { public { proc function { } { puts "==== Base::function" } } } ::itcl::class Derived { inherit Base…
Vahagn
  • 4,670
  • 9
  • 43
  • 72
3
votes
1 answer

TCL: get the class name of an object?

How to get class name of itcl object or check if the object exists?
Ashot
  • 10,807
  • 14
  • 66
  • 117
2
votes
1 answer

TCL How to have as a class member an array (Itcl)

I want to have an array as a private class member. I use Itcl package. For lists and other simple variables I was writing: itcl::class MyClass { private variable m_myVar "" private variable m_myListVar {} .......... Now what I can do for array…
Narek
  • 38,779
  • 79
  • 233
  • 389
2
votes
1 answer

ITCL - How to access associative array member inside a class?

How to access associative array member of a class inside the class itself? Itcl is modeled after C++, and in C++ we would write: SomeObject.SomePublicMember = ... How to do the same in Itcl? Without providing accessor procedure for such an array.…
Aryaps
  • 21
  • 1
1
vote
1 answer

Incr Tcl Objects in List/Array/Dict

I'm trying to create a number of objects using itcl and then store them in a data structure so that i can invoke their methods later. But it is giving an error: The following is the code i have written: itcl::class router { variable…
Jit
  • 11
  • 1
1
vote
2 answers

How to generate unique names for Tk toplevel window paths?

I need a way to generate an unused name for Tk toplevel window paths, just like #auto does it for Itcl objects. How can I do that? Maybe Tk has a similar utility?
Vahagn
  • 4,670
  • 9
  • 43
  • 72
1
vote
1 answer

Why I can't set the common variable a property to be private or public?

In TCL's Itcl package there is a way to define a class and static members for that class using common keyword. But I have never seen that common variable was declared as private or public? Can we do that? If no, then why?
Narek
  • 38,779
  • 79
  • 233
  • 389
1
vote
1 answer

Difference between calling $this or not

Using Tcl8.5, is there a difference between calling $this inside a method and not calling it? e.g.: package require Itcl namespace import itcl::* class MyCls { method foo {} method bar {} } body MyCls::bar {} { return "hi" } body…
Dor
  • 7,344
  • 4
  • 32
  • 45
1
vote
1 answer

Using incr-tcl with version 8.4.19

Is it possible to use incr-tcl when working with tcl version 8.4.19? Which include packages are required? Until now we used Active-Tcl version 8.6, which came with incr-tcl built-in. Now we need to support stations that only have version 8.4.19…
dzisner
  • 315
  • 4
  • 14
1
vote
1 answer

Tcl Can I assign an object to reg variable?

I want to assign an object to a reg variable, but I don't know if I could do it, and if yes, how can I do it, what is the syntax? For example, I have a class Var: class Var { constructor {Name values order} {} { set mName…
0
votes
1 answer

How to check if one class is a base of another in [incr Tcl]?

Givetn two class names, className1 and className2, how can I check if className1 has className2 anywhere in its heritage?
Vahagn
  • 4,670
  • 9
  • 43
  • 72
0
votes
1 answer

How to call itcl::scope for an arbitrary object of the current class?

itcl::scope returns the full name of the specified member variable of $this. How can I call itcl::scope for another object of the same class (not for $this)? Here is a workaround. itcl::class dummy { variable m_data method function { other…
Vahagn
  • 4,670
  • 9
  • 43
  • 72
0
votes
2 answers

How to make scrolledtext online?

Here is a demo sample of TCL code for iwidgets::scrolledtext. package require Iwidgets iwidgets::scrolledtext .st \ -labeltext "Scrolledtext Example" \ -visibleitems 70x20 \ -textfont {Courier 10} \ -textbackground…
Vahagn
  • 4,670
  • 9
  • 43
  • 72
0
votes
2 answers

How to get a reference on the Itcl class member variable?

Say I have the following structure: package require Itcl itcl::class AAA { private variable m_list {} constructor {} { fill m_list list } } How to get a reference on the m_list in order to write foreach elem $reference {.......}…
Narek
  • 38,779
  • 79
  • 233
  • 389
0
votes
1 answer

TCL Error: can't set "::streamID(1,10,1)": variable isn't array

I have read the thread, Cant read variable, isnt array, and I think may be related somehow, but I can't figure out how. In the following TCL snippet, a three dimensional array ::stream is tested and a value is read. The array contains a scalar ID…
Rich Maes
  • 1,204
  • 1
  • 12
  • 29
1
2