Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!ut-sally!pyramid!amiga!lucas From: lucas@amiga.UUCP (David M. Lucas) Newsgroups: net.micro.amiga Subject: Re: help with Gadgets Message-ID: <1411@amiga.amiga.UUCP> Date: Tue, 15-Jul-86 20:23:59 EDT Article-I.D.: amiga.1411 Posted: Tue Jul 15 20:23:59 1986 Date-Received: Wed, 16-Jul-86 04:58:38 EDT References: <1925@sdcsvax.UUCP> <1408@amiga.amiga.UUCP> <1409@amiga.amiga.UUCP> <1410@amiga.amiga.UUCP> Reply-To: lucas@dudley.UUCP (David M. Lucas) Organization: Commodore-Amiga Inc., 983 University Ave #D, Los Gatos CA 95030 Lines: 72 Keywords: TOGGLESELECT GADGETS POSTED FOR ROB PECK........ Jim Mackraz had suggested that the RemoveGadget(), deselect, then AddGadget() would work properly under 1.1 to autodeselect a gadget based on the selection of another one (followed by a RefreshGadgets()...) to rerender things correctly. (note... not a critique of what he said, just additional info re 1.1 gadget rendering) Unfortunately, under 1.1 the rendering of a gadget under 1.1 sometimes causes problems. For example, if a gadget is highlighted (GADGHCOMP), calling RefreshGadgets can cause the highlighted gadget to disappear since 1.1 does not realize that the gadget has already been drawn.... it first draws the gadget in its unhighlighted state, then complements the select box. In the case of a text only gadget, already selected, means that it draws the text in (effectively creating a blank highlighted box) then with the final step complements the select box (effectively erasing the gadget completely). On receiving a REFRESHWINDOW event, my own workaround (1.1 only) is to ReadPixel on a pair of gadgets, one of which is selected. If, for the one selected, there is no highlighting visible to ReadPixel (upper lefthand corner of the select box) then I issue RefreshGadgets again. Re the deselecting under 1.1, I've found a reasonable approach for me is: if a gadget is not selected, then set its toggleselect flag. if a gadget gets selected, reset its toggleselect flag. (lets the system do the highlighting for you, resetting the flag prevents system from deselecting the same gadget on a second click) on GADGETDOWN, if selected, for all other gadgets that are associated with this one that should auto deselect: i = RemoveGadget each item in turn, then: set its toggleselect flag as noted above, if SELECTED, then reset SELECTED flag and complement the select box myself. I believe its ok to do this because I removed the gadget and now own it for the moment... the system doesn't have it back until I give it back. AddGadget( gadget, i , window) this gadget then there is no need for refresh gadgets while handling the gadget list. The only time that RefreshGadgets would be needed then would be on a RefreshWindow event, watching out for the accidental (1.1 only) derendering as noted at the top of this message. (This doesn't happen under 1.2). Hope this helps. robp. Disclaimer... it worked for me... what can I say. Reply address: (dont know exactly how, but I am at the WELL, userid: robp) I just come in here sometimes to marvel at the new software releases and say hello.