Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » How to disabled the close button of a floating bar? Collapse All
Subject Author Date
Offer Har Jun 30, 2008 - 9:41 AM

I have a floating bar that in some cases I need to disabled to close ’X’ button - How do I do that?


Thanks,


Ron.

Technical Support Jun 30, 2008 - 1:15 PM

The buttons in captions of resizable control bars (docked or floating) and in captions of toolbars are instances of the CExtBarNcAreaButton-based classes. The CExtBarNcAreaButtonClose class implements an X-button. You can create and use your own CExtBarNcAreaButtonClose-derived class. You can hide this button by overriding the CExtBarNcAreaButtonClose::OnQueryVisibility() virtual method and returning a false value from it. You can handle a button click in the overridden CExtBarNcAreaButtonClose::OnNcAreaClicked() virtual method and invoke the parent class method or display a message box with information about why closing is not recommended. You should override the CExtControlBar::OnNcAreaButtonsReinitialize() virtual method to make the control bar using your X button class instead of the default class. Your method should be similar to the original one but simply instantiate your class. Please note, coding your own caption button classes is typically needed if you need some specific caption buttons with custom look, size and/or behavior. If you want only to disable button clicks, you can avoid coding your button class and simply implement the CExtDynamicControlBar::NcButtons_HandleClick() virtual method which is a better solution, because it handles button clicks on both stand alone bars and tabbed group bar captions. Your implementation of the CExtDynamicControlBar::NcButtons_HandleClick() virtual method should return true if the click event is handled. In this case Prof-UIS will not do any default actions related to each particular button. By returning false value you will inform Prof-UIS that button click should be handled using default actions.

Offer Har Jun 30, 2008 - 2:42 PM

Dear Support,


All I want is that when I specify if, the button will look disabled. From the options you explained above, it does not sound even possible, unless I paint the button myself somehow, and I don’t undersatnd how.


I know how to ’eat’ the click, and prevent the bar from being closed, but I get complains from our customers that this is not enough, as it looks like a bug that the button is enabled, and clikcing it does nothing, so they requested for it to look disabled, not only act disabled.


Please explain how this can be implemented.


Thanks,


Ron.

Technical Support Jul 1, 2008 - 7:21 AM

We follow the design presented in MS applications when caption buttons in toolbars and control bars are small UI elements, which can be visible and clickable or hidden. They cannot be visible and disabled. You may have noticed that a menu bar in MS Office applications in the floating state does not have a Close button and you even cannot hide it from the Toolbars page of Customize dialog because the check box in the list box item with Menu Bar text is disabled. We suspect Microsoft does not support disabled caption buttons because they are really small and disabled look may be not very recognizable. We can regard this as a feature request and implement support for disabled caption buttons in all the paint managers.