walters@lid.mitre.org (Chris Walters) (03/13/90)
Summary:
Warning: Representation size 4 must match superclass's
to override fooBar
Hello,
I am trying to create a subclass of the Athena command widget.
I would like to add some additional resources to the command widget
as a learning exercise (I am brand new at this).
I have looked at the examples provided by Ralph Swick in the R4
Xaw documentation, and have looked at the toggle widget itself to
see how it inherits from the core, simple, label, and command widgets.
I thought I understood how it worked; I guess not!
If I create a new widget called barfo that has a new resource
called fooBar (where XtNfooBar = "fooBar", XtCfooBar = "FooBar",and reptype is an integer), with the following in BarfoP.h:
typedef struct {
/* resources */
int w_foo_bar;
/* private state */
} BarfoPart;
typedef struct _BarfoRec {
CorePart core;
SimplePart simple;
LabelPart label;
CommandPart command;
BarfoPart barfo;
} BarfoRec;
and
typedef struct { int foo; } BarfoClassPart;
typedef struct _BarfoClassRec {
CoreClassPart core_class;
SimpleClassPart simple_class;
LabelClassPart label_class;
CommandClassPart command_class;
BarfoClassPart barfo_class;
} BarfoClassRec;
extern BarfoClassRec barfoClassRec;
Then, in Barfo.c, I have the following:
#define offset(field) XtOffset(BarfoWidget, field)
static XtResource resources[] = {
{ XtNfooBar, XtCfooBar, XtRInt, sizeof(int),
offset(xopcmd.w_foo_bar), XtRInt, (int) 100 },
};
#undef offset
I then looked at the Toggle sources to see how the widget class
record structure would look for something subclassing from
other widgets.
When I try to use the widget, I get:
Warning: Representation size 4 must match superclass's
to override fooBar
I looked through the source and found that this is coming from
the resource manager (BadSize).
Any help or pointers to the FM would be appreciated. Apologies
in advance if this is really a dumb question.
In case it matters, my environment is SunOS 4.0.3 on 3/260, X11R4
with patches.
Thanks,
- Chris Walters
The MITRE Corporation
McLean, VA 22102 (703) 883-6159
email: walters@euler.mitre.org
or if that fails
walters@community-chest.mitre.org
or if that fails
walters@mwunix.mitre.orgpalmer@MWUNIX.MITRE.ORG (03/13/90)
> Subject: Problems subclassing Athena widgets > Message-Id: <102193@linus.UUCP> > Sender: xpert-request@expo.lcs.mit.edu > To: xpert@expo.lcs.mit.edu > > Summary: > Warning: Representation size 4 must match superclass's > to override fooBar > > Then, in Barfo.c, I have the following: > > #define offset(field) XtOffset(BarfoWidget, field) > > static XtResource resources[] = { > { XtNfooBar, XtCfooBar, XtRInt, sizeof(int), > offset(xopcmd.w_foo_bar), XtRInt, (int) 100 }, > }; > #undef offset > Chris, The problem is in the default_addr field. Try : > offset(xopcmd.w_foo_bar), XtRInt, (XtPointer) 100 }, ^^^^^^^^^^^ ^^^ ------------------------------------------------------ Forrest Palmer (x5668) Systems Programmer/Administrator MITRE Corp. - Washington Center palmer@mwunix.mitre.org ------------------------------------------------------