home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.open-look
- Path: sparky!uunet!ukma!cs.widener.edu!iggy.GW.Vitalink.COM!nocsun.NOC.Vitalink.COM!netarch!rc
- From: rc@netarch.com (Ran-Chi Huang)
- Subject: Help with XView program (ttysw)
- Message-ID: <1993Jan28.102650.16816@netarch.com>
- Organization: Network Architecture Consulting
- Date: Thu, 28 Jan 1993 10:26:50 GMT
- Lines: 86
-
- This is the very first XView program that I'm writing and hope that
- netters can offer some suggestions and help me out.
-
- I'm writing a "Telnet tool" so that when the "Connect" button is
- clicked, a Telnet window pops up. When I am done with this
- telnet session, I want the telnet window to exit gracefully.
-
- I also want the ability to have as many telnet windows as I want by
- clicking on this button. i.e. each click of this button will fire up
- a new telnet window.
-
- I was told that I may need a ttysw ? I have the main framework done
- but I'm not sure how to get this to work. If you have some example code
- that does this, that would be most helpful.
-
- Please email responses to me and I will summarize if there is interest.
-
- Thanks
-
- -rc
- rc@netarch.com
-
- Here is the code that I wrote. It's short.
-
- #include <xview/panel.h>
- #include <xview/frame.h>
-
- Frame frame;
- Panel panel, subpanel;
- Panel_item status, start_b;
-
- void doconnect();
-
- main (argc, argv)
- int argc;
- char **argv;
- {
- xv_init (XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
-
- frame = xv_create (NULL, FRAME,
- XV_LABEL, "Localhost Tool",
- XV_HEIGHT, 300,
- XV_WIDTH, 400,
- 0);
-
- panel = xv_create (frame, PANEL, 0);
-
- start_b = xv_create (panel, PANEL_BUTTON,
- PANEL_LABEL_STRING, "Connect...",
- PANEL_NOTIFY_PROC, doconnect,
- 0);
-
- window_fit_height (panel);
-
- subpanel = (Panel) xv_create (frame, PANEL,
- WIN_BELOW, canvas_paint_window(panel),
- XV_WIDTH, xv_get(panel, XV_WIDTH),
- XV_HEIGHT, xv_get(panel, XV_HEIGHT)+100,
- WIN_BORDER, TRUE,
- PANEL_LAYOUT, PANEL_VERTICAL,
- 0);
-
- status = xv_create (subpanel, PANEL_TEXT,
- PANEL_LABEL_STRING, "Status",
- PANEL_LABEL_WIDTH, 50,
- PANEL_VALUE, "Not connected",
- PANEL_VALUE_DISPLAY_LENGTH, 20,
- PANEL_VALUE_STORED_LENGTH, 20,
- 0);
-
- window_fit_height (frame);
-
- xv_main_loop (frame);
- }
-
- void
- doconnect (i, e)
- Panel_item i;
- Event *e;
- {
- printf ("Telnet ... function\n");
- }
- --
- --
- Ran-Chi Huang rc@netarch.com
- Network Architecture Consulting., Fremont, CA netarch!rc
-