Strange Square Character In The Dialog

Strange Square Character In The Dialog

Post by hjin » Fri, 13 Apr 2007 02:45:10


I only tried to make a simple dialog but what I got was all strange
square character on the dialog. It's a HP thin client Linux.
Anyone can give me any clue. Thank you very much.
Scrren shoot is at http://www.yqcomputer.com/

Source codes
==========================
#include <Xm/PushB.h>
#include <Xm/Form.h>

void Cancel(Widget, XtPointer, XtPointer);

Widget toplevel, mainform, widget;
XtAppContext app;

main(int argc, char *argv[])
{
toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0,
&argc, argv, NULL, NULL);

mainform = XtVaCreateWidget("mainform",
xmFormWidgetClass, toplevel,
NULL);

widget = XtVaCreateWidget("Cancel",
xmPushButtonWidgetClass, mainform,
XmNtopAttachment, XmATTACH_FORM,
XmNbottomAttachment, XmATTACH_FORM,
XmNleftAttachment, XmATTACH_POSITION,
XmNleftPosition, 50,
XmNrightAttachment, XmATTACH_POSITION,
XmNrightPosition, 100,
XmNshowAsDefault, False,
XmNdefaultButtonShadowThickness, 1,
NULL);
XtAddCallback (widget, XmNactivateCallback, Cancel, NULL);
XtManageChild (widget);

XtManageChild(mainform);

XtRealizeWidget(toplevel);
XtAppMainLoop(app);
}

void Cancel(Widget button, XtPointer a, XtPointer b)
{
exit(0);
}
 
 
 

Strange Square Character In The Dialog

Post by Chris Sore » Mon, 16 Apr 2007 04:34:13


Looks like a font problem. Try creating a localized string and pass
that in as the pushbutton label:

#include <stdlib.h>
#include <Xm/PushB.h>
#include <Xm/Form.h>

void Cancel(Widget, XtPointer, XtPointer);

Widget toplevel, mainform, widget;
XtAppContext app;

int main(int argc, char *argv[])
{
toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0,
&argc, argv, NULL, NULL, 0);

mainform = XtVaCreateWidget("mainform",
xmFormWidgetClass, toplevel,
NULL);

XmString str;
str = XmStringCreateLocalized("C a n c e l");
widget = XtVaCreateWidget("Cancel",
xmPushButtonWidgetClass, mainform,
XmNtopAttachment, XmATTACH_FORM,
XmNbottomAttachment, XmATTACH_FORM,
XmNleftAttachment, XmATTACH_POSITION,
XmNleftPosition, 50,
XmNrightAttachment, XmATTACH_POSITION,
XmNrightPosition, 100,
XmNshowAsDefault, False,
XmNdefaultButtonShadowThickness, 1,
XmNlabelString, str,
NULL);
XmStringFree(str);
XtAddCallback (widget, XmNactivateCallback, Cancel, NULL);
XtManageChild (widget);

XtManageChild(mainform);

XtRealizeWidget(toplevel);
XtAppMainLoop(app);
return 0;
}

void Cancel(Widget button, XtPointer a, XtPointer b)
{
exit(0);
}