@mtraversoNOSPAM: "Hi,
I have a modeless dialog that shows some editable properties of various
types of objects.
When the user selects an object (in another window) this dialog must update
showing the object's properties (in static text and edit text fields).
For example, object1 has 10 properties, so when the object1 is selected the
dialog must show 10 static texts and 10 edit text.
I know I can update the dialog controls created in the OnInitDialog
function, but since the number of properties is arbitrary, I think I need to
re-create the controls.
What is the right way to implement this, without closing and re-creating the
dialog?
I hope my question is clear...
Thank you in advance,
Marco"
    @scottmcp: "<quote>
One way is to have a separate dialog template for each type of object 
and display it on top of the main dialog.  For example, this is the way 
tabbed dialogs display a different set of controls for each tab.  You 
create a modeless dialog (with no border and no titlebar) for each 
template.  You make only one of these modeless dialogs visible at a time.
If you really want to use just one common template you could consider 
the simple expedient of putting the max number of controls on it, then 
making the unneeded ones invisible each time the selection changes.
Re-creating the controls is the hardest (most work) approach, but it can 
be done.  To delete a control call its DestroyWindow.  To create a 
control call its Create function.  (Some of them look better if you use 
CreateWindowEx instead.)
Scott McPhillips [VC++ MVP]"
    @mtraversoNOSPAM: "Hi Scott,
Thank you very musch for the reply.
<quote>
I cannot create a template for each object, because some objects have a
virtually non-limited number of properties (I cannot define a max number of
controls...), so I would go the second way.
Before I create all the code, I would like to know if the DetroyWindow
followed by the Create will make disappear the modeless dialog and then
reappear it, or if the changes to the controls are made "smoothly". I had
tried a similar way, by hiding the dialog, deleting it and then recreating
it, but it generated an unwanted "flash"... Is it possible?
Thank you again,
Marco
"Scott McPhillips [MVP]" <email_address> ha scritto nel
messaggio news:<email_address>
update
the
need to
the"
    @scottmcp: "<quote>
If you call a control's DestroyWindow only the control will disappear. 
There would be no need to hide or destroy the dialog.  I think it will 
be smooth, but you could try an experiment to see.
You might have the wrong approach to your GUI, though, if some objects 
have a virtually unlimited number of properties.  You should at least 
consider an extensible GUI approach like a grid, such as you see in 
Excel and Access.  Such grids are vastly more efficient in resource 
usage than creating 100's of controls.  And of course they scroll nicely 
if screen space is inadequate.
Scott McPhillips [VC++ MVP]"
    @mtraversoNOSPAM: "Hi Scott,
<quote>
OK, so I'll go this way...
I'll consider this alternative. I'm also thinking about a scrollbar that
automatically shows up when there is not enough space to show all the
controls.
Thank you very much again for the help!
Marco"
{'source': 'USENET', 'other_information': '{"reply_count": 4, "forum_name": "microsoft.public.vc.mfc.docview.20140124.mbox"}', 'file': 'data/output/usenet-microsoft.public.parquet'}