Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MFC

MFC

Scheduled Pinned Locked Moved C / C++ / MFC
c++
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    koteswara
    wrote on last edited by
    #1

    Hi gurus, i have one dialogbox. it contains three listboxes, 1. I want to change items of one listbox contents depend on the selection of item in another List box. 2. for this purpose i need to handle OnSelChange() function. 3. How can add this OnSelChange() function to Dialog box class. thanks in advance, - Koteswara Rao

    T F 2 Replies Last reply
    0
    • K koteswara

      Hi gurus, i have one dialogbox. it contains three listboxes, 1. I want to change items of one listbox contents depend on the selection of item in another List box. 2. for this purpose i need to handle OnSelChange() function. 3. How can add this OnSelChange() function to Dialog box class. thanks in advance, - Koteswara Rao

      T Offline
      T Offline
      Tonio
      wrote on last edited by
      #2

      Good Day! In Visual Studio, the ClassWizard provides a tab for message handlers that creates the necessary function declaration and skeleton of implementation. HTH.

      1 Reply Last reply
      0
      • K koteswara

        Hi gurus, i have one dialogbox. it contains three listboxes, 1. I want to change items of one listbox contents depend on the selection of item in another List box. 2. for this purpose i need to handle OnSelChange() function. 3. How can add this OnSelChange() function to Dialog box class. thanks in advance, - Koteswara Rao

        F Offline
        F Offline
        Frank Deo
        wrote on last edited by
        #3

        I think I understand what you want to do...try subclassing the dialog listbox controls. First derive a new class for each of the three listboxes from CListBox.

        CMyListBox1
        CMyListBox2
        CMyListBox3

        Then, in your dialog's main header file (mydlg.h, or whatever) change the default from:

        CListBox m_ListBox1;
        CListBox m_ListBox2;
        CListBox m_ListBox3;

        to:

        CMyListBox1 m_ListBox1;
        CMyListBox2 m_ListBox2;
        CMyListBox3 m_ListBox3;

        Don't forget to #include the CMyListBox(x).h files in your code. Then, from your dialog's OnInitDialog function, subclass the controls using this code:

        VERIFY(m_ListBox1.SubclassDlgItem(IDC_LISTBOX1, this));
        VERIFY(m_ListBox2.SubclassDlgItem(IDC_LISTBOX2, this));
        VERIFY(m_ListBox3.SubclassDlgItem(IDC_LISTBOX3, this));

        Finally, then you can handle the OnSelChange event in your CListBox derived classes. So, you really don't add the function to the dialog class, you make it so you can handle the function from within that class. Good Luck, Frank :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups