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. Changing CButton Caption?

Changing CButton Caption?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++tutoriallearning
5 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hello, I now C++ pretty well but I'm a MFC beginner. I'm trying to learn it by myself. How can I change the caption of a button? How can I disable it? I looked into the CButton Class and I can't find how to change it :(( Anyone can answer this newbie question? (I wish this was as easy as VB) hehe Thanks

    J F L 3 Replies Last reply
    0
    • L Lost User

      Hello, I now C++ pretty well but I'm a MFC beginner. I'm trying to learn it by myself. How can I change the caption of a button? How can I disable it? I looked into the CButton Class and I can't find how to change it :(( Anyone can answer this newbie question? (I wish this was as easy as VB) hehe Thanks

      J Offline
      J Offline
      J Patel
      wrote on last edited by
      #2

      CButton is derived from CWnd, so you can call methods like SetWindowText to change the caption or EnableWindow() to enable/disable the window. Look at all the methods of CWnd which will show you what you can do. HTH Jignesh

      L 1 Reply Last reply
      0
      • J J Patel

        CButton is derived from CWnd, so you can call methods like SetWindowText to change the caption or EnableWindow() to enable/disable the window. Look at all the methods of CWnd which will show you what you can do. HTH Jignesh

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

        Thanks a lot. I must admit that I should have looked at it hehe

        1 Reply Last reply
        0
        • L Lost User

          Hello, I now C++ pretty well but I'm a MFC beginner. I'm trying to learn it by myself. How can I change the caption of a button? How can I disable it? I looked into the CButton Class and I can't find how to change it :(( Anyone can answer this newbie question? (I wish this was as easy as VB) hehe Thanks

          F Offline
          F Offline
          F Dost
          wrote on last edited by
          #4

          Try this: GetDlgItem(IDC_YOUR_BUTTON_ID)->EnableWindow(FALSE); GetDlgItem(IDC_YOUR_BUTTON_ID)->SetWindowText("new text"); F.Dost

          1 Reply Last reply
          0
          • L Lost User

            Hello, I now C++ pretty well but I'm a MFC beginner. I'm trying to learn it by myself. How can I change the caption of a button? How can I disable it? I looked into the CButton Class and I can't find how to change it :(( Anyone can answer this newbie question? (I wish this was as easy as VB) hehe Thanks

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

            What i do is that in the dialog editor you put the & sign before the letter with the caption. I hope this is what you need . SAntiago Suarez:-D

            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