Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!cbmvax!peter From: peter@cbmvax.commodore.com (Peter Cherna) Newsgroups: comp.sys.amiga.programmer Subject: Re: Modifying a string gadget from within a program Message-ID: <22608@cbmvax.commodore.com> Date: 20 Jun 91 17:52:02 GMT References: <11169@castle.ed.ac.uk> Reply-To: peter@cbmvax.commodore.com (Peter Cherna) Organization: Commodore-Amiga, Inc. West Chester, PA. Lines: 26 In article <11169@castle.ed.ac.uk> mfg@castle.ed.ac.uk (M Gordon) writes: >A program I am currently writing uses two string gadgets to display and >allow alteration of an (x,y) coordinate. What I want to be able to do is >to allow a mouse click in a window to also set these values. >The problem is: how do I update the string gadgets? Can I just put the >new value into the string gadgets buffer, set the longint value and refresh >them or do I have to do something else? Never modify a gadget while it is attached to the window. Do the following: /* make the two gadgets follow each other, so you can manipulate * them with one call. That is, gad1->NextGadget=gad2. */ pos = RemoveGList( win, gad1, 2 ); /* now change buffer and LongInt */ AddGList( win, gad1, pos, 2, NULL ); RefreshGList( gad1, win, NULL, 2 ); >Michael Gordon - mfg@castle.ed.ac.uk OR ee.ed.ac.uk | |_| |_| |__| |_| | Peter -- Peter Cherna, Operating Systems Development Group, Commodore-Amiga, Inc. {uunet|rutgers}!cbmvax!peter peter@cbmvax.commodore.com My opinions do not necessarily represent the opinions of my employer. "Gosh, didn't he have anything positive to say at all?"