alanc@coopsol.coopsol.com (Alan Carwile) (06/14/91)
>From the Widget Writing class at Xhibition last year, plus opinions I see on
the net, and my own understanding of Xt... It seems necessary to have source
to be able to subclass existing widgets. I'm curious what other people think,
and will summarize any email I receive on this topic.
I need to subclass several existing OLIT widgets to create more specialized
widgets. It's important that I NOT create my widgets off Xt's classes, since
I don't have the time to reverse engineer all the existing functionality of
the existing OLIT widgets. I just want to focus on the new capabilities that
I have to add. However, in some cases, I'll need to "hook into" the methods
being used by the parent widget class.
For example, to draw a textField widget in some special way based on a
resource, I might need to modify a GC and let the parent widget class do the
drawing. Alternatively, I could take over the drawing, but I'd have to
handle details like how to draw the arrows that appear if the textField
can't display all its content.
It seems likely to me that OLIT source would therefore be necessary to create
widget subclasses that work successfully. I would expect NOT to modify the
OLIT source, nor to redistribute it. However, developing and debugging without
it sounds like a nightmare. Of course, I have to be careful here. When a new
version of OLIT comes out, the implementation of the parent class may change.
If I've relied on an implementation detail that changes, my subclass would not
work as expected. Ideally then, Sun (or AT&T) would publish information about
the OLIT widgets, that would make it feasible to subclass in specialized ways
without having to have source. Is there further documentation of this nature
for the OLIT widgets? The difficulty comes in projecting the level of
information needed with those who subclass an existing widget. The details
may seem sufficient to the creator of the parent class, but not to the creator
of the subclass.
If you have experience with this, please let me know your opinions. Experience
with other widget sets (dare I say Motif?) would also be of interest, since
this is primarily an X Toolkit question.
We currently have OLIT 2.5 from Sun (similar to 4.0 from AT&T). My hope is to
move soon to OLIT 3, and get source for Sun's OLIT 3 for use as I create
subclasses.
..Thank You...
AlanC
------------------------------------------------------------------------------
Alan D. Carwile ! domain: alanc@coopsol.com <-- Best choice
Cooperative Solutions, Inc. ! uucp: ..!sun!unisoft!coopsol!alanc
2125 Hamilton Ave. Suite 100 ! or ..!hplabs!pyramid!unisoft!coopsol!alanc
San Jose, CA. 95125 ! or ..!uunet.uu.net!unisoft!coopsol!alanc
(408) 377-0300 x67 phone ! or ..!uu.psi.com!coopsol!alanc
(408) 377-7504 fax ! or coopsol!alanc@uu.psi.com
------------------------------------------------------------------------------
thp (Timothy H Panton.) (06/15/91)
There was a talk at this year's X conference (given by Ralph Swick?) on this subject. It was a discussion of an attempt to sub-class some motif widgets without the source. He came to the conclusion it was impossible. My own experience is similar, we have written half a dozen new widget calsses of the last couple of years, and without exception I've needed the source, mostly just to look at, but sometimes to fix bugs. I'd add that if you are doing a commercial product you probably need the source to the widgets you are going to use anyway, irrespective of subclassing. OLIT does some strange stuff at startup which I had to work around, which would have been impossible to do without the source. As the source to OLIT is only ~$1k (say 2 days work) it will probably pay for itself on any project over about 1 Man month. Tim. +----------------------------------------------------------------------------+ |Tim Panton, Westhawk Ltd. "Do not meddle in the affairs of Wizards, for | |Phone: +44 928722574 they are subtle and quick to anger." | |Email: thp%westhawk.uucp@ukc.ac.uk The Lord of the Rings. | |Paper: Westhawk Ltd. 26 Rydal Grove, Helsby, Cheshire, WA6 OET. UK. | +----------------------------------------------------------------------------+
brianw@gazooch.Eng.Sun.COM (Brian Warkentine) (06/18/91)
In article <j7nsuk1@openlook.Unify.Com> openlook-request@openlook writes: > >There was a talk at this year's X conference (given by Ralph Swick?) >on this subject. It was a discussion of an attempt to sub-class some >motif widgets without the source. He came to the conclusion it was >impossible. > >My own experience is similar, we have written half a dozen new widget >calsses of the last couple of years, and without exception I've needed >the source, mostly just to look at, but sometimes to fix bugs. > >I'd add that if you are doing a commercial product you probably need the >source to the widgets you are going to use anyway, irrespective of >subclassing. OLIT does some strange stuff at startup which I had to >work around, which would have been impossible to do without the source. Does this imply that subclassed widgets require porting between releases of the widget set proper? It seems there's a big temptation to "monkey-see-monkey-do" as well as use undocumented mechanisms just to make it work. I agree, having source is helpful. I'd be interested in hearing your experiences with compatability of your subclasses to toolkit/widget set releases. -brian brian.warkentine@Eng.Sun.COM