home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!sun-barr!news2me.ebay.sun.com!exodus.Eng.Sun.COM!sun!amdcad!weitek!pyramid!infmx!sdavid
- From: sdavid@.informix.com (David Sherrick)
- Newsgroups: comp.windows.open-look
- Subject: Retrieving XtNstring from TextField
- Message-ID: <1992Aug13.001628.8075@informix.com>
- Date: 13 Aug 92 00:16:28 GMT
- Sender: news@informix.com (Usenet News)
- Organization: Informix Software, Inc.
- Lines: 48
- Originator: sdavid@jupiter
-
- I am trying to retrieve the string that a user types into a textField
- widget with OLIT 2.0. I am trying to do this with XtGetValues(), but
- I always get a Null string back. Below is a piece of sample code that
- demonstrates my problem.
-
- Any help would be greatly appreciated.
-
- David Sherrick
-
- #include <X11/Intrinsic.h>
- #include <X11/StringDefs.h>
- #include <X11/Shell.h>
- #include <Xol/OpenLook.h>
- #include <Xol/TextField.h>
- #include <stdio.h>
-
- #define MAXARGS 20
- #define MAXMSGSIZE 200
- #define VISMSGSIZE 20
-
- int main(argc, argv)
- int argc;
- char **argv;
- {
- Widget toplevel, msgField;
- Arg args[MAXARGS];
- char temp[100];
- int temp2, n;
-
- toplevel = OlInitialize("top","Top", NULL, 0, &argc, argv);
-
- n = 0;
- XtSetArg(args[n], XtNmaximumSize, (XtArgVal) MAXMSGSIZE); n++;
- XtSetArg(args[n], XtNcharsVisible, (XtArgVal) VISMSGSIZE); n++;
- XtSetArg(args[n], XtNstring, "test"); n++;
- msgField = XtCreateManagedWidget("textfield",
- textFieldWidgetClass, toplevel, args, n);
-
- n = 0;
- XtSetArg(args[n], XtNstring, temp); n++;
- XtSetArg(args[n], XtNmaximumSize, &temp2); n++;
- XtGetValues(msgField, args, n);
- fprintf(stdout, "string = %s\n", temp);
- fprintf(stdout, "size = %d\n", temp2);
-
- XtRealizeWidget(toplevel);
- XtMainLoop();
- }
-