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. onlick event of command button is not called

onlick event of command button is not called

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionlearning
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.
  • G Offline
    G Offline
    ganesh dp
    wrote on last edited by
    #1

    I have one propertypage and it has the 10 radio button and two command button. All buttons has the onclick event function. My problem is two command button event is not called. I checked the message map area. Its looking fine. I can't simply add another control and compile it. Because it's huge lib, I have to wait 10 hours to complete. resource.h has the control Id. Some other dialog also has the control with same ID, there the event is occured. Anybody suggest me what could be the problem?

    C N 2 Replies Last reply
    0
    • G ganesh dp

      I have one propertypage and it has the 10 radio button and two command button. All buttons has the onclick event function. My problem is two command button event is not called. I checked the message map area. Its looking fine. I can't simply add another control and compile it. Because it's huge lib, I have to wait 10 hours to complete. resource.h has the control Id. Some other dialog also has the control with same ID, there the event is occured. Anybody suggest me what could be the problem?

      C Offline
      C Offline
      CPallini
      wrote on last edited by
      #2

      ganesh.dp wrote:

      I can't simply add another control and compile it. Because it's huge lib, I have to wait 10 hours to complete.

      There's something weird in that. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      1 Reply Last reply
      0
      • G ganesh dp

        I have one propertypage and it has the 10 radio button and two command button. All buttons has the onclick event function. My problem is two command button event is not called. I checked the message map area. Its looking fine. I can't simply add another control and compile it. Because it's huge lib, I have to wait 10 hours to complete. resource.h has the control Id. Some other dialog also has the control with same ID, there the event is occured. Anybody suggest me what could be the problem?

        N Offline
        N Offline
        norish
        wrote on last edited by
        #3

        Assign unique value for duplicated id, simply. You should assign all unique (different) id for different controls. Only one handler will be called for one id value on MFC message mapping. Because MFC's message mapping is very simple implement which using array of struct, and decide handler by sequential searching. When message map is as below;

        BEGIN_MESSAGE_MAP(CSampleDlg, CDialog)
        //{{AFX_MSG_MAP(CSampleDlg)
        ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
        ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
        //}}AFX_MSG_MAP
        END_MESSAGE_MAP()

        Compiler recognize as below; (rewriting simply)

        struct MessageEntry messageEntries[] = {
        { IDC_BUTTON1, OnButton1 },
        { IDC_BUTTON2, OnButton2 }
        };

        If IDC_BUTTON1 and IDC_BUTTON2 are equal, the sequential searching algorithm always find OnButton1 for IDC_BUTTON{1,2}.

        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