dedreb@arco.com (Richard Beecher) (05/08/91)
I have yet to receive any replies to my MoveControl... post, so I am reposting to the world. Sorry for the length of this article. Anyway, here is my original article: >I am trying to implement a Page PreviewI feature in my program using a dialog >window that expands to full size of the user's main screen. Because the dialog >size varies, I need to reposition the control buttons before I make the dialog >visible. > >Here's what happens...the dialog box and the controls appear on the screen, and >everything LOOKS great. However, the dialog doesn't seem to recognize mouse >clicks in any of the control buttons. If I don't move the controls, it works >like a charm. Also, locking down the button ControlHandles doesn't fix the >problem. I have also tried HideControl, MoveControl, then ShowControl without >any luck. Actually, I have tried a lot of things (including talking to the >monitor...even that doesn't seem to help!). > >What am I doing wrong here? I realize I could just create the controls (and >the dialog window itself) myself without using DLOG resources, but I'd rather >not. Here's some abbreviated code... > >/****************** DoPreview ********************/ > >void DoPreview() >{ > DialogPtr dialog; > ControlHandle printCntl, cancelCntl; > . > etc. > . > GetPort( &curPort ); > > /* Create the page preview dialog window */ > > dialog = GetNewDialog( PREVIEW_DLOG_ID, (Ptr) 0, (WindowPtr) -1 ); > wh = screenBits.bounds.right - screenBits.bounds.left; > menuHeight = GetMBarHeight(); > wv = screenBits.bounds.bottom - screenBits.bounds.top - menuHeight; > SizeWindow( dialog, wh, wv, NORMAL_UPDATES ); > MoveWindow( dialog, 0, menuHeight, FALSE ); > > /* Position the control buttons on the preview page */ > /* Leave "margin" pixels between the controls and the page bottom */ > > 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 ); > > finished = FALSE; > do > { > ModalDialog( NULL, &itemNo ); > switch( itemNo ) > { > yeah, right, do whatever > } > } while ( !finished ); > > DisposDialog( dialog ); > SetPort( curPort ); >} > > >Any ideas? Is so, please reply via the net or email to dedreb@arco.com. >Thanks in advance. > >------------------------------------------------ > Richard Beecher: dedreb@arco.com >------------------------------------------------ >