[comp.sys.amiga] StringGadget Woes

hsgj@batcomputer.tn.cornell.edu (Dan Green) (12/20/86)

(assume #define GREEN 1 and #define BLACK 0 for the color registers)

   I have a Requester with BackFill GREEN.  In this Requester,
among other gadgets there is a StringGadget.  It is a global variable,
set up like:
	char	CurBuf[38];
	SHORT	CuXY[] = {0,0, 0,9, 330,9, 330,0, 0,0};
	struct	Border		CuBor = {-9,-1,0,1,JAM1,5,CuXY,NULL};
	struct	StringInfo	CuStr = {CurBuf,NULL,0,38,0};
	struct	Gadget		CuGad = {
		NULL,16,4,320,10,GADGHNONE,RELVERIFY,STRGADGET|REQGADGET,
		(APTR)&CuBor,NULL,NULL,NULL,(APTR)&CuStr,CUGAD,NULL};

Three String Gadget problems arise:
1) There is no "LeftEdge" as in IntuiText; eg the text of the string
   gadget is flush with the border.  My solution, seen above, is to
   ofset the border by -9 (one topaz-8 char + 1 pixel border).  I feel
   though that this is a kludge.

2) Apparently I have no control over the font of the string gadget text.

3) Serious Woes:  There is no way to specify text/background color of
   the string gadget to my knowledge.  In my case, Intuition apparently
   is using JAM2 with BLACK background and GREEN text.
   Unfortunately, in my requester, this makes the cursor invisible.
   Is there any way to get JAM1 with the text color BLACK on my
   requesters already GREEN border?

I am most concerned about question 3.  What I have tried so far is:
1) Tried GADGHCOMP mode.  Limited success - I got a cursor, but it was
   in color pen 3.  Since this requester may have to work in a one bitplane,
   I don't know if this is ok.  No effect on the background/forground
   and JAM2 of the text, though.
2) Tried putting some CuGad.GadgetText = some intuitext which is just spaces
   in the correct color.  No effect.
3) Blew my nose.  No effect.

If there's no solution, I'll have to bag the string gadget.  As it is, I
have been using PrintIText() a lot, because I have been unsatisfied with
the RefreshGadgets() of bool text gadgets.  In other words, I have a bool
gadg with intuitext.  I change the text.  The manual would have me believe
that refreshgadgets will redraw the text.  It does, but without clearing
the old text -- so i get overstrike smudge.  Aha!  I will try RemoveGad()
and then AddGad().  First, I have never gotten this to work on a Requester
gadget.  Second, when it works on Window gadgets, I still get overstrike.
So my solution has been to have gad.itext = NULL and do all my own calc
and printitext.  Kludge, but it gives the desired effect.

Hopefully someone can help me set the colors of the string gadget text.
Thanks, -- Dan Green
-- 
ARPA:  hsgj%vax2.ccs.cornell.edu@cu-arpa.cs.cornell.edu
UUCP:  ihnp4!cornell!batcomputer!hsgj   BITNET:  hsgj@cornella