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. CStatic text box

CStatic text box

Scheduled Pinned Locked Moved C / C++ / MFC
designquestion
4 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.
  • M Offline
    M Offline
    mcsherry
    wrote on last edited by
    #1

    Hi, I've got a static text box on my dialog, I've renamed the text box which then allows me to access its events. I've added an on click event which has automatically created an 'OnStnClicked' method and added an entry to the message map. However when I run the code the 'OnStnClicked' doesn't get called. Do I need to add change any of the properties on the text control to allow this method to be called? (Double clicking on the text whilst in design mode takes me to the created method) TIA, Andy

    M M L 3 Replies Last reply
    0
    • M mcsherry

      Hi, I've got a static text box on my dialog, I've renamed the text box which then allows me to access its events. I've added an on click event which has automatically created an 'OnStnClicked' method and added an entry to the message map. However when I run the code the 'OnStnClicked' doesn't get called. Do I need to add change any of the properties on the text control to allow this method to be called? (Double clicking on the text whilst in design mode takes me to the created method) TIA, Andy

      M Offline
      M Offline
      mcsherry
      wrote on last edited by
      #2

      Figured it out, needed to set the 'Notify' property to True.

      1 Reply Last reply
      0
      • M mcsherry

        Hi, I've got a static text box on my dialog, I've renamed the text box which then allows me to access its events. I've added an on click event which has automatically created an 'OnStnClicked' method and added an entry to the message map. However when I run the code the 'OnStnClicked' doesn't get called. Do I need to add change any of the properties on the text control to allow this method to be called? (Double clicking on the text whilst in design mode takes me to the created method) TIA, Andy

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #3

        If you add the SS_NOTIFY then the parent window will receive a STN_CLICKED notification (in a WM_COMMAND message). You can set the SS_NOTIFY style in the control's property window by setting the Notify property to true. You can catch the message in the parent with afx_msg void OnStaticClicked(); ... ON_CONTROL(STN_CLICKED, IDC_MYSTATIC, OnStaticClicked) ... void CMyDialog::OnStaticClicked() { // do something here }

        "Go that way, really fast. If something gets in your way, turn."

        1 Reply Last reply
        0
        • M mcsherry

          Hi, I've got a static text box on my dialog, I've renamed the text box which then allows me to access its events. I've added an on click event which has automatically created an 'OnStnClicked' method and added an entry to the message map. However when I run the code the 'OnStnClicked' doesn't get called. Do I need to add change any of the properties on the text control to allow this method to be called? (Double clicking on the text whilst in design mode takes me to the created method) TIA, Andy

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          You need to set the Notify property to True

          Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy

          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