dedreb@arco.com (Richard Beecher) (05/10/91)
I have received a few replies to my MoveControl Problems article, so I thought
I would post a summary.
Basically, when a control is moved in a dialog box, the Dialog manager needs to
know where its new item rectangle is. This is easily accomplished with a call
to SetDItem. Simple, yes, but this drove me crazy for a while (see my original
posting--MoveControl Problem #2). So, here's what I now do in my page preview
routine:
/****************** DoPreview ********************/
void DoPreview()
{
DialogPtr dialog;
ControlHandle printCntl, cancelCntl;
etc...
.
Set up dialog box, etc.
.
GetDItem( dialog, PREV_PRINT_ITEM, &itemType, &printCntl, &itemRect );
GetDItem( dialog, PREV_CANCEL_ITEM, &itemType, &cancelCntl, &itemRect );
...calculate button locations based on the size of the screen...
MoveControl( cancelCntl, h, v );
MoveControl( printCntl, h+h1+margin, v );
HLock( cancelCntl );
HLock( printCntl );
SetDItem( dialog, PREV_PRINT_ITEM, itemType, printCntl,
&((**printCntl).contrlRect) );
SetDItem( dialog, PREV_CANCEL_ITEM, itemType, cancelCntl,
&((**cancelCntl).contrlRect) );
HUnlock( cancelCntl );
HUnlock( printCntl );
.
.
Do ModalDialog(), etc. stuff, then exit
.
}
Works like a charm!!! Thanks a bunch for the help! :-)
------------------------------------------------
Richard Beecher: dedreb@arco.com
------------------------------------------------