Re: setting widget names in STklos
 
> I'd go so far as to suggest modifying the MOP so that STklos classes
> that are Tk widgets can specify that particular slots are to be
> initialized by their corresponding X resources.  I guess you'd want an
> additional keyword on slot definitions, maybe :init-from-environment,
> which would override :initform when the X resource exists.  I didn't
> call it :init-from-x-resource because I presume that under MS Windows
> there's a different mechanism for specifying user defaults, but in
> both cases they come from the "environment".
This sounds like a good idea, although getting a _good_ implementation
is not trivial.  (I've just whipped up a mediocre implementation, though.)
Would :init-from-environment take both a name and a class?  So far I'm
unclear on what those two terms mean in this context....
> One question, though.  What are you going to do about composite
> widgets?
"Do" in what context?
With regard to setting widget names, this seems pretty straightforward.
Each composite widget defines a frame that all its components are
children of.  In my implementation, the :name initializer for
the composite widget gets passed to the frame (e.g., "bug-reporter");
the composite widget's initialize method can then give names to
the components (e.g., "input").  So in this example you end up
with a widget named something like ".v1.bug-reporter.input" (where
v1 is the STklos-generated toplevel the bug-reporter lives in).
Frames can also have a :class argument, which seems to factor into
X resources somehow; I think composite widgets should pass this along
to their frames, too.
With regard to :init-from-environment, probably composite widgets
should take their X resources from the frame again.  So a composite
widget with the slot
  (input-font :init-from-environment input-font
              :allocation :propagated
              :propagate-to ((input-window font)))
would get an "input-font" resource associated with the frame, and
then propagate it to the input-window's font slot.  (This is probably
a bad example, since you could do this just as easily by specifying
the font for the input window directly.)
--Erik
Received on Thu Sep 05 1996 - 19:32:02 CEST
This archive was generated by hypermail 2.3.0
: Mon Jul 21 2014 - 19:38:59 CEST