Thread: Splitting a dialog up into multiple classes

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    28

    Splitting a dialog up into multiple classes

    Hello,

    I'm in the design phases of an MFC GUI, and I'd really appreciate some help here...

    This GUI is going to contain one dialog that is rather large - it'll contain dozens of controls (listboxes, comboboxes, textboxes, buttons, etc) on it. Now normally I make one dialog its own class, but because this dialog is so big, I'd like to be able to partition it up into a number of classes.

    Any tips on how I can do this? As an example, the dialog will contain about 8 textboxes that are logically grouped together on the dialog, and would ideally be in a class by themselves (say, TextboxDisplay). But then, how do I instatiate this class? Should it take 8 edit controls as arguments to its constructor, and the parent dialog class just passes in the 8 textboxes as arguments? Or is there a way to make TextboxDisplay responsible itself for creating the textboxes? What about the message map and the DoDataExchange() method? Can I somehow put these in TextBoxDisplay, or do they have to go in the parent class that actually represents the dialog?

    It seems really hard to go OO with MFC, but I'm certainly trying, and I'd really appreciate any help.

    Thanks a bunch,
    Just
    "C++ is like jamming a helicopter inside a Miata and expecting some sort of improvement."
    - Drew Olbrich

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    28
    I think I have the answer. TextboxDisplay will also be a CDialog (it will inherit from CDialog), and it will be embedded in the parent dialog. This means the message map, DoDataExchange(), etc will be able to live in TextboxDisplay. Thanks anyway, to all 4 of you who read my message.
    "C++ is like jamming a helicopter inside a Miata and expecting some sort of improvement."
    - Drew Olbrich

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Parent of a BrowseForFolder dialog box
    By @nthony in forum Windows Programming
    Replies: 4
    Last Post: 01-08-2007, 02:54 PM
  2. dialog box problem keeps haunting me
    By Bleech in forum Windows Programming
    Replies: 2
    Last Post: 08-23-2006, 01:12 AM
  3. how to set this dialog to this
    By stallion in forum Windows Programming
    Replies: 3
    Last Post: 01-31-2003, 05:19 PM
  4. edit control in dialog box problems
    By Bajanine in forum Windows Programming
    Replies: 11
    Last Post: 11-11-2002, 06:55 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM