how to make controls move after parent resize?

Hi all,
I've created a dialog based app, and I have put some controls
in it that I want to move or resize when I resize the dialog.
In the old days, on certain non-Windows machines this was done by
specifying that a control was attached to one or more edges
of the parent, and the GUI took care of changing the controls'
positions and sizes. But how is this done under Windows?
Is there an easy answer?
Thanks in advance
-V
0
Varf (6)
1/7/2004 5:46:08 AM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
838 Views

Similar Articles

[PageSpeed] 27

One solution is to handle WM_SIZE in your dialog. Then move/resize the
controls in OnSize.
Regards
Niraj

"Varf" <Varf@hoopomail.com> wrote in message
news:KvGdnSQVQ6aQAGaiRVn-jw@comcast.com...
> Hi all,
> I've created a dialog based app, and I have put some controls
> in it that I want to move or resize when I resize the dialog.
> In the old days, on certain non-Windows machines this was done by
> specifying that a control was attached to one or more edges
> of the parent, and the GUI took care of changing the controls'
> positions and sizes. But how is this done under Windows?
> Is there an easy answer?
> Thanks in advance
> -V


0
1/7/2004 6:13:40 AM
Apart from what Niraj has suggested, you can use the 
MoveWindow function for the each control in OnPaint() and 
position them relative to the client area of your dialog 
(to get the client area you can use GetClientRect). That 
way OnPaint() will move your controls automatically 
whenever your dialog is resized.

Also, you can disble resize. Problem solved ;-)


>-----Original Message-----
>Hi all,
>I've created a dialog based app, and I have put some 
controls
>in it that I want to move or resize when I resize the 
dialog.
>In the old days, on certain non-Windows machines this was 
done by
>specifying that a control was attached to one or more 
edges
>of the parent, and the GUI took care of changing the 
controls'
>positions and sizes. But how is this done under Windows?
>Is there an easy answer?
>Thanks in advance
>-V
>.
>
0
1/7/2004 9:31:52 AM
I don't agree to the idea of moving controls in OnPaint(). OnPaint() will be
called several times. This will slow down your app and also cause flicker
while painting.


"Varf" <Varf@hoopomail.com> wrote in message
news:KvGdnSQVQ6aQAGaiRVn-jw@comcast.com...
> Hi all,
> I've created a dialog based app, and I have put some controls
> in it that I want to move or resize when I resize the dialog.
> In the old days, on certain non-Windows machines this was done by
> specifying that a control was attached to one or more edges
> of the parent, and the GUI took care of changing the controls'
> positions and sizes. But how is this done under Windows?
> Is there an easy answer?
> Thanks in advance
> -V


0
1/7/2004 12:54:58 PM
Do NOT fiddle with controls in the OnPaint handler. This is precisely the wrong place to
do this. Do it in the OnSize handler. Note that OnSize can be called before any of the
controls are creatd, so you will have to do something like
	if(c_MyControl.GetSafeHwnd() != NULL)
                  {
                     ...resize c_MyControl here
                  }

				joe

On Wed, 7 Jan 2004 01:31:52 -0800, "Animesh Rawal" <animesh.rawal@patni.com> wrote:

>Apart from what Niraj has suggested, you can use the 
>MoveWindow function for the each control in OnPaint() and 
>position them relative to the client area of your dialog 
>(to get the client area you can use GetClientRect). That 
>way OnPaint() will move your controls automatically 
>whenever your dialog is resized.
>
>Also, you can disble resize. Problem solved ;-)
>
>
>>-----Original Message-----
>>Hi all,
>>I've created a dialog based app, and I have put some 
>controls
>>in it that I want to move or resize when I resize the 
>dialog.
>>In the old days, on certain non-Windows machines this was 
>done by
>>specifying that a control was attached to one or more 
>edges
>>of the parent, and the GUI took care of changing the 
>controls'
>>positions and sizes. But how is this done under Windows?
>>Is there an easy answer?
>>Thanks in advance
>>-V
>>.
>>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15973)
1/7/2004 5:35:25 PM
Not to mention all sorts of recursion as the resizing/repositioning causes WM_SIZE/WM_MOVE
messages to be sent to each control each time the paint handler is called!
					joe

On Wed, 7 Jan 2004 18:24:58 +0530, "Niraj" <niraj_bits@hotmail.com> wrote:

