Prev: Bug in a widget
Next: TclOO: Can I execute a method from an object in the context ofanother object?
From: Georgios Petasis on 12 Apr 2010 12:38 Hi all, I am wondering the following: I have a class A. This class A has a variable named "background". Then, I have a class B. This class has a method (init) that sets a value to the variable background: class create B { method init {} { my variable background set background red } } If I have an object from class A, is there a way to execute the init method (from a B's object) into the context of the A object? Why I need this? I had a set of classes, that implement "items" on a canvas: http://www.ellogon.org/~petasis/tcl/TkRibbon/images/Ellogon-Ribbon-System-Logs.png There are two major kinds of "items", a "block" and a "connector" (the arrows). Right now, colours are coded inside the code (not a good approach). I am looking for a way to "theme" these classes, where the values for a set of variables can be retrieved from a "style" object. There is the alternative for the "item" object to query the value of each variable from the style object, but many variables and a few items (it may be slow). Any ideas? George
|
Pages: 1 Prev: Bug in a widget Next: TclOO: Can I execute a method from an object in the context ofanother object? |