http://freesoft.cei.gov.cn/motif/top.htm

解决方案 »

  1.   

    使用Motif开发中文软件并不简单, 有几种方法可以设置中文, 在资源文件中, 这也是最常见和最方便的 
    在初时化的 fallback 中 
    每次建立XmString时使用FontSet 
    本例所演示的是第二种, 编译: gcc -I/usr/X11R6/include -o motif motif.c -L/usr/X11R6/lib -lXm -lX11, 运行结果为: 请注意: LessTif不支持XIM输入 
    // file motif.c#include <X11/Xlib.h>
    #include <X11/keysym.h>
    #include <Xm/TextF.h>
    #include <Xm/TextFP.h>
    #include <Xm/LabelG.h>
    #include <Xm/RowColumn.h>
    #include <locale.h>
    #include <ctype.h>
    String fallbacks[] = {
    "*fontList:8x16,cclib16_1",
    NULL
    };main(int argc, char *argv[])
    {
    Widget toplevel, text_w, rowcol;
    XtAppContext app; setlocale(LC_ALL, ""); toplevel = XtVaAppInitialize(&app, "Demos",
    NULL, 0, &argc, argv, fallbacks, NULL); rowcol = XtVaCreateWidget("rowcol",
    xmRowColumnWidgetClass, toplevel,
    XmNorientation, XmHORIZONTAL,
    NULL);
    XtVaCreateManagedWidget("请输入:",
    xmLabelGadgetClass, rowcol, NULL); text_w = XtVaCreateManagedWidget("text_w",
    xmTextFieldWidgetClass, rowcol, 
    NULL); XtAddCallback(text_w, XmNactivateCallback, Test, 0); XtManageChild(rowcol); XtRealizeWidget(toplevel); XtAppMainLoop(app);
    }http://www.turbolinux.com.cn/pub/mirrors/openmotif/R2.1.30/motif/