public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Re: how to get value displayed in entry field of the window
       [not found] <80464F9A4D2BF042A154DD067F1F539302A63E7F@CEL-BANGT-M01>
@ 2004-12-01 19:10 ` Keith Seitz
  2004-12-01 19:13   ` Keith Seitz
  0 siblings, 1 reply; 2+ messages in thread
From: Keith Seitz @ 2004-12-01 19:10 UTC (permalink / raw)
  To: KiranKumar B Shivananda; +Cc: Hans Kester, insight

On Mon, 2004-11-22 at 20:23, KiranKumar B Shivananda wrote:

> In .itb file
> 
> I am doing like this
> 
> $_regf.value$regnum config -textvariable RegWin::_value($regnum)

You must remember that you are not using "vanilla" tcl and tk. Insight
is written in Itcl, and you must follow the conventions of that
extension.

Your problem is that you cannot pass variable names as-is to tcl/tk
objects. You MUST use the scope keyword to specify the object's "scope".

Here is an example of how to do this:
---------- copy to a file and source the file in wish8.4 --------
package require Itcl
package require Itk
 
itcl::class Entry {
  inherit itk::Widget
 
  private variable _foo {unset}
 
  constructor {args} {
    itk_component add entry {
        entry $itk_interior.entry -textvariable [itcl::scope _foo]
    }
 
    pack $itk_component(entry)
  }
 
  public method setValue {value} { set _foo $value }
}
 
set entry .a
Entry $entry
pack $entry
$entry setValue "This is the proper way to do this"
------------------ end of file -------------------

As you can see, I've used the "itcl::scope" to tell the Tk entry widget
the proper "path" to the real variable. See scope(n) for details.

Keith

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: how to get value displayed in entry field of the window
  2004-12-01 19:10 ` how to get value displayed in entry field of the window Keith Seitz
@ 2004-12-01 19:13   ` Keith Seitz
  0 siblings, 0 replies; 2+ messages in thread
From: Keith Seitz @ 2004-12-01 19:13 UTC (permalink / raw)
  To: KiranKumar B Shivananda; +Cc: insight

On Wed, 2004-12-01 at 11:10, Keith Seitz wrote:
> See scope(n) for details.

Or look here: http://www.tcl.tk/man/itcl3.1/scope.n.html

Keith

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-12-01 19:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <80464F9A4D2BF042A154DD067F1F539302A63E7F@CEL-BANGT-M01>
2004-12-01 19:10 ` how to get value displayed in entry field of the window Keith Seitz
2004-12-01 19:13   ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).