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. How to gray out PropertyPage Tabs?

How to gray out PropertyPage Tabs?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
10 Posts 4 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.
  • J Offline
    J Offline
    Jerry Wang 0
    wrote on last edited by
    #1

    Hi, I have a CPropertySheet class object with several CPropertyPages in it. There are situations where I would need to prohibit the user from having access to a partiular PropertyPage. Is there a way to gray out that PropertyPage Tab to prevent it being selected? Thanks in advance, Jerry Wang

    T C N 3 Replies Last reply
    0
    • J Jerry Wang 0

      Hi, I have a CPropertySheet class object with several CPropertyPages in it. There are situations where I would need to prohibit the user from having access to a partiular PropertyPage. Is there a way to gray out that PropertyPage Tab to prevent it being selected? Thanks in advance, Jerry Wang

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      There's no flag or message for disabling tabs. You'll have to use owner-draw. Have a look at March 1998 issue of Microsoft Systems Journal, C++ Q & A column - it has the code you need. This article may be in your VC++ help; search in the 'Periodicals' section. If it's not there, go to msdn.microsoft.com, then MSDN Magazine and Past Issues. Tomasz Sowinski -- http://www.shooltz.com

      J 1 Reply Last reply
      0
      • J Jerry Wang 0

        Hi, I have a CPropertySheet class object with several CPropertyPages in it. There are situations where I would need to prohibit the user from having access to a partiular PropertyPage. Is there a way to gray out that PropertyPage Tab to prevent it being selected? Thanks in advance, Jerry Wang

        C Offline
        C Offline
        Carlos Antollini
        wrote on last edited by
        #3

        And why don't remove the page? I don't Know if you can to prohibit the click in any tab. Try disabling the Dialog, that is part of the PropertySheet. Best Regards!!! Carlos Antollini.

        J 1 Reply Last reply
        0
        • J Jerry Wang 0

          Hi, I have a CPropertySheet class object with several CPropertyPages in it. There are situations where I would need to prohibit the user from having access to a partiular PropertyPage. Is there a way to gray out that PropertyPage Tab to prevent it being selected? Thanks in advance, Jerry Wang

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          I'm not sure if you can do it with EnableWindow or not. You can use RemovePage and AddPage but that probably isn't what you want. I hadn't thought about it but now I'm trying to find an example of a disabled property page.

          1 Reply Last reply
          0
          • C Carlos Antollini

            And why don't remove the page? I don't Know if you can to prohibit the click in any tab. Try disabling the Dialog, that is part of the PropertySheet. Best Regards!!! Carlos Antollini.

            J Offline
            J Offline
            Jerry Wang 0
            wrote on last edited by
            #5

            It is not desirable to remove the page. I would like to let the user know that the features exists, but are only activated when the user checks a checkbox. I do not want the user to fiddle with the features inside the tab while having the checkbox unchecked and wondering why no action is happening. What is the function call to disable the dialog? I tried ShowWindow(FALSE) w/o success.:((

            C 1 Reply Last reply
            0
            • J Jerry Wang 0

              It is not desirable to remove the page. I would like to let the user know that the features exists, but are only activated when the user checks a checkbox. I do not want the user to fiddle with the features inside the tab while having the checkbox unchecked and wondering why no action is happening. What is the function call to disable the dialog? I tried ShowWindow(FALSE) w/o success.:((

              C Offline
              C Offline
              Carlos Antollini
              wrote on last edited by
              #6

              The command is EnableWindow(); Cheers!!! Did you try with the article that said Tomasz??? Carlos Antollini.

              J 1 Reply Last reply
              0
              • C Carlos Antollini

                The command is EnableWindow(); Cheers!!! Did you try with the article that said Tomasz??? Carlos Antollini.

                J Offline
                J Offline
                Jerry Wang 0
                wrote on last edited by
                #7

                Unfortunately VC++ doesn't like EnableWindow(FALSE) either. I just tried it in my CPropertySheet::OnInitDialog() and it gave me an run time assertion error. Apparently it is not a window and stops at BOOL CWnd::EnableWindow(BOOL bEnable) { ASSERT(::IsWindow(m_hWnd)); ... } where this == 0x01251ca0 and m_hWnd == 0x0 I will look into the article Tomasz mentioned.

                N 1 Reply Last reply
                0
                • T Tomasz Sowinski

                  There's no flag or message for disabling tabs. You'll have to use owner-draw. Have a look at March 1998 issue of Microsoft Systems Journal, C++ Q & A column - it has the code you need. This article may be in your VC++ help; search in the 'Periodicals' section. If it's not there, go to msdn.microsoft.com, then MSDN Magazine and Past Issues. Tomasz Sowinski -- http://www.shooltz.com

                  J Offline
                  J Offline
                  Jerry Wang 0
                  wrote on last edited by
                  #8

                  Thank you Tomasz, I found the 1998 Q&A article. It is very helpful. Too bad the grayout feature is not implemented. I think what I'm gonna do is just have a pop-up window notifying the user noting the tab features are not activated and do a YES/NO/CANCEL to ask if he/she would like to activate it at this time. sigh, so much for wanting to make the program nice and neat :suss: Thanks Tomasz, thanks Carlos and Mike! Jerry

                  T 1 Reply Last reply
                  0
                  • J Jerry Wang 0

                    Thank you Tomasz, I found the 1998 Q&A article. It is very helpful. Too bad the grayout feature is not implemented. I think what I'm gonna do is just have a pop-up window notifying the user noting the tab features are not activated and do a YES/NO/CANCEL to ask if he/she would like to activate it at this time. sigh, so much for wanting to make the program nice and neat :suss: Thanks Tomasz, thanks Carlos and Mike! Jerry

                    T Offline
                    T Offline
                    Tomasz Sowinski
                    wrote on last edited by
                    #9

                    Too bad the grayout feature is not implemented. "Not implemented?" What do you mean? The article presents the code that grays out and disables the tabs. Tomasz Sowinski -- http://www.shooltz.com

                    1 Reply Last reply
                    0
                    • J Jerry Wang 0

                      Unfortunately VC++ doesn't like EnableWindow(FALSE) either. I just tried it in my CPropertySheet::OnInitDialog() and it gave me an run time assertion error. Apparently it is not a window and stops at BOOL CWnd::EnableWindow(BOOL bEnable) { ASSERT(::IsWindow(m_hWnd)); ... } where this == 0x01251ca0 and m_hWnd == 0x0 I will look into the article Tomasz mentioned.

                      N Offline
                      N Offline
                      Not Active
                      wrote on last edited by
                      #10

                      Try it before or after OnInitDialog. It's not a window because at this point it hasn't been fully created yet.

                      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