Path: utzoo!attcan!uunet!van-bc!rsoft!mindlink!a464 From: a464@mindlink.UUCP (Bruce Dawson) Newsgroups: comp.sys.amiga.tech Subject: Re: Gadget help wanted Message-ID: <1075@mindlink.UUCP> Date: 7 Feb 90 16:01:17 GMT Organization: MIND LINK! - British Columbia, Canada Lines: 55 > tron1 writes: > > Msg-ID: <25d085dd:842.4comp.sys.amiga.tech;1@tronsbox.UUCP> > Posted: 7 Feb 90 20:32:46 GMT > > Person: HIM > > >In article <1039LK-KARI@FINTUVM>, LK-KARI@FINTUVM.BITNET (Kari Sutela) > writes: > >> 2. If I AddGadget() a gadget and then later on RemoveGadget() it, it > will > >> be impossible to select it, but it won't disappear from the display > even > >> though I call RefreshGadgets() immediately after the RemoveGadget(). > > You have to call RemakeDisplay() I think .. that should make 100% sure > that the screen reflects ONLY what should be there. > > *********************************************************************** ***** > Everything I say is Copr. 1990, except the stuff I stole from someone else > and the stuff I don't want responsibility for. > > Kenneth J. Jamieson: Xanadu Enterprises Inc. "Professional Amiga Software" > UUCP: tron1@tronsbox.UUCP BEST PATH ---> uunet!tronsbox!tron1 > Sysop, Romantic Encounters BBS - (201)759-8450 / (201)759-8568 > *********************************************************************** ***** WRONG! This is a common misunderstanding, one that I have seen propagated through entire books on programming the Amiga. There are basically two ways of affecting what is seen on the Amiga screen. 1) Change the values being thrown into the display chip. This is usually done by the copper. This allows you to change colours, move screens, display different areas of memory, different resolutions etc. This method does not (necessarily) require changing any memory locations. 2) Change some data in a bitmap. If a gadget has been rendered into a bitmap, as above, then to clear that gadget you must somehow clear the bits that were set in the bitmap. Doing a RefreshGadgets() after removing the gadget doesn't work because the gadget isn't there anymore, Intuition doesn't know about it, so it can't refresh it. RefreshGadgets is a very simple/stupid routine that simply redraws all the gadgets it knows about. It also only highlights those that are active, which has other interesting implications (basically inactive gadgets won't get visually deselected by RefreshGadgets(), but active ones may, depending on the hightlight method used and the previous state). Probably the best solution here is to use RectFill() to clear away the bits. RemakeDisplay remakes the copper lists which play with the display chip. ie; it is a method 1 way of changing what is displayed. Although this method could be used to make the gadget invisible, it would probably also take the rest of the screen with it if you did that, which is presumably not what you want. .Bruce.