[Xotcl] Fwd: Re: namespace in constructor referring an instvar?

Gustaf Neumann neumann at wu.ac.at
Wed Mar 16 14:07:50 CET 2011


Dear Tuyen,

Most likely, you want something like the following (see below). Adding
additional namespaces makes things more complicated. Creating procs from
a constructor is as well a rather unusual construction, normally you
want to define methods accessing the instance variables...

best regards
-gustaf neumann

===================
Class  create MatlabInterface -parameter {iss}
MatlabInterface instproc ok {} {
   my instvar iss
   tk_messageBox -type ok -icon info -title "MicWatch" -message $iss
}

MatlabInterface i1 -iss Hello?
i1 ok
===================

Am 16.03.11 13:40, schrieb Tuyen Hoang:
>  Can  anyone tell me how to refer an instvar from within a namespace defined
>  inside a  class constructor? With my attempt below the $iss in the tk_messageBox
>  line is  undefined.
>
>  Class  create MatlabInterface
>
>  MatlabInterface  instproc init {} {
>        my instvar iss
>        namespace eval MicWatch {
>            proc add {} {
>                tk_messageBox -type ok -icon info -title "MicWatch" -message
>  "$iss"
>            }
>        }
>  }
>
>  I’m new  to Tcl, let alone XOTcl, and don’t know how to search the posts in the
>  mailing  list so forgive me if the question has been asked before.
>
>  Regards,
>
>  Tuyen
>
>
>
>
>  _______________________________________________
>  Xotcl mailing list
>  Xotcl at alice.wu-wien.ac.at
>  http://alice.wu-wien.ac.at/mailman/listinfo/xotcl


-- 
Univ.Prof. Dr. Gustaf Neumann
Institute of Information Systems and New Media
WU Vienna
Augasse 2-6, A-1090 Vienna, AUSTRIA




More information about the Xotcl mailing list