billa@edsews.EDS.COM (bill anderson) (10/03/88)
Release : X11r2.
Problem : Getting the application to call converter.
I need some help from some of you widget-makers. No one here can
ferret the problem. Here's my problem ...
I have widget that is a sub-class of Label. This widget has a Class
Initialization routine which adds a converter ( CvtStringToPixmap ). My
problem seems to be getting the converter called by the application which
uses my (button) widget.
***** In the private Button.c file :
static XtResource resources[] = {
{XtNpixmap, XtCPixmap, XtRPixmap, sizeof(Pixmap),
XtOffset(ButtonWidget,pushbutton.pixmap) , XtRPixmap,(caddr_t)"my_pixmap_name"},
:
:
:
};
ButtonClassRec buttonClassRec = {
{
/* core_class fields */
/* superclass */ (WidgetClass) &labelClassRec,
/* class_name */ "Button",
/* widget_size */ sizeof(ButtonRec),
/* class_initialize */ ClassInitialize,
/* class_part_init */ NULL,
/* class_part_init */ NULL,
/* class_inited */ FALSE,
/* initialize */ Initialize,
/* initialize_hook */ NULL,
/* realize */ XtInheritRealize,
/* actions */ actionsList,
/* num_actions */ XtNumber(actionsList),
/* resources */ resources,
/* num_resources */ XtNumber(resources),
/* xrm_class */ NULLQUARK,
/* compress_motion */ TRUE,
/* compress_exposure */ TRUE,
/* compress_enterleave*/ TRUE,
/* visible_interest */ FALSE,
/* destroy */ NULL,
/* resize */ XtInheritResize,
/* expose */ Redisplay,
/* set_values */ SetValues,
/* set_values_hook */ NULL,
/* set_values_almost */ XtInheritSetValuesAlmost,
/* get_values_hook */ NULL,
/* accept_focus */ NULL,
/* version */ XtVersion,
/* callback_private */ NULL,
/* tm_table */ defaultTranslations,
/* query_geometry */ NULL,
},
{
0, /* field not used */
}, /* LabelClass fields initialization */
{
0, /* field not used */
}, /* ButtonClass fields initialization */
};
static void CvtStringToPixmap();
static XtConvertArgRec pixmapConvertArgs[] = {
{XtBaseOffset, (caddr_t) XtOffset(ButtonWidget, core.screen) , sizeof(Screen *)},
{XtBaseOffset, (caddr_t) XtOffset(ButtonWidget, button.pixmap) , sizeof(Pixmap)}
};
static void ClassInitialize()
{
XtAddConverter( XtRString,
XtRPixmap,
CvtStringToPixmap,
pixmapConvertArgs,
XtNumber(pixmapConvertArgs) );
} /* ClassInitialize */
static void CvtStringToPixmap(args, num_args, fromVal, toVal)
XrmValuePtr args; /* passes screen and pixmap */
Cardinal *num_args; /* 2 arguments */
XrmValuePtr fromVal;
XrmValuePtr toVal;
{
:
:
:
}
***** In the application test.c file :
:
:
:
XtSetArg(args[0], XtNpixmap , "question_mark");
XtSetArg(args[1], XtNlabel , "test");
button = XtCreateManagedWidget("Iconpix",
buttonWidgetClass,
tolevelp,
args,
2);
:
:
:
*****
What I wanted to happen is for the 'CvtStringToPixmap' to be called since this
converter does not already exists. However the converter is not called. I
seemed to have miss some documentation somewhere. I would be grateful if someone
could shove my nose to the information I missed as well as tell me of my myopia.
thanks in advance for,
-bill
Arpanet: billa@edsews.eds.com | " ... one man gathers
UUCP: uunet!edsews!billa | what another man spills ... "
--
Arpanet: billa@edsews.eds.com | " ... one man gathers
UUCP: uunet!edsews!billa | what another man spills ... "