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. Common handler for all dialog controls

Common handler for all dialog controls

Scheduled Pinned Locked Moved C / C++ / MFC
2 Posts 2 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.
  • R Offline
    R Offline
    Raghunandan S
    wrote on last edited by
    #1

    Hi All, I have a very complex dialog with 5 edit controls,4 comboboxes,3 radio buttons and 2 list boxes. The controls id's are not in sequence(hence i cannot use ON_CONTROL_RANGE).I need to write a handler which will be called whenever user makes any changes to any of the controls.Is there any way to do this without adding an event handler for individual controls. Thanks in advance, Raghu

    J 1 Reply Last reply
    0
    • R Raghunandan S

      Hi All, I have a very complex dialog with 5 edit controls,4 comboboxes,3 radio buttons and 2 list boxes. The controls id's are not in sequence(hence i cannot use ON_CONTROL_RANGE).I need to write a handler which will be called whenever user makes any changes to any of the controls.Is there any way to do this without adding an event handler for individual controls. Thanks in advance, Raghu

      J Offline
      J Offline
      John R Shaw
      wrote on last edited by
      #2

      That is not a complex dialog! If you want to centralise (create a handler) the control of any change messages, then you write one function that can handle any change and have have all the the change messages rerouted to that handler. What that means is that you have your on-change functions for each control call the same function to handle the message. On a more practical note; each on-change function should do it's own thing and then call a funcion that, that says "wow, something has changed so we have to update the current status" (display, whatever...) and act accordingly. Of course you could write a hook, to handle the messages, but that is a more than a bit of overkill for simple message handling. You could also handle the messages in PreTranslateMessage(...), which is almost the same as writing your code in C (one message handler for the whole window). Those are the choices I see, but essentualy what you appear to need is just a function that needs to be called it any changed occured. (See "On a more practical note") Good Luck! INTP "The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes." Andrew W. Troelsen

      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