0
votes

Basically, I'm trying to create a get method for a tcl class that I have so that I can access data inside that class within a proc that isn't inside a class. For example, it would look like this:

itcl::class foo {

    set list []
    proc getFilterList {} {
        return $list 
    }
}

proc bar {} {
    set list itcl::foo::getFilterList 
}

But hilariously the the list contains the phrase "itcl::foo::getFilterList" so I'm obviously doing something wrong. Sorry if this is an obvious one, I just can't seem to figure it out.

In addition to following the selected answer, I also made my variable available at a global scale which works for me seeing as how from creation to manipulation I know exactly when my variable is being modified and when I can access it's values.

1

1 Answers

1
votes

Use

proc bar {} {
    set list [itcl::foo::getFilterList]
}