Print Page | Close Window

Disable close(X) button

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=12341
Printed Date: 28 February 2025 at 7:23pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Disable close(X) button
Posted By: homaas
Subject: Disable close(X) button
Date Posted: 06 October 2008 at 6:07am
My app sometimes need to disable/enable the (X) button (the top-right button on screen), it worked correctly with the following code:

    HMENU hMenu = ::GetSystemMenu(m_hWnd,FALSE);
    if (hMenu)
        EnableMenuItem(hMenu,SC_CLOSE,bEnable ? MF_ENABLED : MF_GRAYED);


  But when I apply skin for this form, the close button is not enable or disable as I expected (always enable or disable).

 Plz help me,

 Thanks a lot!



Replies:
Posted By: rdhd
Date Posted: 15 October 2008 at 6:18pm

I have not used skins but I do use the command ribbon with one of the word styles. For me to disable the close icon I first have to find the control and change the update flag. I do this:
 
if (CXTPControl* pCloseControl = pRibbonBar->GetControls()->FindControl(XTP_ID_MENUBAR_CLOSE))

{

pCloseControl->SetFlags( pCloseControl->GetFlags() & ~xtpFlagManualUpdate );

}

Then I went into my OnCmdMsg handler and looked for the control with an id of XTP_ID_MENUBAR_CLOSE. Then simply set the enabled flag of the update UI object passed in.
I do the same thing you do to disable the original windows SC_CLOSE object and I get the menu item and examine its enabled/grayed state to base my setting of the flag. So you are almost there.


Posted By: homaas
Date Posted: 16 October 2008 at 12:51am
First, thanks member_profile.asp?PF=3213&FID=117 - rdhd ,
but "Then I went into my OnCmdMsg handler and looked for the control with an id of XTP_ID_MENUBAR_CLOSE. Then simply set the enabled flag of the update UI object passed in." I don't know how to do this, can you show me how to do this task?
Thanks a lot!


Posted By: Oleg
Date Posted: 16 October 2008 at 4:36am
Hi,
 
Its not CommandBars issue :(. Its from SkinFramework.
will be fixed for 12.1 release.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net