bickel@nprdc.navy.mil (Steven Bickel) (03/14/89)
In article <106@oberon.UUCP> centaure!oberon!brian@uunet.uu.net (Brian) writes: >I am trying to draw into a panel, and am having some difficulties. If >anyone can help, please e-mail me. Don't do it. We used to do this in a non-supported way and Sun told us to stop doing this and use a canvas. We are glad we did because Sun-OS versions differ a great deal in how well these non-supported changes worked. Steve Bickel Steve Bickel bickel@nprdc.arpa Systems Engineering Assoc. (619) 553-9306 Naval Personel R & D Center.
mond@sun.com (Raymond Kreisel) (03/23/89)
>I am trying to draw into a panel, and am having some difficulties. >But, the panel package sucks up the WIN_REPAINT >event before I can get to it... So, it never gets to my event procedure >with a WIN_REPAINT event If you set a event procedure for the panel it will NOT get called when a WIN_REPAINT happens because of a bug in the panel package. In order to put graphics on a panel and have them repainted, you MUST set up a REPAINT interposer. The following code shows how to do this. ray Ray Kreisel UUCP: sun!mond ARPA-Internet: mond@sun.com __________ /* * Compile: cc -g -o zzz zzz.c -lsuntool -lsunwindow -lpixrect */ #include <suntool/sunview.h> #include <suntool/panel.h> Frame base_frame0; Panel panel0; Initialize_Windows(argcp, argv) int *argcp; char **argv; { base_frame0 = window_create(NULL, FRAME, WIN_X, 525, WIN_Y, 0, WIN_WIDTH, 500, WIN_HEIGHT, 160, FRAME_LABEL, "Tool", FRAME_ARGC_PTR_ARGV, argcp, argv, 0); panel0 = window_create(base_frame0, PANEL, WIN_X, 0, WIN_Y, 0, WIN_WIDTH, 490, WIN_HEIGHT, 138, 0); } my_inter(panel,event,arg,type) Panel panel; Event *event; Notify_arg arg; Notify_event_type type; { Notify_value value; Pixwin *panel_pw; value = notify_next_event_func(panel,event,arg,type); if (event_action(event) == WIN_REPAINT) { printf("got a repaint!!!\n"); panel_pw = (Pixwin *)window_get(panel,WIN_PIXWIN); pw_vector(panel_pw,0,0,300,300,PIX_SRC,1); } return(value); } main(argc, argv) int argc; char **argv; { Initialize_Windows(&argc,argv); notify_interpose_event_func(panel0, my_inter,NOTIFY_SAFE); window_main_loop(base_frame0); }