🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #13576

Re: Gadget help wanted

#13576
From: Chuck McManis
Date: Fri, 09 Feb 1990 01:28
50 lines
2205 bytes
No one seems to have actually answered this completely, Bruce came close.

RemoveGadget does not "remove" the bits of the gadget from your window,
it just removes it from the list of gadgets that Intuition is checking for
when mouse clicks come in. 

To make it disappear try this :

void
ClearGadget(win, gad)
	struct Window	*win;	/* Window with gadget in it. */
	struct Gadget	*gad;	/* The gadget to clear 	     */
{
	short	OldAPen;

	OldAPen = win->RPort->FgPen;
	SetAPen(win->RPort, win->BlockPen);
	Rectfill(win->RPort, gad->LeftEdge, gad->TopEdge, 
		 gad->LeftEdge + gad->Width, gad->TopEdge + gad->Height);
	SetAPen(win->RPort, OldAPen);
	return;
}

This presumes that BlockPen is what you rendered underneath the
gadget. If you have refresh routine that re-renders your window
that would work as well in something like this :

void
RedrawEverything(win)
	struct Window	*win; /* The window to redraw */
{
	/* Clear the window completely */
	SetAPen(win->RPort, win->BlockPen);
	RectFill(win->RPort, win->BorderLeft, win->BorderTop,
 	    win->Height - win->BorderBottom, win->Width - win->BorderRight);

	/* Call your refresh routine to re-render it */
	UserRedrawRoutine(); /* Re render your window */
	
	/* Refresh the Intui stuff like the gadgets and the frame */
	RefreshGadgets(win->FirstGadget, win, NULL);
	RedrawWindowFrame(win);
	return ;
}


--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@Eng.Sun.COM
These opinions are my own and no one elses, but you knew that didn't you.
"If it didn't have bones in it, it wouldn't be crunchy now would it?!"
Technical Details
Message-ID: <131509@sun.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!bloom-beacon!snorkelwacker!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!rex!ames!sun-barr!newstop!sun!stpeter!cmcmanis
References: <1075@mindlink.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!bloom-beacon!snorkelwacker!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!rex!ames!sun-barr!newstop!sun!stpeter!cmcmanis
From: cmcmanis@stpeter.Sun.COM (Chuck McManis)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Gadget help wanted
Message-ID: <131509@sun.Eng.Sun.COM>
Date: 9 Feb 90 01:28:40 GMT
References: <1075@mindlink.UUCP>
Sender: news@sun.Eng.Sun.COM
Reply-To: cmcmanis@sun.UUCP (Chuck McManis)
Organization: Sun Microsystems, Mountain View
Lines: 50