hefner1 at gl.umbc.edu
Thu Oct 9 06:17:51 CEST 2003
I've spent some time this evening getting with-output-as-gadget working.
It's looking good so far, but raises several questions.
I have a simple demo going where a function adds a button and a slider
into a running listener. If anyone wants to see it in action, here's a
The main issue is with getting the child panes into the stream pane. The
documentation for WITH-OUTPUT-AS-GADGET implies that it should work on any
output recording stream. To get things up and running, I had output recording
streams inherit from sheet-multiple-child-mixin, so that I could use
SHEET-ADOPT-CHILD to add the gadget. That's a stupid place to put that
mixin, and if I go this route, clim-stream-pane would probably be a better
place to put it. There are also possible arguments against this, along the
lines of not wanting the user to randomly adopt children into a sheet that
wasn't designed to do anything useful with them, and so maybe it would be
better to add them through some backdoor instead.
The big issue has to adding/deleting the gadget-output-record. Output
records appear to be designed such that you can add them, delete them,
move them between sheets, without much of a problem. In order to
properly delete a gadget-output-record, you need to disown the pane it
contains (the output record really isn't anything but a placeholder). So
you need some kind of notification that a record has been added/deleted,
parallel to the note-sheet-adopted/disowned functions (big suprise).
Unless there are any alternative ideas, I'll just brew something up and
add it to clim-extensions.
In the CLX backend, no work has to be done for dispatching events from the
sheet to the gadgets - since everything is a mirror, X does this for us.
Implementors of future backends might want to keep this in mind, though.
If this is difficult to make work with native widgets, you can always fall
back to the generic widgets, though some work on McCLIM's event handling
would need to be done in the case where the embedded gadgets are not
mirrors (IMHO this ought to be done anyway..)
Regarding where to put the added gadgets, I'm currently adding them at the
position of the stream cursor, then advancing it to the right of the
gadget. Also, since the text code doesn't take other output records into
account when positioning itself for a new line, I increase the height of
the current text line in the stream to force the text to come out below
the gadget. Otherwise, text frequently gets obscured under the gadget. :)
Thoughts, ideas, anyone?
More information about the mcclim-devel