Strange Square Character In The Dialog - Motif

This is a discussion on Strange Square Character In The Dialog - Motif ; 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 ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Strange Square Character In The Dialog

  1. Strange Square Character In The Dialog

    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://i18.tinypic.com/43z75gw.jpg

    Source codes
    ==========================
    #include
    #include

    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);
    }


  2. Re: Strange Square Character In The Dialog

    hjin wrote:
    > 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.


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

    #include
    #include
    #include

    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);
    }

+ Reply to Thread