You are here:

C++/Moving buttons on a shortened dialog box...

Advertisement


Question
Hi Bill,

Let me start by thanking you for your help with GetWindowPlacement, etc. All I need is to add a little math to go with the code you gave me and all will be well!

I have a problem with the potential shortening of the dialog box (which matches the user using less edit boxes). I have 3 buttons at the base of the dialog box that will have to be moved up accordingly when the dialog box is shortened. Would you return an example of some code plus the theory behind doing this?

Thank you in advance for all your help with my project,
-Neil

Answer
Unfortunately MFC doesn't handle resizing while automatically moving or changing the size of controls on the parent.  I used tools that did, simply by setting "resize" properties for each control, and the runtime took care of this.  I didn't realize how much was being done for me until I used MFC.  It is a pain to do this.  I bet CodeProject.com or CodeGuru.com has a class derived from CWnd that adds window control resizing and moving.

What you want to do is just like the previous method but indtead of adjusting the height by changing 'bottom' you change 'top' to move the control up or down.

Bill

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Bill A

Expertise

I can answer questions about C++, programming algorithms, Windows programming in MFC (which is C++). I cannot answer questions about STL (templates) and I have no experience with Linux. I do enjoy reviewing code and critiquing it or finding problems in it. I will also gladly show better algorithms or methods if you want to take advantage of that.

Experience

I've developed a commercial embedded C compiler/assembler and IDE with debugger toolset, of which the IDE and debugger are written in C++. I work in the industry writing high tech embedded programs and Windows programs to communicate with the embedded devices.

Publications
Book: Embedded Systems Design using the Rabbit 3000 Microprocessor Authored Chapter 10 in its entirety.

Education/Credentials
BS Computer Engineering

©2016 About.com. All rights reserved.