Sujet : Re: My hang-up about OOP (snit)
De : heller (at) *nospam* deepsoft.com (Robert Heller)
Groupes : comp.lang.tclDate : 28. Jun 2024, 12:49:11
Autres entêtes
Organisation : Deepwoods Software
Message-ID : <MLOcnQXJp5eqPuP7nZ2dnZfqn_udnZ2d@giganews.com>
References : 1 2
User-Agent : TkNews 3.0 (1.2.18)
At Fri, 28 Jun 2024 00:06:29 -0300 Luc <
luc@sep.invalid> wrote:
On Fri, 28 Jun 2024 02:24:19 +0000, Robert Heller wrote:
Did you read the man pages for *Tk* itself?
>
snit::widget and snit::widgetadaptor create widget constructors that
behave *EXACTLY* like native Tk widgets.
I think I understand, but it took me a long time to grasp because I
think I was lured into something else.
snit::type dog {
# ....
}
::dog
% dog create spot
::spot
spot execute method
So I thought,
snit::widget textbox {
# ....
text -options blahblahblah
}
textbox create textbox1
textbox1 -otheroptions blahblahblah
But it's nothing like that! I thought I was going to create and refer
to widgets by some fancy name of my own choosing, but I'm not.
I was disappointed.
Tk widgets, whether the "built in" (native) ones or ones created by snit (or
BWidget or any other Tcl/Tk widget extension) all *have* to obey the
convention that Tk widgets are in a hierarchical path:
".parent.child.grandchild" -- it does not matter if parent was created by a Tk
widget and child was created by a snit::widget and grandchild was created by a
BWidget (another Tk widget extension framework) class. This is *required* by
how the underlying structure of the Tk GUI subsystem works. All "widgets"
(windows) have to the be the child of some other widget (window) and container
widgets (eg toplevels, frames, etc.) can have children widgets. Only "." has
no parent and is in fact the final ancestor of all widgets. I believe this
parent and child structure is a standard feature of all GUI subsystems, not
just Tk. There are reasons for that, which could probably fill a whole
textbook / university course to explain.
Snit's "types" are not constrained by Tk -- they are their own thing
independent of Tk. Snit's "widgets" and "widgetadaptors" do use the same
internal structure as snit "types" (variables, methods, options, and
components), but their naming conventions are tied (hardwired) to follow the
same conventions as any other widget framework.
-- Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364Deepwoods Software -- Custom Software Serviceshttp://www.deepsoft.com/ -- Linux Administration Servicesheller@deepsoft.com -- Webhosting Services