Re: Creating controls of modeless dialog in runtime
From: Scott McPhillips [MVP] (scottmcp_at_mvps.org.nothere)
Date: 05/20/04
- Next message: Marco: "Re: Creating controls of modeless dialog in runtime"
- Previous message: Marco: "Creating controls of modeless dialog in runtime"
- In reply to: Marco: "Creating controls of modeless dialog in runtime"
- Next in thread: Marco: "Re: Creating controls of modeless dialog in runtime"
- Reply: Marco: "Re: Creating controls of modeless dialog in runtime"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 20 May 2004 08:26:39 -0500
Marco wrote:
> 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
>
>
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]
- Next message: Marco: "Re: Creating controls of modeless dialog in runtime"
- Previous message: Marco: "Creating controls of modeless dialog in runtime"
- In reply to: Marco: "Creating controls of modeless dialog in runtime"
- Next in thread: Marco: "Re: Creating controls of modeless dialog in runtime"
- Reply: Marco: "Re: Creating controls of modeless dialog in runtime"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|