📄 test11.c
字号:
/* $Header: /cvsroot/lesstif/lesstif/test/Xm/textf/test11.c,v 1.3 2002/04/01 13:36:36 amai Exp $Summary: pasting in XmText truncates; pasting in XmTextField crashesIt's possible that there's something screwed up about my machine,since I see this problem with OSF Motif as well as Lesstif --but the Lesstif behavior is both different and worse, which isprobably not a good thing in any event............................Date: Wed, 17 Feb 1999 16:47:50 -0800From: Jamie Zawinski <jwz@mozilla.org>Newsgroups: comp.windows.x.motif,comp.os.linux.xFollowup-To: comp.windows.x.motifSubject: inconsistent XmText and XmTextField paste behaviorMessage-ID: <36CB6336.6E722CC@jwz.org>I'm running OSF Motif 2.1.0 on Linux 2.0.36 with X11R6 (Red Hat 5.2,but not the version of Motif that Red Hat sells.)I find that I cannot paste into XmTextField widgets if the string Iam trying to paste contains high-bit characters (like the copyrightsymbol, for example.) If the characters are plain ASCII, it worksfine. If not, then either: only the part of the string before thefirst high-bit character is pasted; or I get a SEGV in free().I've narrowed it down somewhat: this is a problem that XmTextFieldhas but that XmText does not!Here's a simple test program. This creates a window with twosingle-line text areas in it, one of which is XmText and the other ofwhich is XmTextField. If I select some text containing high-bitcharacters in some other window, I can paste it into the top text fieldbut not into the bottom text field.Does this happen for you, or is my system broken in some special way?As far as I can tell, this problem only exhibits itself with thisversion of Linux. I was using this same version of Motif on older Linux systems without losing in this way (that was back in the 1.2.13days.)Interestingly, when I try this same test program with Lesstif 0.87.1,pasting into the top text field stops pasting at the first high-bitcharacter; and pasting into the bottom text field dumps core in free().Any suggestions appreciated...(Upgrading to Motif 2.0 is not an option, unfortunately.)*/#include <stdlib.h>#include <X11/Intrinsic.h>#include <X11/Shell.h>#include <Xm/Xm.h>#include <Xm/Form.h>#include <Xm/Text.h>#include <Xm/TextF.h>int main (int argc, char **argv){ XtAppContext app; Arg av[100]; int ac; Widget toplevel, form, text, textf; toplevel = XtAppInitialize (&app, "xmtest", 0, 0, &argc, argv, 0, 0, 0); ac = 0; form = XmCreateForm (toplevel, "form", av, ac); ac = 0; text = XmCreateText (form, "text", av, ac); ac = 0; XtSetArg(av[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(av[ac], XmNtopWidget, text); ac++; textf = XmCreateTextField (form, "text", av, ac); XtManageChild (text); XtManageChild (textf); XtManageChild (form); XtRealizeWidget (toplevel); LessTifTestMainLoop(toplevel); /* XtAppMainLoop(app); */ exit (0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -