dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 5 of 7 FirstFirst ... 234567 LastLast
Results 61 to 75 of 92

Thread: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

  1. #61
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,146

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Quote Originally Posted by Sparsh_21j View Post
    Yes Arjay it sets the button text to OKAY,even button font is also getting bold if i use CFont concept,even position of button is also changing if i use Movewindow..Only thing and most painful for me button Color which is not changing.
    If the text is getting set with SetDlgItemText with id IDOK, but you can't change the background color withe the DDX mapped m_ok variable, it means the DDX mapping isn't working. Are you sure IDOK is a valid id for the property sheet ok button?

  2. #62
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,543

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Quote Originally Posted by Arjay View Post
    ... Are you sure IDOK is a valid id for the property sheet ok button?
    Well, the standard IDs in property sheet are:
    IDOK, IDAPPLY, IDCANCEL, IDHELP.
    Victor Nijegorodov

  3. #63
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,554

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Quote Originally Posted by Arjay View Post
    If the text is getting set with SetDlgItemText with id IDOK, but you can't change the background color withe the DDX mapped m_ok variable, it means the DDX mapping isn't working. Are you sure IDOK is a valid id for the property sheet ok button?
    IDOK is right and worked for me. I asked the OP to check if m_ok had a valid m_hWnd. No response to that one yet.

  4. #64
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,146

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Quote Originally Posted by VictorN View Post
    Well, the standard IDs in property sheet are:
    IDOK, IDAPPLY, IDCANCEL, IDHELP.
    Well, it's been 20 years so I forget...

  5. #65
    Join Date
    Sep 2019
    Posts
    24

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    {hwnd=0x000000000a3 {unused=???}}

  6. #66
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,543

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Quote Originally Posted by Sparsh_21j View Post
    {hwnd=0x000000000a3 {unused=???}}
    Victor Nijegorodov

  7. #67
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,554

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Quote Originally Posted by Sparsh_21j View Post
    {hwnd=0x000000000a3 {unused=???}}
    If this is really your code
    Code:
    BOOL MyPropertysheet:: OnInitDialog()
    {
        BOOL bResult = CPropertySheet:: OnInitDialog();
        UpdateData(FALSE);
    
        m_ok.SetFaceColor(RGB(255,102,0);
    
        SetDlgItemText(IDOK,("OKAY"));
    
        return bResult;
    }
    you need to step into UpdateData and find out why it isn't working.

    Does SetDlgItemText work?

  8. #68
    Join Date
    Oct 2019
    Posts
    36

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    SetDlgItemText works if UpdataData(FALSE) is not used.As soon as i use UpdateData(FALSE) before SetFaceColor than button becomes invisible(already told)

  9. #69
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,146

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Quote Originally Posted by GCDEF View Post
    If this is really your code
    Code:
    BOOL MyPropertysheet:: OnInitDialog()
    {
        BOOL bResult = CPropertySheet:: OnInitDialog();
        UpdateData(FALSE);
    
        m_ok.SetFaceColor(RGB(255,102,0);
    
        SetDlgItemText(IDOK,("OKAY"));
    
        return bResult;
    }
    you need to step into UpdateData and find out why it isn't working.

    Does SetDlgItemText work?
    Asked in post #32 and answered in #33.

  10. #70
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,543

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Quote Originally Posted by Beginner_MFC View Post
    SetDlgItemText works if UpdataData(FALSE) is not used.As soon as i use UpdateData(FALSE) before SetFaceColor than button becomes invisible(already told)
    Could you post the complete test project that reproduces such a strange behavior?
    So we would try to test it...
    Victor Nijegorodov

  11. #71
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,554

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    I'm saying time to do some stepping to figure out what's happening

  12. #72
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,146

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Quote Originally Posted by GCDEF View Post
    I'm saying time to do some stepping to figure out what's happening
    The time to do that is before posting 50 questions to a forum.

  13. #73
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,543

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Quote Originally Posted by Arjay View Post
    The time to do that is before posting 50 questions to a forum.
    Victor Nijegorodov

  14. #74
    Join Date
    Oct 2019
    Posts
    36

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    I did debug but not able to get anything on UpdateData() means no success!!

  15. #75
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,554

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Quote Originally Posted by Beginner_MFC View Post
    I did debug but not able to get anything on UpdateData() means no success!!
    Did UpdateData get called?
    Did m_ok have a valid m_hWnd after the call?
    Did you step into the DDX call to see why it was failing if it was?
    Did m_ok have a valid m_hWnd after UpdateData and when you called SetFaceColor?

Page 5 of 7 FirstFirst ... 234567 LastLast

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)