mike@ames.arc.nasa.gov (Mike Smithwick) (05/09/89)
I am trying to put a background image into a sunview panel, but am coming across the expected problems. . . First I tried something like : window_set(panel,WIN_SHOW,TRUE,0); pw_replrop() /* draw (?)image, (nothing is drawn) */ window_main_loop() So nothing worked here. Next I tried catching events for the window so I could pick up "WIN_REPAINT" and explicitly draw the pattern after the window was painted. But the event handler seems to get called before the system paints the items (shouldn't it have done that already with window_set()?). So the pattern gets painted, then cleared when the items are painted. Setting "PANEL_PAINT,PANEL_NO_CLEAR" doesn't stop the clearing. I tried making the background pattern a message item, but it would always end up consuming events for everything else, so my buttons would stop working. <2> Is there anyway to get rid of the thin boarder around a panel, so we can write our own boarder imagery? <3> Is there anyway to define an alternate image for a button, instead of relying on sunview's own braindead invert highlighting. I want to use two separate rastfile images and alternate between the two. Right now I have to use Messages for the image, and explicitly catch the MS_LEFT/down and up events and change the image myself. *** mike (cerbral GURU, insert M&Ms to restart) smithwick*** "Oh, I'm just a NOP in the instruction set of life, oh, ohhhh, hmmmmm" [disclaimer : nope, I don't work for NASA, I take full blame for my ideas]
neil@teleos.com (Neil Hunt) (05/12/89)
This seems to work for me; get the panel items painted before you paint your own custom background by calling notify_next_event_func from your event func handler; The example below simply puts a box around a number of items in the panel to group them together visually. Notify_value bg_paint(panel, event, arg, type) Panel panel; Event *event; Notify_arg arg; Notify_event type; { Pixwin *pw; Notify_value value; /* * Call the normal notify_event handler. */ value = notify_next_event_func(panel, event, arg, type); if(event_id(event) != WIN_REPAINT) return value; /* * Add additional repainting actions. */ pw = (Pixwin *)window_get(panel, WIN_PIXWIN); pw_rect(pw, S_X, S_Y, S_W, S_H, 1, PIX_SRC, -1); return value; } Frame create_frame() { Frame frame; Panel panel; frame = window_create( ... WIN_WIDTH, E_W+10+10, WIN_HEIGHT, E_Y+E_H+5+20, 0); if(frame == NILFRAME) return NILFRAME; panel = panel_create(frame, ... WIN_WIDTH, E_W+10, WIN_HEIGHT, E_Y+E_H+5, 0); notify_interpose_event_func(panel, bg_paint, NOTIFY_SAFE); return frame; } Neil/.
chuck@trantor.harris-atd.com (Chuck Musciano) (05/12/89)
> I am trying to put a background image into a sunview panel, but am coming > across the expected problems. . . I was never able to get this working correctly. It's all moot, since this ability is explicitly not supported under XView. > Is there anyway to define an alternate image for a button, instead > of relying on sunview's own braindead invert highlighting. You can attach an event proc to a button, and you will receive events like PANEL_BEGIN_PREVIEW and PANEL_CANCEL_PREVIEW. This signify the various states of the button click sequence. You can do whatever you want to modify the button appearance when you receive these events. Look at the manual section about panels, and look at the code in calctool to see how this is done. Chuck Musciano ARPA : chuck@trantor.harris-atd.com Harris Corporation Usenet: ...!uunet!x102a!trantor!chuck PO Box 37, MS 3A/1912 AT&T : (407) 727-6131 Melbourne, FL 32902 FAX : (407) 727-{5118,5227,4004}