Moving the Standard Buttons

Your method for moving _standard_ buttons is fine - if they are all that needs moving (eg. you forgot ID_HELP). But this is not much good if you've added your own controls to the property sheet and need to move them too. (for example, I have a couple of different groups of pages that I want to select between, rather than having lots and lots of tabs all at once, so I have a combo box at the bottom of my property sheet that selects the group of pages I want).

A better sort of solution is to go thru the child window list and move all children (except perhaps the tab control) Here is code that moves all the controls (other than the tab itself) by a given dx and dy..

     // calculate dx and dy to move the controls
     // this could correspond to an increase in sheet size
     CTabCtrl* pTabCtrl = GetTabControl();
     for (CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild =
			pChild->GetNextWindow(GW_HWNDNEXT)) 
     {
          if (pChild == pTabCtrl) continue;
          CRect rectControlWnd;
          pChild->GetWindowRect(rectControlWnd);
          ScreenToClient(rectControlWnd);
          rectControlWnd.top.OffsetRect(dx,dy);
          pChild->MoveWindow(rectControlWnd);
     }

Because I use this code in a CPropertySheet-derived class that I use to base my own property sheets on, I don't know in advance exactly what control are going to be on the sheet (because some of my other property sheet classes add extra controls). This way ALL my control move to make room.

Another improvement could be to compare the control position of the control to the tab control and only move those controls which are, say, below the tab.



Comments

  • Moving the Standard Buttons 2

    Posted by Legacy on 11/23/2001 12:00am

    Originally posted by: Andy Glenister

    how are dx and dy calculated?
    rectControlWnd.top.OffsetRect(dx, dy); does not compile

    I appear to be missing the meaningful code for this solution.

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: September 10, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild". This loop of continuous delivery and continuous feedback is …

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds