🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #37973

Problems subclassing Athena widgets

#37973
From: Chris Walters
Date: Mon, 12 Mar 1990 16:11
85 lines
2883 bytes
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.org
Technical Details
Message-ID: <102193@linus.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!bu.edu!xylogics!merk!alliant!linus!lid.mitre.org!walters

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!bu.edu!xylogics!merk!alliant!linus!lid.mitre.org!walters
From: walters@lid.mitre.org (Chris Walters)
Newsgroups: comp.windows.x
Subject: Problems subclassing Athena widgets
Message-ID: <102193@linus.UUCP>
Date: 12 Mar 90 16:11:29 GMT
Sender: news@linus.UUCP
Reply-To: walters@lid.mitre.org (Chris Walters)
Organization: The MITRE Corporation Media Laboratory
Lines: 85