"Dynamic" Dialog Boxes - Programmer

This is a discussion on "Dynamic" Dialog Boxes - Programmer ; I am writing an application in MFC, but am rather new to it, and have a question. I want to create a modeless dialog box from which a user can execute several commands. There are three combo boxes from which ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: "Dynamic" Dialog Boxes

  1. "Dynamic" Dialog Boxes

    I am writing an application in MFC, but am rather new to it, and have a
    question.

    I want to create a modeless dialog box from which a user can execute several
    commands. There are three combo boxes from which he selects the precise
    action he wants implemented by the application. Depending on the values
    shown in the three combo boxes, the bottom half of the dialag box must
    change dynamically to allow the appropriate input, i.e. various edit boxes,
    static text controls, check boxes, etc must appear or disappear. They must
    change substantially, so graying them out by enabling/disabling them is not
    an option.

    Is there a slick way to do this? At first, I thought I could simply place
    all the controls on the dialog box in the Forms Designer and turn them on
    and off at will programatically, but there does not seem to be a way to do
    this. Is the only way to do this to programmatically create and destroy the
    control objects as the combo boxes are changed? That would mean forgetting
    about the forms designer which seems like a large pain.

    Thank you,
    Todd L. Peters
    peters@structuretechnology.com



  2. Re: "Dynamic" Dialog Boxes

    Todd L. Peters wrote:

    > I am writing an application in MFC, but am rather new to it, and have a
    > question.
    >
    > I want to create a modeless dialog box from which a user can execute several
    > commands. There are three combo boxes from which he selects the precise
    > action he wants implemented by the application. Depending on the values
    > shown in the three combo boxes, the bottom half of the dialag box must
    > change dynamically to allow the appropriate input, i.e. various edit boxes,
    > static text controls, check boxes, etc must appear or disappear. They must
    > change substantially, so graying them out by enabling/disabling them is not
    > an option.
    >
    > Is there a slick way to do this? At first, I thought I could simply place
    > all the controls on the dialog box in the Forms Designer and turn them on
    > and off at will programatically, but there does not seem to be a way to do
    > this. Is the only way to do this to programmatically create and destroy the
    > control objects as the combo boxes are changed? That would mean forgetting
    > about the forms designer which seems like a large pain.
    >
    > Thank you,
    > Todd L. Peters
    > peters@structuretechnology.com
    >
    >


    You need something just like what is used on tab controls. Create a
    dialog template for each 'bottom half' set of controls. Turn off the
    titlebar and border styles on these. Create a modeless dialog class for
    each of these. Initially create all the modeless dialogs invisiblly,
    and position them just right on your parent dialog. Then make one at a
    time visible at the appropriate clicks.

    The parent dialog will need WS_EX_CONTROLPARENT to make tabbing work right.

    --
    Scott McPhillips [VC++ MVP]


+ Reply to Thread