>I don't agree to the idea of moving controls in OnPaint(). OnPaint() will be
>called several times. This will slow down your app and also cause flicker
>while painting.
>
>
>"Varf" <Varf@hoopomail.com> wrote in message
>news:KvGdnSQVQ6aQAGaiRVn-jw@comcast.com...
>> Hi all,
>> I've created a dialog based app, and I have put some controls
>> in it that I want to move or resize when I resize the dialog.
>> In the old days, on certain non-Windows machines this was done by
>> specifying that a control was attached to one or more edges
>> of the parent, and the GUI took care of changing the controls'
>> positions and sizes. But how is this done under Windows?
>> Is there an easy answer?
>> Thanks in advance
>> -V
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15973)
1/7/2004 5:36:02 PM
Tip: take a look at http://www.codeproject.com/dialog/ResizableDialog.asp

/ Fred
"Varf" <Varf@hoopomail.com> wrote in message
news:KvGdnSQVQ6aQAGaiRVn-jw@comcast.com...
> Hi all,
> I've created a dialog based app, and I have put some controls
> in it that I want to move or resize when I resize the dialog.
> In the old days, on certain non-Windows machines this was done by
> specifying that a control was attached to one or more edges
> of the parent, and the GUI took care of changing the controls'
> positions and sizes. But how is this done under Windows?
> Is there an easy answer?
> Thanks in advance
> -V


0
fake3845 (77)
1/7/2004 8:44:30 PM
Reply:

Similar Artilces:

Make Default
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel Email Client: Exchange Hi I have a script to open entourage to configure a account, although the first time round for every user the script stops due to the message in Entourage asking would you like to make entourage you default browser. <br> Anyone have a script to set this to default or any way of setting this so it never ask's ? <br><br>thanks This is a multi-part message in MIME format. ----------------709806166701805979 Content-Type: text/plain; charset=iso-8859-1; format=flowed C...

