Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

dynamically resize dialogs

Brooks_Van_Horn
New Contributor I
336 Views

I have an application that has a dialog as the main window control. But when it goes from full screen to 'Restore Down' I can resize my graphics but how do I scale down the dialog?  I don't know how to add a scrollbar to just the dialog and I have no idea how to scale the dialog. Any ideas would be greatly appreciated.

Thanks,
Brooks Van Horn

0 Kudos
4 Replies
andrew_4619
Honored Contributor II
336 Views

In the resource editor the properties for the dialog include Horizontal and Vertical scroll bars which need to be set to TRUE. These bars appear when the stuff doesn't fit in the dialog. 

You would be better having the dialog floating so the user can position or minimise it independent to the graphics, That way size is not important it can be the size it needs to be to read it and use the controls...

 

 

0 Kudos
Brooks_Van_Horn
New Contributor I
336 Views

Andrew,

OK the scroll bars show up and I can move them but nothing happens. Even if I intercept the message in the message loop in WinMainProc, how do I tell the other controls that the main dialog has moved?

Brooks

0 Kudos
IanH
Honored Contributor II
336 Views

The Windows dialog manager doesn't provide a great deal of support for resizeable dialogs - you are going to have to do a fair bit of coding yourself.

If the controls are children of the window with the scrollbar, then as you receive scroll bar messages then you need to manually change the position of each control accordingly.

This can be a bit of a nuisance, so an alternative approach is to have the dialog as a separate child window of your main window (so the controls are grandchildren of the main window).  As the scrollbar of the main window is moved, you then slide the entire child dialog window up and down.

A further extension of having the dialog as a separate child window is the possibility of the dialog then being "undockable" (it becomes a child of the desktop - just like any other modeless dialog).  Docking logic is non-trivial to implement outside of an existing framework, however.

In some cases, it makes sense to vary the size of individual controls on the dialog as the size of the dialog changes (see for example the "modern" resizeable File Open dialog, contrasted with the Windows NT variant).  As far as I am aware, the native dialog template resource format does not offer any support for this (control positions are always relative to the top left of the window, sizes are always fixed - but what you want is to be able to say something like "the bottom ordinate of this control is a certain distance from the bottom of the dialog" or similar flexible layout), so you need to explicitly code control behaviour (or code up an alternative to the current dialog template resource).
 

0 Kudos
Reply