🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #11648

Re: graphics in panels--event procedure

#11648
From: Raymond Kreisel
Date: Thu, 23 Mar 1989 09:22
76 lines
2529 bytes
>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);
}
Technical Details
Message-ID: <8903100107.AA00665@zowie.sun.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request
From: mond@sun.com (Raymond Kreisel)
Newsgroups: comp.sys.sun
Subject: Re: graphics in panels--event procedure
Keywords: Windows
Message-ID: <8903100107.AA00665@zowie.sun.com>
Date: 23 Mar 89 09:22:41 GMT
Sender: usenet@rice.edu
Organization: Sun-Spots
Lines: 76
Approved: Sun-Spots@rice.edu
Original-Date: Thu, 9 Mar 89 17:07:34 PST
X-Sun-Spots-Digest: Volume 7, Issue 207, message 7 of 15