![]() |
Disable close(X) button |
Post Reply ![]() |
Author | |
homaas ![]() Newbie ![]() Joined: 26 September 2008 Location: Vietnam Status: Offline Points: 5 |
![]() ![]() ![]() ![]() ![]() 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! |
|
![]() |
|
rdhd ![]() Senior Member ![]() ![]() Joined: 13 August 2007 Location: United States Status: Offline Points: 899 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
homaas ![]() Newbie ![]() Joined: 26 September 2008 Location: Vietnam Status: Offline Points: 5 |
![]() ![]() ![]() ![]() ![]() |
First, thanks 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! |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Its not CommandBars issue :(. Its from SkinFramework.
will be fixed for 12.1 release.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |