CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 3 123 LastLast
Results 1 to 15 of 33
  1. #1
    Join Date
    Jun 2004
    Posts
    1,352

    Function to Draw Controls from a different dialog box template

    I have a section in a FormView in which I draw different groups of controls depending on the situation. I have to programaticlly adjust each control

    I was thinking of leveraging the resource graphical editor to position the controls.

    I need a function that would take a dialog template file and just draw the controls. I will add the programing code manually.

    Any suggestions?
    Rate this post if it helped you.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Function to Draw Controls from a different dialog box template

    How many different groups of controls do you have?

  3. #3
    Join Date
    Jun 2004
    Posts
    1,352

    Re: Function to Draw Controls from a different dialog box template

    Around four.
    Rate this post if it helped you.

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Function to Draw Controls from a different dialog box template

    Use a property sheet control set to wizard mode.

    Set the property sheet to a child style and make it a child of your dialog. Create a CPropertyPage for each group of controls, when you need to change groups, just set the active page in the property sheet.

    The advantage with this approach is you can use the dialog editor to lay out the groups of controls.

  5. #5
    Join Date
    Jun 2004
    Posts
    1,352

    Re: Function to Draw Controls from a different dialog box template

    Quote Originally Posted by Arjay View Post
    Use a property sheet control set to wizard mode.

    Set the property sheet to a child style and make it a child of your dialog. Create a CPropertyPage for each group of controls, when you need to change groups, just set the active page in the property sheet.

    The advantage with this approach is you can use the dialog editor to lay out the groups of controls.

    Don't I want to use a TabCtrl??
    Rate this post if it helped you.

  6. #6
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Function to Draw Controls from a different dialog box template

    Quote Originally Posted by ADSOFT View Post
    Don't I want to use a TabCtrl??
    If you want to do it the hard way, then sure.

  7. #7
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Function to Draw Controls from a different dialog box template

    Quote Originally Posted by ADSOFT View Post
    Don't I want to use a TabCtrl??
    You know better what you want.

    Well, for the actual problem, the Arjay's solution is better...
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  8. #8
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Function to Draw Controls from a different dialog box template

    Btw, are you using MFC?

  9. #9
    Join Date
    Jun 2004
    Posts
    1,352

    Re: Function to Draw Controls from a different dialog box template

    Yep I'm using MFC.

    btw, do you have an example of what you are talking about. I couldn't find anything on property sheet wizards ..... etc.
    Rate this post if it helped you.

  10. #10
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Function to Draw Controls from a different dialog box template

    Quote Originally Posted by ADSOFT View Post
    Yep I'm using MFC.

    btw, do you have an example of what you are talking about. I couldn't find anything on property sheet wizards ..... etc.
    Help me understand here - I'm confused that you can't find anything. What search terms are you trying in google and msdn?

  11. #11
    Join Date
    Jun 2004
    Posts
    1,352

    Re: Function to Draw Controls from a different dialog box template

    Quote Originally Posted by Arjay View Post
    Help me understand here - I'm confused that you can't find anything. What search terms are you trying in google and msdn?
    Ok I have the following:

    Code:
    	::CPropertySheet nameSheet( "Hobby List");
    
    	CNamePage pgName;
    	CHobbyPage pgHobby; 
    
    	nameSheet.AddPage(&pgName);
    	nameSheet.AddPage(&pgHobby); 
    
    
    	nameSheet.DoModal();
    I'm using VS6, I don't see a Property Sheet Control. Do I have to import it from the Gallery?

    Also, how do I set the position on where I want it to be placed in my dialog/formview.
    Rate this post if it helped you.

  12. #12
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Function to Draw Controls from a different dialog box template

    As mentioned in my first post, set the style of the property sheet to child.

    Then inside the parent dialog use CreateWindow to create the sheet (and DestroyWindow).

    Btw, does the dialog hold any other controls besides what is contained within the 'group' of controls?

  13. #13
    Join Date
    Jun 2004
    Posts
    1,352

    Re: Function to Draw Controls from a different dialog box template

    I'm not sure if you are talking about CPropertySheet or CPropertyPage.

    There is no way I can see of as setting CPropertySheet to wizard mode as there is no control for it.


    Still don't see how you position the the PropertyPage. ... all I get is a popup centered on the screen.
    Rate this post if it helped you.

  14. #14
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Function to Draw Controls from a different dialog box template

    Please, search MSDN for something like using cpropertysheet cpropertypage...
    Victor Nijegorodov

  15. #15
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Function to Draw Controls from a different dialog box template

    It's not very clear what exactly you want to accomplish, so please clarfy the points below:
    1. you want a property sheet which is is in wizard mode or not?
    2. you want a property sheet which is child or is owned by a (form) view?
    3. what exactly this mean?
      There is no way I can see of as setting CPropertySheet to wizard mode as there is no control for it.

    To see the difference between child and owned, take a look at these FAQs:


    Anyhow, the initial idea of using a tab control to switch between viwes or to show/hide different sets of controls is not so good.
    Using the property sheet is easier and more elegant.
    Last edited by ovidiucucu; September 14th, 2010 at 04:37 AM. Reason: typo
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured