CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2002
    Posts
    248

    How to use a derived control class in MFC's view?

    I have a cutomized control class, when I work on dialog project, I can have a physical control drag drop on the dialog, then use
    DDX_Control(pDX, IDC_EXAMPLE2, m_cExample2);

    but now I am working on a view, I have to dynamic creat control, but I don't know how to associate that customized control class with my current control without using DDX_Control(...)

    Anyone has idea?

  2. #2
    Join Date
    Jul 1999
    Location
    Israel
    Posts
    1,793
    If you have created the control with the wizard then it should
    appear in the list where you add member variables ( using class wiz )
    If it is an edit control ( for example ) instead of value select control
    and in the combo box below you should see you class.
    Other way to do it ( if it dose not appear in this list )
    you can rebuild your clw file:
    close your project, go to the directory where all files are,
    delete MyProjectName.clw file as well as ncd and aps.
    reopen your project and click ctrl+w ( to go the class wiz )
    select add all files ( ensure that your controls's file are there )

    then try to add new member variable,
    it should appear there now...

    HTH
    Kishk91

  3. #3
    Join Date
    Apr 2002
    Posts
    248
    Thanks for your prompt reply!

    I create the control dynamically during run time using

    m_pVideo->Create("","",WS_CHILD|WS_VISIBLE,rect,this, 200000);

    Issure now is i can not use DDX_(...), what else I can use to assocaite my control and that customized control class, using subclass()?

    Thanks again

  4. #4
    Join Date
    Jul 1999
    Location
    Israel
    Posts
    1,793
    Hmmm...
    But mybe you can use SubClassDlgItem or SubcCassWindow.
    I cannot tell you if it will work, due to the fact that i never done it before.
    Worth trying....


    Good luck,
    kishk

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