Making a Pivot chart from 3 differnt sets of data / worksheets.
Hi, I have 2 workshsheets of data with a list of delivery dates of about 10 different products over the last 3 years, (i cant combine these to just 1 worksheet for other separate reasons) and a 3rd worksheet with a column of the same products and dates that some of these products became faulty and were sent back to me . On a 4th worksheet, I am trying to do a graph that looks at the 3 worksheets and plots pivot table of dates and amount of each product deliveries & returned to me. So as i select ,say, product A from that pivot list, it produces a graph for these 3 variables (dat...

making a transfer show up in the budget
Hi all. I am running MS money 2006. How do I make a transfer show up in my budget? I have several liabilities and credit cards, and I would like to make a budget with the monthly amount owed to each creditor showing up in my budget. The MS Money 2006 standard program does not allow me, as far as I can tell, to make a monthly transfer to a credit card or liability show up in my budget, unless I make it a category. Any help with this is much appreciated. thanks See http://umpmfaq.info/faqdb.php?q=124 for the short answer. You may be more interested in "cash flow" than &qu...

how to get position of cursor in EDIT control??
How does one get the position of the cursor in an edit control? I am not talking about the mouse cursor and that is what GetCaretPos() and GetCursorPos() do. I am talking about the blinking vertical line. There doesn't seem to be any way to get it?? I want to be able to get it in client or screen coordinates. Thanks! "Nobody" <nobody@cox.net> wrote in message news:dpbwb.10587$Bk1.14@fed1read05... > How does one get the position of the cursor in an edit control? I am not > talking about the mouse cursor and that is what GetCaretPos() and > GetCursorPos() do. I am...

making tickets
what is the best way to make numbered tickets using Publisher 2002? Hi lc (rconnell@numail.org), in the Microsoft Office Publisher newsgroup you posted: || what is the best way to make numbered tickets using || Publisher 2002? Check out the following link: http://www.mvps.org/publisher/numbering1.html -- Brian Kvalheim Microsoft Office Publisher MVP Official Publisher MVP Site: http://www.kvalheim.org This posting is provided "AS IS" with no warranties, and confers no rights. >-----Original Message----- >what is the best way to make numbered tickets using >Publi...

How make a favorite for all users in Ex2007/OWA/Documents area?
I am playing around with OWA in 2007 and exploring the "documents" feature of OWA that allows users to view Windows file shares by UNC. There is the individual "add to favories" option, but does anyone know of a way to administratively specify a favorite for all users? The alternative seems to be logon as each user to setup the same favorite--surely that is not the only way? Thanks for any help! Evan ...

microsoft flat scrollbar control version 6.0
Hi, I have dynamically created the microsoft flat scrollbar control on my modal dialog: o_ScrollBar.Create("",WS_VISIBLE|WS_CHILD,CRect(1004,62,1542,80),this, 1004,0,FALSE); o_ScrollBar.SetOrientation(0); // Set vertical It is created and visable but the event OnScroll() belonging to this control is never fired if i move the scrollbox around. I created a second MS flat scrollbar via resource workshop and added the classes and meber to my project. This second control does fire the OnScroll() event. Why does the dynamically created scrollbar not fire the OnScroll() event ???? N...

AN OPPORTUNITY TO MAKE $$$
THIS REALLY WORKS IF YOU FOLLOW THROUGH!!! MAKE MONEY!!! MAKE MONEY!!! MAKE THOUSANDS OF "$$$" !!! I found this "NETWORKING PROJECT" on a bulletin board and decided to try it: All I say is, it "WORKS". All it takes is a small INVESTMENT of your "TIME" AND "less than $10.00"! INTERESTED??? E-mail: "spotty3443@yahoo.com" for DETAILS. ...

Publisher 2000 page control bar has disappeared
Apologies if this is a duplicate post. Re: Microsoft Publisher 2000: When I opened an 18-page document that I'd been working on for days, the page control bar was missing. I opened several other multiple-page documents and there was no page control bar on them either. I rebooted and tried again with the same results. I can get from page to page using the View menu, but that's tedious. How can I restore my page controls? On Wed, 22 Feb 2006 19:19:28 +0000, j3hop wrote (in article <05A78478-7371-4593-9DA8-E9873DDF5C65@microsoft.com>): > Apologies if this is a duplicate ...

Move exchange 2003 to new hardware
I have exchange 2003 ent on windows 2000 machine , i would like to move to another machine with windows 2003 as OS. Can anyone help !!!!!!!! Tushar - Install new server in the Exchange Org - this will be installed in the same Administrative Group by default. - Move mailboxes, replicate public folders - Follow http://support.microsoft.com/default.aspx?scid=kb;en-us;822931 - Shut down Exchange services on old server for a couple of days - If all looks good, uninstall Exchange from the old server -- Bharat Suneja MCSE, MCT www.zenprise.com blog: www.suneja.com/blog ----------------------...

A question regarding use of the Test Container to check ActiveX controls
Hello. Apologies for the novice question here. I'm using VC++6.0sp4. I've written a tiny ActiveX control that seemingly works just fine in a container my company has written that displays graphical information. When I try my control, which simply puts up a circle/ellipse at an X,Y location within the frame of the control in the test container, if i change current x,y properies (which change where a point is drawn on the screen) it works. if i script changes to the x,y location for the current x,y properties within a loop, i only see the last x,y position drawn. I can slow the loop d...

Bar Graph on Form (rectangle control code)
http://msdn.microsoft.com/en-us/library/dd758785.aspx This website gives a good description of how to use a small amount of coding to have a rectangle controlled by a field value on a report appear as a bar graph when you print preview. I would like to do something very similar, show a bar graph within a form based on a field's percentage (between 0 and 1). In the example they put the code into the OnFormat event property. I would like my bar graphs to appear upon opening the form. Hope that I can use very similar code as in the example but what would I put it in... OnLoad...

Moving a template from XP to Win 7
I've used Excel 2003 on my XP computer for a number of years. In the course of time, I created several macros with associated buttons, to perform certain formatting options I regularly use. These are saved in a .XLT template. I'm in the process of moving to a brand new Windows & Home Premium 64 bit computer. I reinstalled Office 2003. I copied all my data files, including my Excel worksheet files to the new computer in the Documents Library using =93Windows Easy Transfer.=94 Now here=92s where it gets curious. When I open a file in Excel on the new computer, all my...

How do I make the X-Axis increase in scale with the quantity?
For example: If I have the values 1.5, 3.5, 8.7, 9.9 in the x values for a line graph, is there anyway to make them spaced apart so that they are in scale with eachother... Like so the distance between 3.5 and 8.7 is larger than, the distance between 1.5 and 3.5? Create a XY Scatter chart. It, and a bubble chart, are the only 2 that allow for cardinals values on the x axis. -- Regards, Tushar Mehta www.tushar-mehta.com Excel, PowerPoint, and VBA add-ins, tutorials Custom MS Office productivity solutions In article <F2D3DC58-86D3-4D21-9D57-F704A78941FB@microsoft.com>, =?Utf- 8...

how do you make all incoming emails bold?
"Beth" <Beth@discussions.microsoft.com> wrote in message news:CD76AE42-9EC9-44C8-90FB-3A0566671AC4@microsoft.com... > I could've sworn there was a message here, but when I looked the body was completely blank. Oh well, guess the poster really didn't want to ask a question. how do you make all incoming emails bold? "Vanguard (NPI)" wrote: > "Beth" <Beth@discussions.microsoft.com> wrote in message > news:CD76AE42-9EC9-44C8-90FB-3A0566671AC4@microsoft.com... > > > > > I could've sworn there was a messag...

Moving Row data to sheet
I have an Excel problem and I was wandering if anyone could give m their 2 Cents worth. Let me explain. I will have 2 worksheets Lets say A and B. In Workshee A I have rows and rows of data. In worksheet B I want to create a for (not excels form one written in the spreadsheet itself no VB) that wil contain info from each row singly only. Like for example.... Sheet A : Row 1 Name, Phone, Address Row 2 Name, Phone, Address Sheet B: From highlighted row 1 Name Address What I would like is each time you click a row the info changes i sheet B. I know this is done in Access very easily with...

Controls in forms
How do I add a control button that will open another form in "add" mode rather than edit? On Thu, 7 Jan 2010 10:00:22 -0800, Bill wrote: > How do I add a control button that will open another form in "add" mode > rather than edit? Set the Click event of the command button to: DoCmd.OpenForm "FormName", , , , acFormAdd -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail All it did was come up with a message that it couldn't find the object 'DoCmd' "fredg" wrote: > On Thu, 7 Jan ...

How to make VLOOKUP work for this
I have a "master" spreadsheet where column A is a time column and every row represents a second (in plain text format) such as 00:00, 00:01, 00:02.... 00:59:, 01:00, 01:01, 01:02,... and continues on for 24 minutes... 23:59, 24:00. (1442 rows). Off to the side (I'm thinking of putting it on another sheet though) I have a small table where I'll enter the time and corresponding data I need populated in Column B, and will look something like the following example; My question(s) are, is the VLOOKUP function the best way to populate column B with the values? It's ...

Make Personal Calendar Read Only
I would like to make a users personal calendar read-only to the user. The individuals calendar is delegated to about 5 others and they need full access, but I do not want the end-user to have full access but read only. How do I go about changing these permissions? Thanks, Brian I don't believe that is even possible through the standard means, it is a little bizarre. You may be able to do it through a tool like ADSIEdit. Nue "HoosierDaddy" <bjorgenson@charter.net> wrote in message news:1139250053.396235.106790@o13g2000cwo.googlegroups.com... >I would like to make a...

resizing text
How do I resize grouped (some on top of other letters) text so that it stays connected and in scale? -- geauga All of the text has to be formatted to fit - and inevitably something is missed. It's easier to (1) start out with the project being the size that you want it in the end or (2) convert it to a .pdf and then use Adobe Reader's print dialog box to print multiple copies per sheet if that's what you need. -- JoAnn Paules MVP Microsoft [Publisher] "geauga" <geauga@discussions.microsoft.com> wrote in message news:959491E5-3EE3-457B-9FD8-E0D0DB61AB0D...

No control buttons on title bar (no minimize, restore or close)
A friend asked me to take a look at a workbook he has. When it opens, it cannot be resized, it does not have any control buttons (minimize, maximize or restore, and close) and does not have the other control menu on the left. It only has the filename of the workbook displayed completely flush left within the titlebar Has anyone got any ideas? I've read through a million posts and can find nothing. P.S. It does the same no matter where it is opened, and it's not in full screen view and it's not the problem mentioned in other posts involving Novell Groupware Many thanks if you...

How do I make more than 12 entries in excel balance sheet templat.
The excel balance sheet template is exactly what I need. How do I get it to expand to an infinite number of entries?? office xp ...

Is it Possible to make a table from a query without a Make Table Q
Is it possible to make a table with a query as the record source, without using a Make Table Query. The reason that I as is that I have a rather large database that I use to create tables for each day of the month based on activity recieved from a larger database. I use one Pass-Through query as the source for 31 Make Table queries. The reason I have done this is because I need to segregate the activity by date so that I can produce daily averages over the entire month. The reason that I have had to break each one per day is the Pass Through query is huge (returning 7,000,000 + rec...

Making a bmp transparent
Using Publisher 2000 Windows 98SE Is it possible to make a graphic file transparent? I'm attempting to create a motivational cartoon and would like to have a couple of scenes in the background. To do this I think I need to make an image file transparent. Can it be done? I have Paint Shop Pro and MS Paint. I have the challenge in the file, "Problem.zip" which can be downloaded at: http://www.tinyurl.com/wifs On the "Odds, Ends & Funny Things page. Click on the Snowman. 'Appreciate the help. -- Don -------- Vancouver, USA - One of the great cities in one of...

how to return VARIANT_BOOL value from an MFC control
Hi, I wrote a function inside my activex control that is supposed to return VARIANT_TRUE or VARIANT_FALSE, here is the code VARIANT_BOOL CMPSeControlCtrl::GetSessionRunning(void) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); // TODO: Add your dispatch handler code here if(m_pStateEventMachine == NULL) return VARIANT_FALSE; if(m_pStateEventMachine->IsRunning() == TRUE) return VARIANT_TRUE; else return VARIANT_FALSE; } the function itself returns everything ok, but when the call dispatcher converts data, it always converts everything to BOOL TRUE. In function CCmdTarget::Ca...