Inserting a CFormView into a CPropertySheet

In many cases, is usefull to have in one page of propery sheet more controls. But if the area of page is not enough, you have to insert some scroll bars into page. To make this simple you can do the followings:

Creating one CFormView

  • Generate a new dialog with Child style, which contains all controls from one scrollable page on resource
  • From class wizard add a new CFormView, with ID be the id of created dialog. (CMyFormView)
  • Make the constuctor and destructor to be public (by default, these are protected for dynmicaly creation) (CMyFormView)
  • From classwizard, add in this class (CFormView) a new member PostNcDestroy.
  • From the generated body function remove CFormView::PostNcDestroy() ( In CFormView::PostNcDestroy is called delete this)
  • Add handler for WM_CREATE message into CMyFormView, and in the body of the generated function call SetScrollSizes(MM_TEXT, CSize(100,200));
  • Add a new function public: virtual BOOL CMyFormView::Create(CWnd* pParent), with body
  • 
    BOOL CMyFormView::Create(CWnd *pParent)
    {
    CRect rect; pParent->GetClientRect(rect);
    return CFormView::Create(NULL, NULL, WS_CHILD | WS_VISIBLE, rect, pParent, 0, NULL);
    }
    
    

    Adding the new member of CMyFormView type to one of CPropertyPage

  • From classwizard and in one of pages's sheet, a new member of CMyFormView type.
  • For this page add handler for WM_INITDIALOG message.
  • In the body call, Create(this) of member of CMyFormView type
  • If something is missing or wrong, feel free to ask me at: mihai_f@hotmail.com



    Comments

    • I have a problem adding a string to a CComboBox in the FormView

      Posted by Legacy on 02/04/2003 12:00am

      Originally posted by: Andrew

      Your article is very useful for me.It was successfull.
      But,when I try to add a string to a CComboBox in the FormView,the application terminated with error message.
      The message is like this

      -------------------------
      Debug Assertion Failed
      File:afxwin2.inl
      Line:735
      -------------------------

      Reply
    • I have a problem about TabCtrl and View

      Posted by Legacy on 04/17/2001 12:00am

      Originally posted by: kim

      Your article is very useful for me.
      Actually, I inserted ScrollView into TabCtrl.
      It was successfull.
      But,when I clicked on the ScrollView,the application terminated with error message.
      The message is like this
      -------------------------
      Debug Assertion Failed
      File:viewcore.cpp
      Line:252
      -------------------------

      I wrote VC++ code just as you did.
      I used ScrollView instead of FormView.

      What is the problem?
      Please advise me!


      Reply
    • Small Correction

      Posted by Legacy on 02/11/2001 12:00am

      Originally posted by: Vivek Rajan

      Good article -


      In the PostNcDestroy method :-

      Instead of commenting out CFormView::PostNcDestroy,
      you should call CWnd::PostNcDestroy directly.

      ( For more info on PostNcDestroy, see MSDN TN17 )

      Later-
      Vivek

      Reply
    • Simple, yet Great... Idea

      Posted by Legacy on 01/21/2000 12:00am

      Originally posted by: Achalla Srinivasu

      Hi,

      the idea is very good and helpful.

      Thank You....

      Regards,
      Srinivasu. A


      Reply
    • How to make docking pages

      Posted by Legacy on 09/15/1999 12:00am

      Originally posted by: Nemo

      I think your idea is a clue to my problem, but I cannot find the way. I need to implement docking pages like it is done in Delphi environment. I.e. I want to allow pages to be dragged away as floating window and stick back to sheet if they are dragged over it. Can you give me advise?

      Sincerely,
      Serge.

      Reply
    • Thanks, exactly what I needed

      Posted by Legacy on 02/15/1999 12:00am

      Originally posted by: chris Rau

      I am new to MFC and was trying to figure out this exact issue when I found your post. Thank you very much. It works like a charm.

      Reply
    • It's work Ok, but not correctly...

      Posted by Legacy on 02/02/1999 12:00am

      Originally posted by: Aleks

      It's work Ok, but not correctly:

      In ideal, if I navigate to controls using TAB key, focused control
      must begin visiable in property page (i.e. Veiw automatically scrolled
      to focused control position). Next, if I already in this page, I can't
      navigate to other pages and Prop Sheet's buttons, using navigation keys.

      Best way to solve this problem - take original CFormView and CScrollView
      source code, remove all non-needed (on CDocument links and so on), replace
      CView to CWnd, GetParentFrame() to GetParent(),correct some errors and
      add navigation key press and othe messages handling. I hope it's will
      be fine!

      Aleks

      Reply
    Leave a Comment
    • Your email address will not be published. All fields are required.

    Top White Papers and Webcasts

    • Data integrity and ultra-high performance dictate the success and growth of many companies. One of these companies is BridgePay Network Solutions, a recently launched and rapidly growing financial services organization that allows merchants around the world to process millions of daily credit card transactions. Due to the nature of their business, their IT team needed to strike the perfect balance between meeting regulatory-mandated data security measures with the lowest possible levels of latency and …

    • Today, users, applications, and data exist in more places than ever before, creating an unprecedented challenge for IT. How can IT achieve the flexibility and agility it needs to offer multiple types of applications in multiple locations? To better serve business demands for information everywhere, enterprises must develop new strategies for optimizing multiple kinds of networks. Read this white paper to learn how hybrid networks provide an unprecedented level of network dynamism, enterprise agility, and the …

    Most Popular Programming Stories

    More for Developers

    RSS Feeds

    Thanks for your registration, follow us on our social networks to keep up-to-date