CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13

Threaded View

  1. #1
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,867

    [RESOLVED] CPropertySheet 'Help' key (disabling)

    I need to "gray out" (i.e. enable / disable) the 'Help' button on a property sheet, depending upon which property page is currently selected. Just to check that I had the right resource ID I tried this:-

    GetParent()->GetDlgItem(IDHELP)->SetWindowText("Goodbye");

    which successfully changes the text to "Goodbye". I also tried this:-

    GetParent()->GetDlgItem(IDHELP)->ShowWindow(SW_HIDE);

    which successfully made the button disappear. However, I can't seem to find a way to give the button a standard 'disabled' look. This doesn't work:-

    GetParent()->GetDlgItem(IDHELP)->EnableWindow(FALSE);

    ....and this actually asserts although it's a technique I've used many times before with other buttons:-

    GetParent()->GetDlgItem(IDHELP)->ShowWindow(SW_HIDE);
    GetParent()->GetDlgItem(IDHELP)->ModifyStyle(WS_TABSTOP, ~WS_ENABLED);
    GetParent()->GetDlgItem(IDHELP)->ShowWindow(SW_SHOWNOACTIVATE);


    I'm rapidly running out of ideas. Can anyone suggest an alternative strategy?

    [ Edit... ]
    Just for the record, this doesn't work either - but at least it doesn't assert....

    GetParent()->GetDlgItem(IDHELP)->ModifyStyle(WS_TABSTOP, WS_DISABLED);
    GetParent()->GetDlgItem(IDHELP)->ShowWindow(SW_HIDE);
    GetParent()->GetDlgItem(IDHELP)->ShowWindow(SW_SHOWNOACTIVATE);
    Last edited by John E; August 4th, 2006 at 04:32 AM.
    "A problem well stated is a problem half solved.” - Charles F. Kettering

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured