[comp.sys.amiga.programmer] Modifying a string gadget from within a program

mfg@castle.ed.ac.uk (M Gordon) (06/19/91)

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?

Thanks

-- 
							 _   _   _    _   _	
Michael Gordon - mfg@castle.ed.ac.uk OR ee.ed.ac.uk	| |_| |_| |__| |_| |   
							| . . . .      . . |    
I spilt spot remover on my dog and now he's gone! 	|_________|~~|_____|    

peter@cbmvax.commodore.com (Peter Cherna) (06/21/91)

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?"