Link to home
Start Free TrialLog in
Avatar of hnc5013
hnc5013

asked on

Dynamic Dialog Box Creation

My application has a main window that occupies about a eighth of the screen.  This contains several Owner Drawn option buttons which trap a left double click.  Is there a way of creating a dialog box dynamically ( ie not based on a resource script ) when the button is double clicked.  The reason for this is that the number of controls that appear in the dialog box will vary.  If a dialog box can not be used, is it possible to create another window outside of the main window's client area ?
ASKER CERTIFIED SOLUTION
Avatar of duneram
duneram

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MostlyWater
MostlyWater

There is one problem to dunerams answer :
Editing the controls painted in the resource editor can be quite painful if the elements are on top of each other.
If you do not wish to do that, you will need the new TStatic() , Create() and ShowWindow() (possibly also MoveWindow() functions to place your dialog elements.
Mostlywater, true,  but the resource editor lets you associate controls with a dialog but you don't have to place them on the dialog.  For design, just make the dialog huge.  place all the controls in separate places.  When done with design, shrink the dialog to your desired size (or do that at run time too).
Avatar of hnc5013

ASKER

Thanks for your responses.  I created a blank Dialog and adjusted the size of this at runtime using SetWindowPos.  Instead of creating a number of controls and placing them outside of the dialog box I used a linked list to fill the dialog with a number of TGauges.  This works well however there are situations where it is not possible to display all the gauges in one dialog.  I have also trapped the EvPaint messages to enable the printing of text within the dialog.  

Could you tell me how to use a vertical scroll bar within a dialog box and which class to use ( TScroller, TScrollBar ) ?

Do I have to include the vertical scroll bar within the dialog resource script and hide it when the child controls fit within the dialog box or do I create a new scroll bar when required ?

Finally what messages should I trap and what functions do I need in order for the dialog contents to scroll ( do I adjust the positions of the gauges by altering the Y-Pos value which is decided by the position of the scroll bar thumb ) ?

Thanks again for your help !