[comp.sys.amiga] Gadgets in Title Bar

news@csd4.milw.wisc.edu (Net news owner) (03/12/89)

my window title bars.  First problem is although my gadget gets tucked
into the window border, when I click on it, the drag bar gets activated.
From: trantow@csd4.milw.wisc.edu (Jerry J Trantow)
Path: csd4.milw.wisc.edu!trantow

The second problem is that although I ModifyIDCMP() so I only get NEWSIZE
messages when the user manipulates the sizing gadget, I am still getting 
messages when I 
move or resize the window for the SHRINK or EXPAND.

I appreciate any help.  Maybe this "gadget in title bar" could go into the
intro posting for comp.sys.amiga.tech if an appropriate responce is put forth.

Sorry about the line noise.
I thought it was finally time to add Shrink and Expand Window gadgets to
some of my programs and I thought I had it all figured out.  I thought I
could do Move() and SizeWindows() when the gadgets were selected.  I also
want to keep the original dimensions so the user can toggle back and forth
from max, min, to original window settings.  I figured I could keep track
of the SHRINK, EXPAND status with a flag and whenever the user resized the
window I would get a NEWSIZE message that would clear the SHRINK or EXPAND
flags.   My problem is that even though I do a ModifyIDCMP() to turn off 
the NEWSIZE message when I resize for a SHRINK or EXPAND I still am getting
NEWSIZE messages!!!  DO I HAVE TO WAIT or GET a MESSAGE or WHAT???

On the same problem, the following declarations put my gadget in the window
border, but when I click the gadget it selects the drag bar.  I know this 
question pops up every so often.  ( how to put gadgets in the title bar)
Maybe an appropriate responce could go into the intro posting.

struct Gadget ExpandGadget =
{ (struct Gadget *)NULL,		/* NextGadget	*/
  100,0,10,10,				/* dimensions	*/
  (USHORT)GADGIMAGE|GADGHCOMP,		/* Flags	*/
  (USHORT)GADGIMMEDIATE|RELVERIFY|TOPBORDER,	/* Activation	*/
  (USHORT)BOOLGADGET,			/* GadgetType	*/
  (APTR)&g_image,			/* GadgetRender */
  (APTR)NULL,				/* SelectRender */
  (struct IntuiText *)NULL,	/* GadgetText	*/
  0L,					/* MutualExclude*/
  (APTR)NULL,				/* SpecialInfo	*/
  (USHORT)EXPANDGAD,			/* GadgetID	*/
  (APTR)NULL				/* UserData	*/
};

struct NewWindow NewProjectWindow=
{ 10,20,400,75,
  (UBYTE)-1,(UBYTE)-1,
  (ULONG)0,			/* attach the port to BackDrop Window */
  (ULONG)REPORTMOUSE|WINDOWSIZING|WINDOWDEPTH|WINDOWCLOSE|WINDOWDRAG|SIMPLE_REFRESH,
  (struct Gadget *)&ExpandGadget,	/* First Gadget	*/
  (struct Image *)NULL,
  (UBYTE *)"Project Window",
  NULL,NULL,
  200,50,640,195,
  CUSTOMSCREEN
};


   case EXPANDGAD:
     ModifyIDCMP(WPtr,(LONG)WPtr->IDCMPFlags&(~NEWSIZE));
     if ((NodePtr->Flags & EXPAND)!=0)	/* already Expanded, so restore */
     {
       NodePtr->Flags=NodePtr->Flags&(~EXPAND&~SHRINK);
       SizeWindow(WPtr,(LONG)NodePtr->Width-WPtr->Width,(LONG)NodePtr->Height-WPtr->Height);
       MoveWindow(WPtr,(LONG)NodePtr->LeftEdge-WPtr->LeftEdge,(LONG)NodePtr->TopEdge-WPtr->TopEdge);
     }
     else
     {
       NodePtr->Flags=NodePtr->Flags|EXPAND;
       NodePtr->Flags=NodePtr->Flags&(~SHRINK);
       MoveWindow(WPtr,(LONG)-WPtr->LeftEdge,(LONG)WPtr->BorderTop-WPtr->TopEdge);
       SizeWindow(WPtr,(LONG)WPtr->MaxWidth-WPtr->Width,(LONG)WPtr->MaxHeight-WPtr->BorderTop-WPtr->Height);
     }
     ModifyIDCMP(WPtr,(LONG)WPtr->IDCMPFlags|NEWSIZE);
     break;