Questions tagged [itcl]

[incr Tcl] is an object system for Tcl

56 questions
2
votes
0 answers

Is an itcl::delegation component static in TCL?

According to the ITcl man page a delegate method can be declared with delegate method methodName to componentName ?as targetName? (https://www.tcl.tk/man/tcl/ItclCmd/itcldelegate.html#M6). In the below code, for the Dog class there are two variables…
mvanle
  • 1,847
  • 23
  • 19
2
votes
1 answer

Itcl: inconsistency of $this variable

While doing my project migration from Tcl 8.5.9/Itcl 3.4 to Tcl 8.6.6/Itcl 4.0.5 I've faced with inconsistency of $this variable depending how it's accessed. Here is the minimized testcase: puts "Tcl version : $tcl_patchLevel" puts "Itcl version :…
GrAnd
  • 10,141
  • 3
  • 31
  • 43
2
votes
1 answer

Check Object Existence in TCL

I want to check that whether object exists or not in tcl. I looked into info object options but didn't found something specific for object existence and info exists only works for variables not objects. Any idea? I created an object of…
Dcode
  • 223
  • 1
  • 14
2
votes
2 answers

Any substitute for itcl::find in native OO?

Is there any substitute for itc::find in native OO. I need to delete all classes in a particular namespace My code runs like: foreach class [::itcl::find classes ::MYNAMESPACE::*] {catch {::itcl::delete class $class}} How do I do this in native OO?
Ulysses
  • 5,616
  • 7
  • 48
  • 84
2
votes
1 answer

Itcl What is the read property?

I want to control read access to an Itcl public variable. I can do this for write access using something such as: package require Itcl itcl::class base_model_lib { public variable filename "" } itcl::configbody base_model_lib::filename { …
Robert Lugg
  • 1,090
  • 2
  • 12
  • 40
2
votes
1 answer

Itcl configure method: How to use public variables with a config script?

What is the proper way of using config scripts of public variables in Itcl? I mean, this is what I want to do: class MyClass { private variable myVar public method setMyVar {arg} { if {![string is integer -strict $arg]} { …
peter.slizik
  • 2,015
  • 1
  • 17
  • 29
2
votes
1 answer

How to resource the itcl classes to without starting a tcl shell

With this Tcl script: A.tcl itcl::class ::A { variable list1 {} public method getList {} { return $list1 } } I do this: Start the tcl shell and interactively do source A.tcl then make changes to getList method in A.tcl To make…
user245011
  • 65
  • 1
  • 9
2
votes
3 answers

How to pass itcl object of one class to object of another class and use the functions of the passed objects?

In namespace ::NodeTypes I have a class NodeType1 and another object of another class NodeType2. I also have a class NetworkCollector and another object of another class NodeType2 I need to pass the objects of NodeType1 and NodeType2 as parameters…
Ulysses
  • 5,616
  • 7
  • 48
  • 84
1
vote
1 answer

How to use itcl::delegation in TCL?

The following delegation does not work. How do I get it to work ? package require itcl itcl::extendedclass Tail { method wag {} { return "Wag, wag, wag" } } itcl::extendedclass Dog { delegate method wag to tail constructor…
mvanle
  • 1,847
  • 23
  • 19
1
vote
1 answer

coroutine and itcl nested methods can lead to - Error: cannot yield: C stack busy

If a nested method of Incr Tcl class is called without using $this it's failed in coroutine with the error cannot yield: C stack busy But calling the same method through $this works. Why? What's the difference? Because it works both ways without…
GrAnd
  • 10,141
  • 3
  • 31
  • 43
1
vote
1 answer

Can we color Code or have colored display for puts in tcl?

i have some output in tcl which is printed using puts like this: puts "hello world" can we print the same in different color?
vinay
  • 53
  • 1
  • 8
1
vote
1 answer

do we have a TCL script to generate XML file?

i made a script using tcldom: package require utils package require testrunscheduler package require tdom tla::TSConfig::init -schedulerContext "Reporting" -environment production tla::TSDBFactory::getConnection db set testCaseList [$db doSQL…
vinay
  • 53
  • 1
  • 8
1
vote
2 answers

whats the better way to validate syntax of true of false value in itcl?

I have this piece of code which validates syntax of the true or false value, something like 1 is true and 0 is false and if something others then error off: itcl::body boolean::validateSyntax {} \ { if {![string equal [getData] "1"] && \ …
vinay
  • 53
  • 1
  • 8
1
vote
2 answers

need to remove multiple "-" from the string which is alpha numeric using tcl

I have this string: svpts-7-40.0001 And I need to remove the second '-' from this. Basically I am fetching values like these which would come with double '-' SOMETIMES. So if such variables are seen then I have to remove the second '-' and replace…
vinay
  • 53
  • 1
  • 8
1
vote
1 answer

Self refence within class methods in Itcl

Is it possible to refer to current object within the member method of a class. Kindly consider the code below: itcl::class widget { private variable inst method ChildCount {} { return [llength [keylkeys inst children]] } method…
Ulysses
  • 5,616
  • 7
  • 48
  • 84
1
2 3 4