Path: utzoo!utgpu!water!watmath!clyde!rutgers!mcnc!decvax!decwrl!labrea!navajo!ali
From: ali@navajo.UUCP (Ali Ozer)
Newsgroups: comp.sys.amiga
Subject: Re: String Gadgets resolved
Message-ID: <2030@navajo.UUCP>
Date: 17 Dec 87 21:53:16 GMT
References: <1972@amiga.amiga.UUCP>
Reply-To: ali@navajo.stanford.edu (Ali Ozer)
Organization: Stanford University
Lines: 71

[]
[Posting this for Stuart Ferguson (shf@Solar.Stanford.EDU)   -Ali]

In article <1972@amiga.amiga.UUCP> jimm@amiga.UUCP (Jim Mackraz) writes:
|Regarding string gadgets, and the use of ActivateGadget().
|
|The lowdown is this here:
|
|...OpenWindow() normally returns with the window INACTIVE.  Calling a 
|Delay(5L) to let things sort out is kind of bad, especially since

Guilty.  I recomended that fix.

|a truer alternative is available (you could get screwed if there is
|a lot of blitter activity, I think).  What you want to do is wait
|until you get your first ACTIVEWINDOW message from Intuition, then
|you have a good shot at getting the gadget active.

The sequence I was using was:

	Request (req, win);
	Delay (5L);
	ActivateGadget (gad, win, req);
	

It didn't work without the Delay().  I've since gone back and changed the
above to:

	Request (req, win);
	 {
		...
		case REQSET: ActivateGadget (gad, win, req); break;
		...
	}

This works fine, and is obviously preferable from an aesthetic standpoint.
Thanx for the advice everyone!

|And that's the lowdown.
|Jim Mackraz, I and I Computing	  

Maybe you can help with this new problem, also dealing with the dreaded
String Gadgets.

I have a string gadget in a requester with RELVERIFY set.  The user selects
this gadget and enters a value by pressing return.  The program then adjusts
this value to fit the parameters, writes the new value back into the string
gadget buffer and refreshes the gadget.  Thusly:

	
	case GADGETUP:
	    ...
	    case STR_ID:
		sscanf (buffer, "%d", &val); /* read out the string buffer */
		val = val%16;             /* adjust value to correct range */
		sprintf (buffer, "%d", val); /* update gadget */
		RefreshGList (&strgad, win, req, 1L);
		break;
		...

The problem is that if I select this gadget, type in a value and press return,
the new value gets printed into the string gadget, but the cursor is still
on!  In any normal string gadget if I press return the cursor disapears, but
in this one the cursor is still rendered.  The string gadget, however, is NOT
active.  To make the cursor go away, I have to select the gadget *again* and
de-select it by clicking somewhere else (not by pressing return).

This simply won't do.  Any ideas about how to fix this?

	Stuart Ferguson (shf@Solar.Stanford.EDU)
	Action by HAVOC