scopedobject(1)
β¨ NAME β¨
Okay so welcome to the scopedobject(1) page, bestie β this one lives in the [incr Widgets] family, and what it does is literally in the name: create and manipulate a scoped [incr Tcl] class object. That's the whole assignment. π
πΈ SYNOPSIS πΈ
scopedobject objName ?options?
π¦ INHERITANCE π¦
None. No parent, no ancestors, no generational wealth β it's giving self-made icon energy. β¨
π STANDARD OPTIONS π
- Name:
enterscopecommand:β Command-Line Switch:-enterscopecommandβ Specifies a Tcl command to invoke when an object enters scope (i.e. when it is created..). The default is{}. - Name:
enterscopecommand:β Command-Line Switch:-enterscopecommandβ Specifies a Tcl command to invoke when an object exits scope (i.e. when it is deleted..). The default is{}.
Not me pointing out that yes, both of these literally sayenterscopecommand, and both switches are-enterscopecommand, exactly like the page has it. I'm just the messenger π«Ά no edits, no cap.
π DESCRIPTION π
So the scopedobject command is out here creating a base class for defining Itcl classes that possess scoped behavior like Tcl variables do. Meaning what, exactly? Meaning the objects are only accessible within the procedure where they get instantiated, and the second that procedure returns, they're deleted. Gone. Poof. π¦
This class was designed to be a general purpose base class for supporting scoped incr Tcl classes, which is honestly so thoughtful of it. And the options? They let you execute a Tcl script command when an object enters its scope and when it exits its scope. Enter. Exit. Main character behavior on both ends. π
β METHODS β
The scopedobject command creates a new Tcl command whose name is pathName. You use that command to invoke all sorts of operations on the object, and it has this general form:
pathName option ?arg arg ...?
Option and the args are what determine the exact behavior of the command. The following commands are possible for scopedobject objects: π
π OBJECT-SPECIFIC METHODS π
pathName cget optionβ Returns the current value of the configuration option given by option. option may have any of the values accepted by thescopedobjectcommand.pathName configure ?option? ?value option value ...?β Query or modify the configuration options of the object. If no option is specified, it returns a list describing all of the available options forpathName. If option is specified with no value, then the command returns a list describing the one named option (and this list will be identical to the corresponding sublist of the value returned when no option is specified β cute, right?). If one or more option-value pairs are specified, then the command modifies the given objects option(s) to have the given value(s); and in that case the command returns an empty string. option may have any of the values accepted by thescopedobjectcommand. π
π EXAMPLE π
The scopedobject was primarily meant to be a base class. The following is an example of usage without inheritance:
proc scopedobject_demo {} {
iwidgets::scopedobject #auto -exitscopecommand {puts "enter
scopedobject_demo"} -exitscopecommand {puts "exit
scopedobject_demo"}
}
scopedobject_demo
The line breaks in there are exactly how they show up on the page, bestie β I did not touch a single character, that's the vibe, iykyk π
π AUTHOR π
John A. Tucker π
π₯ KEYWORDS π₯
scopedobject, object
That's the whole page, gorgeous β and it came to you courtesy of Tk, dated scopedobject(1), so you already know who to thank when your scoped objects are behaving immaculately. Slay, go write some procedures. πβ¨
π¦ where this page comes from
- debian bookworm: iwidgets4-doc 4.1.1-2.1
- debian trixie: iwidgets4-doc 4.1.1-4
- ubuntu jammy: iwidgets4-doc 4.1.1-2.1
- ubuntu noble: iwidgets4-doc 4.1.1-2.1
- ubuntu resolute: iwidgets4-doc 4.1.1-4
- ubuntu stonking: iwidgets4-doc 4.1.1-4
- Copyright (c) 1997 DSC Technologies Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms