home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / windows / openloo / 5176 < prev    next >
Encoding:
Text File  |  1993-01-28  |  2.3 KB  |  96 lines

  1. Newsgroups: comp.windows.open-look
  2. Path: sparky!uunet!ukma!cs.widener.edu!iggy.GW.Vitalink.COM!nocsun.NOC.Vitalink.COM!netarch!rc
  3. From: rc@netarch.com (Ran-Chi Huang)
  4. Subject: Help with XView program (ttysw)
  5. Message-ID: <1993Jan28.102650.16816@netarch.com>
  6. Organization: Network Architecture Consulting
  7. Date: Thu, 28 Jan 1993 10:26:50 GMT
  8. Lines: 86
  9.  
  10. This is the very first XView program that I'm writing and hope that
  11. netters can offer some suggestions and help me out.
  12.  
  13. I'm writing a "Telnet tool" so that when the "Connect" button is
  14. clicked, a Telnet window pops up. When I am done with this
  15. telnet session, I want the telnet window to exit gracefully.
  16.  
  17. I also want the ability to have as many telnet windows as I want by
  18. clicking on this button. i.e. each click of this button will fire up
  19. a new telnet window.
  20.  
  21. I was told that I may need a ttysw ? I have the main framework done
  22. but I'm not sure how to get this to work. If you have some example code
  23. that does this, that would be most helpful.
  24.  
  25. Please email responses to me and I will summarize if there is interest.
  26.  
  27. Thanks
  28.  
  29. -rc
  30. rc@netarch.com
  31.  
  32. Here is the code that I wrote. It's short.
  33.  
  34. #include <xview/panel.h>
  35. #include <xview/frame.h>
  36.  
  37. Frame        frame;
  38. Panel        panel, subpanel;
  39. Panel_item    status, start_b;
  40.  
  41. void        doconnect();
  42.  
  43. main (argc, argv)
  44.     int argc;
  45.     char **argv;
  46. {
  47.     xv_init (XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
  48.  
  49.     frame = xv_create (NULL, FRAME,
  50.         XV_LABEL, "Localhost Tool",
  51.         XV_HEIGHT, 300,
  52.         XV_WIDTH, 400,
  53.         0);
  54.  
  55.     panel = xv_create (frame, PANEL, 0);
  56.  
  57.     start_b = xv_create (panel, PANEL_BUTTON,
  58.         PANEL_LABEL_STRING, "Connect...",
  59.         PANEL_NOTIFY_PROC, doconnect,
  60.         0);
  61.  
  62.     window_fit_height (panel);
  63.  
  64.     subpanel = (Panel) xv_create (frame, PANEL,
  65.         WIN_BELOW, canvas_paint_window(panel),
  66.         XV_WIDTH,  xv_get(panel, XV_WIDTH),
  67.         XV_HEIGHT, xv_get(panel, XV_HEIGHT)+100,
  68.         WIN_BORDER, TRUE,
  69.         PANEL_LAYOUT, PANEL_VERTICAL,
  70.         0);
  71.  
  72.     status = xv_create (subpanel, PANEL_TEXT,
  73.         PANEL_LABEL_STRING, "Status",
  74.         PANEL_LABEL_WIDTH, 50,
  75.         PANEL_VALUE, "Not connected",
  76.         PANEL_VALUE_DISPLAY_LENGTH, 20,
  77.         PANEL_VALUE_STORED_LENGTH, 20,
  78.         0);
  79.  
  80.     window_fit_height (frame);
  81.  
  82.     xv_main_loop (frame);
  83. }
  84.  
  85. void
  86. doconnect (i, e)
  87.     Panel_item i;
  88.     Event *e;
  89. {
  90.     printf ("Telnet ... function\n");
  91. }
  92. -- 
  93. --
  94. Ran-Chi Huang                                               rc@netarch.com
  95. Network Architecture Consulting., Fremont, CA                   netarch!rc
  96.