[comp.windows.x] Problem subclassing from a constraint class widget in the X Toolkit

rlh2@ukc.ac.uk (Richard Hesketh) (04/02/89)

I have a Radio Form widget which is subclassed from the Athena Form widget.
The Form widget is a subclass of Constraint and therefore it has the following
constraint class part fields in the widget class structure:

/* subresources       */   formConstraintResources,
/* subresource_count  */   XtNumber(formConstraintResources),
/* constraint_size    */   sizeof(FormConstraintsRec),
/* initialize         */   ConstraintInitialize,
/* destroy            */   NULL,
/* set_values         */   ConstraintSetValues,
/* extension          */   NULL,

Now I want to inherit these fields because I don't want to add anymore
constraints.   So I thought I could do this the same way I inherit
from the composite class, i.e. XtInheritGeometryManager,  but the constraint
widget does not implement any of the required XtInherit hooks in its
instance initialization procedure.  What I want is the following:

XtInheritConstraintResources
XtInheritNumberConstraintResources
XtInheritConstraintSize
XtInheritConstraintInitialize
XtInheritConstraintDestroy
XtInheritConstraintSetValues

Why where these (or something similar) not put in the constraint widget?

At the moment I have to do what I consider a horrible kludge.  I have to
explicitly set the constraint_class fields to the those given above for
the Form Widget.  PLUS I have to implement the ConstraintInitialize and
ConstraintSetValues calls in the Radio Form even though they are identical
to the same named procedures in the Form Widget.

Please will someone tell me I am stupid and can do what I want in a
more elegant and sensibly way.   Thanks.

Richard Hesketh   :   rlh2@ukc.ac.uk    ..!mcvax!ukc!rlh2
---                                               
Computing Lab., University of Kent at Canterbury,
Canterbury, Kent, CT2 7NF, England.               

asente@decwrl.dec.com (Paul Asente) (04/12/89)

In article <544@harrier.ukc.ac.uk> rlh2@ukc.ac.uk (Richard Hesketh) writes:
>[that he wants XtInherit... values for constraint class fields.

All of these fields are either chained (all but size) or make no sense to
inherit (size).  The chaining makes inheritance automatic.

	-paul asente
	    asente@decwrl.dec.com	decwrl!asente