Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!helios!inetg1!news From: dedreb@arco.com (Richard Beecher) Newsgroups: comp.sys.mac.programmer Subject: MoveControl Problems ** Summary ** Message-ID: <1991May10.150200.13220@Arco.COM> Date: 10 May 91 15:02:00 GMT References: <1991Apr26.202450.21200@Arco.COM> <1991May7.205425.5339@Arco.COM> Sender: news@Arco.COM Organization: Arco Alaska Lines: 46 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 ------------------------------------------------