⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scope.n

📁 这是一个Linux下的集成开发环境
💻 N
字号:
'\"'\" Copyright (c) 1993-1998  Lucent Technologies, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\"'\" RCS: $Id: scope.n,v 1.1 2003/02/05 10:53:53 mdejong Exp $'\".so man.macros.TH scope n "" itcl "[incr\ Tcl]".BS'\" Note:  do not modify the .SH NAME line immediately below!.SH NAMEscope \- capture the namespace context for a variable.SH SYNOPSIS\fBscope \fIname\fR.BE.SH DESCRIPTION.PPCreates a scoped value for the specified \fIname\fR, which mustbe a variable name.  If the \fIname\fR is an instance variable,then the scope command returns a string of the following form:.CS@itcl \fIobject varName\fP.CEThis is recognized in any context as an instance variable belongingto \fIobject\fR.  So with itcl3.0 and beyond, it is possible to useinstance variables in conjunction with widgets.  For example, if youhave an object with a private variable \fCx\fR, and you can use\fCx\fR in conjunction with the \fC-textvariable\fR option of anentry widget.  Before itcl3.0, only common variables could be usedin this manner..PPIf the \fIname\fR is not an instance variable, then it must bea common variable or a global variable.  In that case, the scopecommand returns the fully qualified name of the variable, e.g.,\fC::foo::bar::x\fR..PPIf the \fIname\fR is not recognized as a variable, the scopecommand returns an error..PPOrdinary variable names refer to variables in the global namespace.A scoped value captures a variable name together with its namespacecontext in a way that allows it to be referenced properly later.It is needed, for example, to wrap up variable names when a Tkwidget is used within a namespace:.CSnamespace 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}.CERadiobuttons \fC.rb1\fR and \fC.rb2\fR interact via the variable"mode" contained in the namespace "foo".  The \fBscope\fR commandguarantees this by returning the fully qualified variable name\fC::foo::mode\fR..PPYou should never use the \fC@itcl\fR syntax directly.  For example,it is a bad idea to write code like this:.CSset {@itcl ::fred x} 3puts "value = ${@itcl ::fred x}".CEInstead, you should always use the scope command to generate thevariable name dynamically.  Then, you can pass that name to a widgetor to any other bit of code in your program..SH KEYWORDScode, namespace, variable

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -