home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / windows / openloo / 3439 < prev    next >
Encoding:
Text File  |  1992-08-13  |  1.6 KB  |  60 lines

  1. Path: sparky!uunet!cs.utexas.edu!sun-barr!news2me.ebay.sun.com!exodus.Eng.Sun.COM!sun!amdcad!weitek!pyramid!infmx!sdavid
  2. From: sdavid@.informix.com (David Sherrick)
  3. Newsgroups: comp.windows.open-look
  4. Subject: Retrieving XtNstring from TextField
  5. Message-ID: <1992Aug13.001628.8075@informix.com>
  6. Date: 13 Aug 92 00:16:28 GMT
  7. Sender: news@informix.com (Usenet News)
  8. Organization: Informix Software, Inc.
  9. Lines: 48
  10. Originator: sdavid@jupiter
  11.  
  12. I am trying to retrieve the string that a user types into a textField
  13. widget with OLIT 2.0.  I am trying to do this with XtGetValues(), but
  14. I always get a Null string back.  Below is a piece of sample code that
  15. demonstrates my problem. 
  16.  
  17. Any help would be greatly appreciated.
  18.  
  19. David Sherrick
  20.  
  21. #include <X11/Intrinsic.h>
  22. #include <X11/StringDefs.h>
  23. #include <X11/Shell.h>
  24. #include <Xol/OpenLook.h>
  25. #include <Xol/TextField.h>
  26. #include <stdio.h>
  27.  
  28. #define MAXARGS 20
  29. #define MAXMSGSIZE 200
  30. #define VISMSGSIZE 20
  31.  
  32. int main(argc, argv)
  33. int argc;
  34. char **argv;
  35. {
  36.     Widget    toplevel, msgField;
  37.     Arg    args[MAXARGS];
  38.     char    temp[100];
  39.     int    temp2, n;
  40.  
  41.     toplevel = OlInitialize("top","Top", NULL, 0, &argc, argv);
  42.  
  43.     n = 0;
  44.     XtSetArg(args[n], XtNmaximumSize, (XtArgVal) MAXMSGSIZE);    n++;
  45.     XtSetArg(args[n], XtNcharsVisible, (XtArgVal) VISMSGSIZE);    n++;
  46.     XtSetArg(args[n], XtNstring, "test"); n++;
  47.     msgField = XtCreateManagedWidget("textfield",
  48.                 textFieldWidgetClass, toplevel, args, n);
  49.  
  50.     n = 0;
  51.     XtSetArg(args[n], XtNstring, temp); n++;
  52.     XtSetArg(args[n], XtNmaximumSize, &temp2); n++;
  53.     XtGetValues(msgField, args, n);
  54.     fprintf(stdout, "string = %s\n", temp);
  55.     fprintf(stdout, "size = %d\n", temp2);
  56.  
  57.     XtRealizeWidget(toplevel);
  58.     XtMainLoop();
  59. }
  60.