[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: vic typo?



Christopher Cope wrote:
> Hi, I've been messing around with vic, and came across what I think is a 
> typo, though I'm fairly incompetent with Tcl, so maybe it's a way to 
> change class variables, though I doubt it, but at the time I'm hunting for 
> that syntax anyway. :)
> 
> mash/tcl/vic/ui-visualframe.tcl line 216
> 
> $self set_dither Gray
> 
> 
> theres a function named set-dither, so its simply a -/_ typo.

oops, good catch.  i checked in the change.

> Class foo {
>  blah 1
> }

this isn't valid otcl syntax.  unlike c++/java/etc the class
declaration and declarations of individual methods are separate
commands that don't have to be batched up together.

> i haven't been able to find a very indepth tcl reference online, so i'm 
> mostly learning from code examples

there are decent books about tcl available, i would assume there
are good web references as well but i don't know of any off the
top of my head...  as for the otcl extensions, have you looked at
the documentation in mash-code/otcl/doc/tutorial.html?

> to reference a class var, i use
> 
> set foo [$self get_option blah]
> 
> is this the best way to do this?

options (retrieved with get_option) are different from class
variables.  options are intended to things like command line
options/etc supplied by the user.  class variables of course
hold much more internal state.

> how do change the value of blah?
> 
> set blah 2 ?
> 
> im using that but blah seems to revert back to 1 once i leave the 
> function.

right, you're mixing up variables and options.  see the
section on instvar in the otcl tutorial.

-Andrew