home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / windows / x / 16714 < prev    next >
Encoding:
Text File  |  1992-09-15  |  3.0 KB  |  137 lines

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!uunet.ca!wildcan!sq!lee
  3. From: lee@sq.sq.com (Liam R. E. Quin)
  4. Subject: Re: Help Wanted: XView PANEL_MULTILINE_TEXT problem
  5. Message-ID: <1992Sep15.231234.12890@sq.sq.com>
  6. Organization: SoftQuad Inc., Toronto, Canada
  7. X-Feet: bare
  8. References: <60310@mimsy.umd.edu>
  9. Date: Tue, 15 Sep 92 23:12:34 GMT
  10. Lines: 125
  11.  
  12. nzhang@umiacs.umd.edu (Ning Zhang) writes:
  13. >I sent a request a few days ago but I did not get a workaround. Here
  14. >is a simple program reproducing the problem (tested on 4.1.1 with
  15. >Openwin 3.0 FCS and 4.1.3/w Openwin 3.0 patches).
  16.  
  17. You don't say what the problem is.  You are setting the X of the text item's
  18. VALUE to be rather small, so that it overlaps the label.
  19.  
  20. Here is a version that is more likely to be what you wanted.
  21.  
  22. Note that you don't need a Quit button, and OPEN LOOK UI programs in
  23. general should not have one, as the window manager provides that function.
  24.  
  25. Lee
  26.  
  27.  
  28. /*
  29.  * Test PANEL_MULTILINE_TEXT bug
  30.  */
  31.  
  32. #include <xview/xview.h>
  33. #include <xview/frame.h>
  34. #include <xview/panel.h>
  35.  
  36. Frame  frame;
  37. Panel  panel;
  38.  
  39. Frame  cmd_frame;
  40. Panel  cmd_panel;
  41.  
  42. Panel  mlinetxt;
  43. char   mlinetxtbuf[161];
  44.  
  45. void   test();
  46. void   disp();
  47. void   quit();
  48.  
  49. main (argc, argv)
  50. int argc;
  51. char *argv[];
  52. {
  53.     xv_init (XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
  54.  
  55.     frame = (Frame)xv_create(NULL, FRAME,
  56.         FRAME_LABEL,    argv[0],
  57.         XV_WIDTH,       200,
  58.         XV_HEIGHT,      100,
  59.         NULL);
  60.  
  61.     panel = (Panel)xv_create(frame, PANEL, NULL);
  62.  
  63.     (void) xv_create(panel, PANEL_BUTTON,
  64.         PANEL_LABEL_STRING,  "Display",
  65.         PANEL_NOTIFY_PROC,   disp,
  66.         NULL);
  67.  
  68.     (void) xv_create(panel, PANEL_BUTTON,
  69.         PANEL_LABEL_STRING,  "Quit",
  70.         PANEL_NOTIFY_PROC,   quit,
  71.         NULL);
  72.  
  73.     xv_main_loop(frame);
  74. }
  75.  
  76. void
  77. test()
  78. {
  79.    cmd_frame = xv_create(frame, FRAME_CMD,
  80.         XV_X,        0,
  81.         XV_Y,        0,
  82.         XV_HEIGHT,    100,
  83.         XV_WIDTH,    200,
  84.         XV_LABEL,    "TEST",
  85.         XV_SHOW,    TRUE,
  86.         NULL);
  87.  
  88.     cmd_panel = xv_get(cmd_frame, FRAME_CMD_PANEL);
  89.  
  90.     mlinetxt = panel_create_item(cmd_panel, PANEL_MULTILINE_TEXT,
  91. #if 0
  92.         PANEL_LABEL_X,            10,
  93.         PANEL_LABEL_Y,            10,
  94.         PANEL_VALUE_X,            10,
  95.         PANEL_VALUE_X,            30,
  96. #endif
  97.         PANEL_LABEL_STRING,        "DETAIL DESCRPTION",
  98.         PANEL_VALUE,            mlinetxtbuf,
  99.         PANEL_VALUE_DISPLAY_LENGTH,    80,
  100.         PANEL_VALUE_STORED_LENGTH,    320,
  101.         NULL);
  102.  
  103.     window_fit(cmd_panel);
  104.     window_fit(cmd_frame);
  105. }
  106.  
  107. void
  108. disp()
  109. {
  110.     static int    count = 0;
  111.  
  112.     printf("disp() count = %d\n", count);
  113.  
  114.     if (count == 0)
  115.     {
  116.         test();
  117.     }
  118.  
  119.     count++;
  120.  
  121.     (void) sprintf(mlinetxtbuf, "Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah %d\n", count);
  122.  
  123.     xv_set(mlinetxt, PANEL_VALUE, mlinetxtbuf, NULL);
  124. }
  125.  
  126. void
  127. quit()
  128. {
  129.     exit(0);
  130. }
  131.  
  132.  
  133. -- 
  134. Liam Quin, lee@sq.com, SoftQuad, Toronto, 416 239-4801; the barefoot programmer
  135.   lq-text (Unix text retrieval package) mailing list: lq-text-request@sq.com
  136.  
  137.