noamb@tybalt.caltech.edu (Noam Bernstein) (03/09/89)
Heeelp.
I'm looking for help from anyone who has used SunView on a Sun 386i The
following program is copied almost straight out of the manual.
Unfortunately, it doesn't seem to work. It hangs on the window_main_loop
and waits for me to either type ^C or close the window to continue.
/* compile using the command */
/* "cc -o object.file source.file -lsuntool -lsunwindow -lpixrect" */
#include </usr/cluster/devel/sunview_devel/include/suntool/sunview.h>
#include </usr/cluster/devel/sunview_devel/include/suntool/canvas.h>
main (argc, argv)
int argc;
char **argv;
{
Frame frame;
Canvas canvas;
Pixwin *pw;
frame = window_create (NULL, FRAME, 0);
canvas = window_create (frame, CANVAS, 0);
pw = canvas_pixwin (canvas);
pw_vector (pw, 50,50,100,100,PIX_SRC,1);
pw_text (pw,125,200,PIX_SRC,0,"Hello World!");
window_main_loop (frame);
window_done(frame);
exit (0);
}
I am compiling using the command in the comment on the second line.
noamb@tybalt.caltech.edu
noamb@citiago BITNET
gfr@cobra.mitre.org (Glenn Roberts) (03/14/89)
> I'm looking for help from anyone who has used SunView on a Sun 386i > The following program is copied almost straight out of the manual. > Unfortunately, it doesn't seem to work. It hangs on the > window_main_loop and waits for me to either type ^C or > close the window to continue. The program you sent in works fine as is, although you should change lines like: #include </usr/cluster/devel/sunview_devel/include/suntool/sunview.h> to just: #include <suntool/sunview.h> You must understand that SunView is an event-driven windowing system. Once you call window_main_loop() everything that happens from then on must be an 'event'. By setting up event handler routines you can cause things to happen when keys are pressed, the mouse is moved, the window is resized, etc. Once you get the hang of this you'll be pleasantly surprised how powerful this concept is! - Glenn Roberts, The MITRE Corp., McLean VA (703) 883-6820 gfr@cobra.mitre.org
knudsen@ihlpl.att.com (Knudsen) (03/23/89)
noamb@tybalt.caltech.edu (Noam Bernstein) writes: > I'm looking for help from anyone who has used SunView on a Sun 386i The > following program is copied almost straight out of the manual. > Unfortunately, it doesn't seem to work. It hangs on the window_main_loop > and waits for me to either type ^C or close the window to continue. [program code deleted] Well, I've only written applications for a few months, but just looking at your very familiar code leaves me witht he question: Just what do expect it to do but hang? Window_main_loop() means to await mouse or keyboard events and do something with them, using notify procedures. You haven't registered any such procedures, nor defined any panel buttons etc. to trigger them. Assuming that your pw-vector() draws its line, your program is working correctly as given. Look for more manuial examples on creating a little panel with a QUIT button and a notify procedure; then you can punch it with the mouse and have yet another way to exit the program. No joke intended; once you get this working you'll be able to build panels and really get into SUnview applications. Mike Knudsen Bell Labs(AT&T) att!ihlpl!knudsen