Spec-Zone .ru
спецификации, руководства, описания, API
Spec-Zone .ru
спецификации, руководства, описания, API
Библиотека разработчика Mac Разработчик
Поиск

 

Эта страница руководства для  версии 10.9 Mac OS X

Если Вы выполняете различную версию  Mac OS X, просматриваете документацию локально:

Читать страницы руководства

Страницы руководства предназначаются как справочник для людей, уже понимающих технологию.

  • Чтобы изучить, как руководство организовано или узнать о синтаксисе команды, прочитайте страницу руководства для страниц справочника (5).

  • Для получения дополнительной информации об этой технологии, ищите другую документацию в Библиотеке Разработчика Apple.

  • Для получения общей информации о записи сценариев оболочки, считайте Shell, Пишущий сценарий Учебника для начинающих.



scope(n)                                         [incr Tcl]                                         scope(n)



____________________________________________________________________________________________________________

NAME
       scope - capture the namespace context for a variable

SYNOPSIS
       itcl::scope name
____________________________________________________________________________________________________________


DESCRIPTION
       Creates  a  scoped  value  for  the specified name, which must be a variable name.  If the name is an
       instance variable, then the scope command returns a string of the following form:
              @itcl object varName
       This is recognized in any context as an instance variable belonging to object.  So with  itcl3.0  and
       beyond,  it  is  possible to use instance variables in conjunction with widgets.  For example, if you
       have an object with a private variable x, and you can use x in  conjunction  with  the  -textvariable
       option of an entry widget.  Before itcl3.0, only common variables could be used in this manner.

       If  the name is not an instance variable, then it must be a common variable or a global variable.  In
       that case, the scope command returns the fully qualified name of the variable, e.g., ::foo::bar::x.

       If the name is not recognized as a variable, the scope command returns an error.

       Ordinary variable names refer to variables in the global namespace.  A scoped value captures a  vari-able variable
       able  name  together  with  its  namespace  context in a way that allows it to be referenced properly
       later.  It is needed, for example, to wrap up variable names when a Tk widget is used within a names-pace: namespace:
       pace:
              namespace foo {
                  private variable mode 1

                  radiobutton .rb1 -text "Mode #1"         -variable [scope mode] -value 1
                  pack .rb1

                  radiobutton .rb2 -text "Mode #2"         -variable [scope mode] -value 2
                  pack .rb2
              }
       Radiobuttons  .rb1  and  .rb2 interact via the variable "mode" contained in the namespace "foo".  The
       scope command guarantees this by returning the fully qualified variable name ::foo::mode.

       You should never use the @itcl syntax directly.  For example, it is a bad idea  to  write  code  like
       this:
              set {@itcl ::fred x} 3
              puts "value = ${@itcl ::fred x}"
       Instead,  you  should  always use the scope command to generate the variable name dynamically.  Then,
       you can pass that name to a widget or to any other bit of code in your program.


KEYWORDS
       code, namespace, variable



itcl                                                                                                scope(n)

Сообщение о проблемах

Способ сообщить о проблеме с этой страницей руководства зависит от типа проблемы:

Ошибки содержания
Ошибки отчета в содержании этой документации к проекту Tcl.
Отчеты об ошибках
Сообщите об ошибках в функциональности описанного инструмента или API к Apple через Генератор отчетов Ошибки и к проекту Tcl через их страницу создания отчетов ошибки.
Форматирование проблем
Отчет, форматирующий ошибки в интерактивной версии этих страниц со ссылками на отзыв ниже.