[comp.windows.x.motif] Problem with WCL/Motif

bon@robotics.jpl.nasa.gov (Bruce Bon) (04/11/91)

I have a problem using WCL, probably because I am a beginner at X, etc.

Following an example that came with WCL, I have successfully specified
something like:

1)	*fsb*okCallback:	WcPopdownCB(~)

where fsb is a file-selection-box widget.  I have also done something like:

2)	*mywindow.wcCallback:	myProcCB( string)

where myProcCB was a simple callback procedure that was coded and registered
in my version of MRI.  BUT when I try to furnish one of my callback procedures
to a callback list resource for popups:

3)	*manipShell.wcClassName:	TransientShell
	*manipShell.wcChildren:		manPop
	*manPop.wcConstructor:		XmCreateText
	*manipShell.popupCallback:	myProcCB

nothing happens -- it is as though the popupCallback resource is not
recognized at all.


One of the reference books that I have says:

	Because Xt doesn't support a string to Callback resource converter, 
	callbacks cannot be specified in resource files.

and I could find no reference to type XtCallbackList except as an internal
structure with no type converter available.  So how can example (1)
possibly work?  Is there something in the Intrinsics that parses ~, etc. ?
Example 2 shows that I was successful in creating and registering my own
callback procedure.  So if example 1 does work, why can't I get example 3
to work?

Answers or pointers to documentation that I may have overlooked would both
be appreciated.  Thanks.

					Bruce Bon
					bon@robotics.jpl.nasa.gov


ACTUAL EXCERPTS AND QUESTION:
-------------------------------------------------------
Excerpts from resource files:

*operIF.wcPopups:	lkbFsbShell, skbFsbShell, lomFsbShell, somFsbShell, \
			aysShell, manipShell

*lkbFsbShell.fsb*okCallback:	WcPopdownCB(~)

*manipShell.wcClassName:	TransientShell
*manipShell.wcChildren:		manPop
*manipShell.wcCallback:		WcTraceCB( manipShell.wcCallback), OifDebugCB(manipShell.wcCallback)
*manipShell.popupCallback:	WcTraceCB( manipShell.popupCallback)

*manPop.wcResFile:		operif_manip.wcl

! operif_manip.wcl:
operif.wcChildren:	manPop

*manPop.wcConstructor:	XmCreateText
*manPop.wcCallback:	WcTraceCB( manPop.wcCallback), OifDebugCB(manPop.wcCallback)
*manPop.popupCallback:	WcTraceCB( manPop.popupCallback)


-------------------------------------------------------
Excerpt from file produced by
	setenv XENVIRONMENT operif.wcl
	operif >& operif.log
where operif is my version of MRI:

	. . .
Wc    pop-up: operif.operIF.manipShell of class TransientShell
Wc   managed: operif.operIF.manipShell.manPop of class XmText
	. . .
Wc   managed: operif.operIF.menuBar.manip of class XmCascadeButton
	. . .
TraceCB for operif.operIF.manipShell: manipShell.wcCallback
OifDebugCB: manipShell.wcCallback
TraceCB for operif.operIF.manipShell.manPop: manPop.wcCallback
OifDebugCB: manPop.wcCallback

-------------------------------------------------------
callback function OifDebugCB:

void OifDebugCB ( w, argString, unused )
    Widget	w;
    char*	argString;
    caddr_t	unused;
{
    printf( "OifDebugCB: %s\n", argString);
}

-------------------------------------------------------
Question:

I understand that *manPop.popupCallback should have no effect, since the
XmText widget class has no such resource.  But why, if the 
*lkbFsbShell.fsb*okCallback works, doesn't the *manipShell.popupCallback
work as well?

aw@BAE.BELLCORE.COM (Andrew Wason) (04/11/91)

(Bruce Bon) writes:
> 	*manipShell.popupCallback:	myProcCB
> 
> nothing happens -- it is as though the popupCallback resource is not
> recognized at all.

I have the same problem.  It looks like there is a bug somewhere
in there (either in the Motif VendorShell or the Intrinsics).
I haven't figured it out yet.  I've attached a message I posted a while
ago about this problem below.

acs@pcc.amdahl.com (Tony Sumrall) has been having similar problems.

It seems like when an XtAddCallback is done on a callback list
which has callbacks derived from resources, bad things happen.

> *manipShell.wcClassName:	TransientShell
> *manipShell.popupCallback:	WcTraceCB( manipShell.popupCallback)

In this case, TransientShell is a subclass of VendorShell.
The Motif VendorShell does an XtAddCallback on the XmNpopupCallback
list.  This somehow wipes out your callback which got there via resources.


If anyone has any insight to this problem, let me know.

Andrew

_______________________________________________________________________________

Andrew Wason                                       Bell Communications Research
aw@bae.bellcore.com                                Piscataway, NJ
bellcore!bae!aw
_______________________________________________________________________________


------- Forwarded Message

Date:    Wed, 20 Mar 91 12:46:13 -0500
From:    Andrew Wason <aw@bae.bellcore.com>
To:      motif-talk%osf.org@bellcore.bellcore.com
Subject: XmNpopupCallback


Has anyone had any success using the Shell XmNpopupCallback resource?

I can't get it to work. Here is an Mri resource file which
adds a popupCallback.

  Mri.wcChildren:               button
  Mri.wcPopups:                 popup
  *button.wcClassName:          XmPushButton
  *button.activateCallback:     WcPopupCB( *popup )
  *popup.wcClassName:           TopLevelShell
  *popup.popupCallback:         WcSystemCB( echo popupCallback )
  *popup.wcChildren:            label
  *label.wcClassName:           XmLabel

The WcSystemCB callback should be called when
'popup' is popped up, but it isn't.

The same setup using Athena widgets and Ari works fine:

  Ari.wcChildren:               button
  Ari.wcPopups:                 popup
  *button.wcClassName:          Command
  *button.callback:             WcPopupCB( *popup )
  *popup.wcClassName:           TopLevelShell
  *popup.popupCallback:         WcSystemCB( echo popupCallback )
  *popup.wcChildren:            label
  *label.wcClassName:           Label


I think the problem is the Motif VendorShell widget.
VendorShell does an XtAddCallback on XmNpopupCallback
in its Initialize method.  At this point my WcSystemCB callback is
already on the list, but it looks like the VendorShells callback
replaces mine.  Later when my shell is popped up, and _XtPopup
does an XtCallCallbacks on XtNpopupCallback, there is only one
callback on the list -- the VendorShells.

Does anyone know how VendorShells callback could be wiping mine out?

Thanks,
Andrew

_______________________________________________________________________________

Andrew Wason                                       Bell Communications Research
aw@bae.bellcore.com                                Piscataway, NJ
bellcore!bae!aw

------- End of Forwarded Message