[comp.sys.amiga.tech] String Gadget Problem

jeff@cpoint.UUCP (Jeffrey J. Griglack) (02/04/89)

I am having a problem with a string gadget that I hope someone can help
me with.

I set the gadget up, in a requester, to be length of 20.  This worked
fine until I changed the default font for the screen to be Garnet
(a proportional font).  Now, I can only enter 10 characters, but, at
the end of entry, the cursor is sitting 20 characters out.  The entry
is spaced properly, but the cursor moves 2 spaces away from the letters
on each letter entered.

Has anybody else encountered this problem, and, if so, how did you
correct it?

Any help would be greatly appreciated.

Jeff Griglack

{decvax, cybvax0, mirror}!frog!cpoint!jeff

jimm@amiga.UUCP (Jim Mackraz) (02/08/89)

In article <2030@cpoint.UUCP> jeff@cpoint.UUCP (Jeffrey J. Griglack) writes:
)
)I am having a problem with a string gadget that I hope someone can help
)me with.
)
)I set the gadget up, in a requester, to be length of 20.  This worked
)fine until I changed the default font for the screen to be Garnet
)(a proportional font).  ...

String gadgets do not support proportional fonts.

This has been corrected for V1.4.

)Has anybody else encountered this problem, and, if so, how did you
)correct it?

Tossed 'em out and rewrote 'em.

	jimm
-- 
Jim Mackraz, I and I Computing	   	"Like you said when we crawled down
{cbmvax,well,oliveb}!amiga!jimm          from the trees: We're in transition."
							- Gang of Four
Opinions are my own.  Comments are not to be taken as Commodore official policy.

gay@elde.epfl.ch (David Gay) (05/03/89)

In article <not posted>, I wrote:
->I'm having some problems with ActivateGadget: I have two text gadgets, which
->I must refresh, and activate one of them. If I do the obvious
->
->RefreshGList(gadget1, req->RWindow, req, 1);
->RefreshGList(gadget2, req->RWindow, req, 1);
->if (something) ActivateGadget(gadget1, req->RWindow, req);
->else ActivateGadget(gadget2, req->RWindow, req);
->
->both gadgets end up with cursors (though only one is active).
->
->I must do the following to get things (partially) working:
->
->if (something)
->{
->    RefreshGList(gadget1, req->RWindow, req, 1);
->    ActivateGadget(gadget1, req->RWindow, req);
->    RefreshGList(gadget2, req->RWindow, req, 1);
->}
->else
->{
->    RefreshGList(gadget2, req->RWindow, req, 1);
->    ActivateGadget(gadget2, req->RWindow, req);
->    RefreshGList(gadget1, req->RWindow, req, 1);
->}
->
->Also, both versions of this code will not activate the same gadget twice
->consecutively (that is, ActivateGadget(gadget2), user presses return,
->ActivateGadget(gadget2) won't (always) work properly).
->
->Has anybody else had similar problems ? Any workarounds ?
->
Since then, I've found that doing a RefreshGList on a just deselected gadget
is what causes the problems (It seems to think that the gadget is still active
and displays a cursor). I've found (Prepare ASBESTOS suit) that the following
will 'cure' this (and the 2nd) problem (ASBESTOS suit now being worn):

IntuitionBase->ActiveGadget = NULL;

Any better workaround, or comments ?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
David Gay                                  6 x 9 = 42

GAY@ELDE.EPFL.CH, or GAY%ELDE.EPFL.CH@CLSEPF51.bitnet

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

840445m@aucs.uucp (Alan McKay) (02/22/90)

I am having trouble with the text in string gadgets.  When I draw a border 
around the text, the text always appears in the top left and covers up 2
sides of the border ... like this

    text text text text text|
    +-----------------------+

I know that I can fix this by specifying a border offset of -2,-2, but the
problem with this is that I also use the same borders to surround text that
goes into boolean gadgets.  In the b. gadgets I can specify the offset of
the IntuiText in the gadget to be 2,2 which is great.  Is there anyway to
do the same with the text in the string gadet?

An alternative for me would be to keep my borders offset at -2,-2 and change
the text in my boolean gadgets to be 0,0, but then the border would not 
truly represent the hit box of the gadget.

Here are my data structures if that is of any help:

SHORT const pnts_one = {
   0,0,
   0,10,
   10,10,
   10,0,
   0,0            /* enough to encirle one letter of default font */
};

struct Border brdr_one = {
   0,0,                     /* x and y offset */
   1,0,JAM1,
   5,
   &pnts_one[0],
   NULL                     /* use default font */
};

struct StringInfo si_one = {
   &buff_one[0],
   &buff_undo[0],
   1,2,0,
   NULL,
   NULL,
   NULL,
   NULL,
   NULL,
   (LONG)0,
   NULL
};

struct Gadget gad_one = {
   &gad_next,
   x, y, w, h,
   GADGHCOMP,
   RELVERIFY | STRINGCENTER,
   STRGADGET,
   (APTR)&brdr_one,
   NULL,
   NULL,
   NULL,
   (APTR)&si_one,
   gid_ONE,
   NULL
};

/* now here is the boolean gadget using same border */

struct IntuiText itext_one = {
   1,0,
   JAM2,
   2,2,        /* x and y offset */
   NULL,
   "T",
   NULL
};

struct Gadget gad_two = {
   &gad_one,
   x, y, w, h,
   GADGHCOMP,
   GADGIMMEDIATE | TOGGLESELECT,
   BOOLGADGET,
   (APTR)&brdr_one,
   NULL,
   &itext_one,
   NULL,
   NULL,
   gid_TWO,
   NULL
};

Thanks in advance for any help or insights

peter@cbmvax.commodore.com (Peter Cherna) (02/24/90)

In article <1990Feb22.131859.17022@aucs.uucp> 840445m@aucs.UUCP (Alan McKay) writes:
>I am having trouble with the text in string gadgets.  When I draw a border 
>around the text, the text always appears in the top left and covers up 2
>sides of the border ... like this
>
>    text text text text text|
>    +-----------------------+
>
>I know that I can fix this by specifying a border offset of -2,-2, but the
>problem with this is that I also use the same borders to surround text that
>goes into boolean gadgets.  In the b. gadgets I can specify the offset of
>the IntuiText in the gadget to be 2,2 which is great.  Is there anyway to
>do the same with the text in the string gadet?
>
>An alternative for me would be to keep my borders offset at -2,-2 and change
>the text in my boolean gadgets to be 0,0, but then the border would not 
>truly represent the hit box of the gadget.

There is no legal way to offset the string gadget text like IntuiText.
The best solution is to use two different (but similar) Border structures
that can share the same border points.

>Thanks in advance for any help or insights

     Peter
--
     Peter Cherna, Software Engineer, Commodore-Amiga, Inc.
     {uunet|rutgers}!cbmvax!peter    peter@cbmvax.cbm.commodore.com
My opinions do not necessarily represent the opinions of my employer.