[comp.sys.mac.programmer] Moving Push Buttons In a Dialog

gslee@media-lab.MEDIA.MIT.EDU (Gene Lee) (02/27/91)

	How can one successfully move a push button or any other
control within a dialog box.  When I called MoveControl and SetDItem
to move my button, it seemed to work, but ModalDialog doesn't seem to
recognize them.  Does anyone know what I did wrong?

	Inside Mac suggests that I don't call SetDItem, but when I
don't call it the control's rectangle doesn't change.

	Any example code would be very helpfull.

Thanks.

-G. Lee

gslee@media-lab.media.mit.edu
 

han@Apple.COM (Byron Han) (03/12/91)

In article <5373@media-lab.MEDIA.MIT.EDU> gslee@media-lab.MEDIA.MIT.EDU (Gene Lee) writes:
>	How can one successfully move a push button or any other
>control within a dialog box.  When I called MoveControl and SetDItem
>to move my button, it seemed to work, but ModalDialog doesn't seem to
>recognize them.  Does anyone know what I did wrong?
>
>	Inside Mac suggests that I don't call SetDItem, but when I
>don't call it the control's rectangle doesn't change.
>
This seems to work.

GetDItem(pDialog, itemNo, &itemType, &itemHandle, &itemRect);
OffsetRect(&itemRect, dH, dV);
SetDItem(pDialog, itemNo, itemType, itemHandle, &itemRect);
MoveControl( (ControlHandle)itemHandle, itemRect.left, itemRect.top);
-- 
Byron Han, CommToolbox Emir       Changing the world, one connection at a time
Apple Computer, Inc.              --------------------------------------------
20525 Mariani Ave, MS: 35CP       Internet: han@apple.COM
Cupertino, CA 95014               UUCP:{sun,voder,nsc,decwrl}!apple!han
ATTnet: 408-974-6450              Applelink:HAN1   HAN1@applelink.apple.COM