[comp.sys.amiga] I need help with proportional gadgets!

ali@navajo.STANFORD.EDU (Ali Ozer) (12/15/86)

Keywords:


[=====:-(===========]   

Ok... Here's a question about proportional gadgets. Problem: I'm having
a hard time getting them to work right for me.  Maybe I should be using
EGad, but, sigh, I don't have it yet... Anyway, I have the following
piece of code.  I initialize my proportional gadget using InitGadgets()
below. The problem is, the select box of the gadget is not the same as
my background color. Also, when I select the knob, the knob is complemented,
although I am specifying no highlighting. Furthermore, as I move the
gadget around slowly, it erases the background color. But, if I move
it quickly, it erases it, but not perfectly --- It leaves patches of
it behind. 

-------
/* I don't initialize this image --- The Intuition Manual says "don't
   initialize it when using AutoKnob." I wonder why we even need it?  */
static struct Image InvPropImage;

/* I initialize this PropInfo during runtime, in InitGadgets() */
static struct PropInfo InvBoxPInfo;

static struct Gadget InvBoxGadget = {
  NULL /* No next */,
  (SHORT)X1, (SHORT)Y1, (SHORT)INVBOXWIDTH, (SHORT)INVBOXHEIGHT,
  GADGHNONE | GADGDISABLED, RELVERIFY,
  PROPGADGET, (APTR)(&InvPropImage), 
  NULL, NULL, NULL, (APTR)(&InvBoxPInfo), INVBOXID, NULL};

InitGadgets ()
{
  InvBoxPInfo.Flags = (AUTOKNOB | FREEVERT | PROPBORDERLESS); 
  InvBoxPInfo.VertBody = 0x1000;         
  InvBoxPInfo.HorizBody = 0xffff;       
  AddGadget (win, &InvBoxGadget, -1L);   /* win is my window */
  OnGadget (&InvBoxGadget, win, NULL);     
}

In summary: My gadget's select box is filled with some color, but I want
it the same as color 0. (I even tried setting pen colors to 0 before
doing the OnGadget... No use.) When I move the knob around, it erases
this background color, but if move it too quickly, it doesn't erase it
completely. Also, the knob is highlighted when selected. I don't want that!
What am I doing wrong? Something stupid, I hope. (In case it helps: My screen
is 4 planes deep, I use a backdrop window, & I trap RAWKEY & GADGETUP events.)

Ali Ozer, ali@navajo.stanford.edu

carolyn@cbmvax.cbm.UUCP (Carolyn Scheppner) (12/18/86)

In article <1216@navajo.STANFORD.EDU> ali@navajo.ARPA (Ali Ozer) writes:
>[=====:-(===========]   
>
>Ok... Here's a question about proportional gadgets. ...
>... The problem is, the select box of the gadget is not the same as
>my background color. Also, when I select the knob, the knob is complemented,
>although I am specifying no highlighting. Furthermore, as I move the
>gadget around slowly, it erases the background color. But, if I move
>it quickly, it erases it, but not perfectly --- It leaves patches of
>it behind. 
>
>-------
>/* I don't initialize this image --- The Intuition Manual says "don't
>   initialize it when using AutoKnob." I wonder why we even need it?  */
>static struct Image InvPropImage;
>/* I initialize this PropInfo during runtime, in InitGadgets() */
>static struct PropInfo InvBoxPInfo;
>
>static struct Gadget InvBoxGadget = {
>  NULL /* No next */,
>  (SHORT)X1, (SHORT)Y1, (SHORT)INVBOXWIDTH, (SHORT)INVBOXHEIGHT,
>  GADGHNONE | GADGDISABLED, RELVERIFY,
>  PROPGADGET, (APTR)(&InvPropImage), 
>  NULL, NULL, NULL, (APTR)(&InvBoxPInfo), INVBOXID, NULL};

Intuition manual says GADGIMAGE Flag should be set if GadgetRender 
 points to an Image structure.
Also, I use GADGIMMEDIATE|RELVERIFY for Activation.

>InitGadgets ()
>{
>  InvBoxPInfo.Flags = (AUTOKNOB | FREEVERT | PROPBORDERLESS); 
>  InvBoxPInfo.VertBody = 0x1000;         
>  InvBoxPInfo.HorizBody = 0xffff;       
>  AddGadget (win, &InvBoxGadget, -1L);   /* win is my window */
>  OnGadget (&InvBoxGadget, win, NULL);     
>}

I don't understand why you are not using NULL for HorizBody.  Your
  knob only moves vertically.

This may clear up the incomplete erasing.  The unwanted complementing
of the knob seems to be a built-in "feature" of AUTOKNOBs.  The only
way I know to stop it is to NOT use AUTOKNOB.  Supply your own
Image for the knob.  You may be able to get away with an Image with
NO ImageData like those commonly used for the color chip gadgets in
color palettes.  This would save you from having to make sure the
ImageData is in CHIP memory.  The Image structure for a color chip
type gadget often specifies only Width, Height, Depth, and PlaneOnOff.
The Width and Height describe the rectangle to be rendered, the 
PlaneOnOff describes which planes of that rectangle should be filled
with 1's.  I haven't figured out how Graphicraft gets props with bg
color in the container.  They use dummy (NULL-filled) Image structures
and their flags are GADGHCOMP|GADGIMAGE.

carolyn
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Carolyn Scheppner -- CBM   >>Amiga Technical Support<<
                     UUCP  ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn 
                     PHONE 215-431-9180
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=