[comp.sys.amiga.programmer] Refresh GList hang...

peter@cbmvax.commodore.com (Peter Cherna) (02/05/91)

In article <HHFqw5w164w@halcyon.uucp> halcyon!elf@sumax.seattleu.edu (Elf Sternberg) writes:
>
>        I've been trying to get this damn program to run for two days 
>now.  It's the first one I've written using AddGList (or AddGadget, I've 
>tried both) and yet every time I get to RefreshGList (or RefreshGadgets) 
>the system hangs.  Once, I was about to get a SYSTEM_REQUEST but the 
>system froze before the text could be printed.

Are you sure you have the right parameters?

	RefreshGList( gadgets, window, requester, numgad );

Gadgets points to the first gadget to refresh, window to the window
the gadgets are in, requester points to the requester, or use NULL
if the gadgets are in a window proper, and numgad is the number of
gadgets to refresh (or ~0 to refresh them all).  If you're using Aztec
with 16-bit integers, make sure that numgad is followed by an L, eg.

	RefreshGList( gad, win, NULL, 3L );

Make sure you've added the gadgets successfully before you call
RefreshGList().

	AddGList( Window, Gadget, Position, Numgad, Requester )

Again, be sure that position and numgad have an L at the end, if you're
using Aztec with 16-bit ints.

>Elf Sternberg      | Nuke: To destroy, obliterate, demolish,  wipe out,

     Peter
--
     Peter Cherna, Software Engineer, Commodore-Amiga, Inc.
     {uunet|rutgers}!cbmvax!peter    peter@cbmvax.commodore.com
My opinions do not necessarily represent the opinions of my employer.
"Oh, PIN-compatible!  I thought you wanted me to make it IN-compatible!"

peter@cbmvax.commodore.com (Peter Cherna) (02/05/91)

In article <HHFqw5w164w@halcyon.uucp> halcyon!elf@sumax.seattleu.edu (Elf Sternberg) writes:
>
>        Has anyone else had this problem?  I've only got three active 
>gadgets on the screen, anyway.

I thought of one more thing.  Don't call RefreshGadgets() or RefreshGList()
inside of a Begin/EndRefresh() pair.  Intuition takes care of automatically
refreshing your gadgets when damage occurs.  You don't need to do any
yourself.

>Elf Sternberg      | Nuke: To destroy, obliterate, demolish,  wipe out,

     Peter
--
     Peter Cherna, Software Engineer, Commodore-Amiga, Inc.
     {uunet|rutgers}!cbmvax!peter    peter@cbmvax.commodore.com
My opinions do not necessarily represent the opinions of my employer.
"Oh, PIN-compatible!  I thought you wanted me to make it IN-compatible!"

markv@kuhub.cc.ukans.edu (02/06/91)

In article <HHFqw5w164w@halcyon.uucp>, halcyon!elf@sumax.seattleu.edu (Elf Sternberg) writes:
>         I've been trying to get this damn program to run for two days 
> now.  It's the first one I've written using AddGList (or AddGadget, I've 
> tried both) and yet every time I get to RefreshGList (or RefreshGadgets) 
> the system hangs.  Once, I was about to get a SYSTEM_REQUEST but the 
> system froze before the text could be printed.
>         Has anyone else had this problem?  I've only got three active 
> gadgets on the screen, anyway.

I had a similar problem, but intermittant.  Make DARN SURE all your
linked elements end with a foo->NextXXX = NULL;  Sometimes you get
lucky and the the pointer will point a 0ed memory before things get
completely hosed, but...  And it can take some work.  I personally
always used AllocMem(foo, foo | MEMF_CLEAR); or calloc() (I even do a 
#define malloc(x) calloc(x,1)) to get a cleared block so I am okay if
I miss one.

In general, esp. with Intuition stuff, look for problems in linkage
(bad pointer, etc) and bounds errors (like Text() rendering past the
edge of a bitmap, or bad gadget loc/size) if you get serious problems
that totally hose your system (My last problem once killed Kickstart
on our 3000!).
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mark Gooderum			Only...		\    Good Cheer !!!
Academic Computing Services	       ///	  \___________________________
University of Kansas		     ///  /|         __    _
Bix:	  mgooderum	      \\\  ///  /__| |\/| | | _   /_\  makes it
Bitnet:   MARKV@UKANVAX		\/\/  /    | |  | | |__| /   \ possible...
Internet: markv@kuhub.cc.ukans.edu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~