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.
Subject |
Author |
Date |
|
Robert Webb
|
Sep 15, 2008 - 11:54 PM
|
How do I catch a mouse click in a read-only text field in a ribbon bar? I want it to act like a button and execute its command id. Thanks, Rob.
|
|
Technical Support
|
Sep 16, 2008 - 9:43 AM
|
You should create your own CExtRibbonNode -derived class for your text field button and use it in ribbon’s command tree. Your ribbon node class should return run-time class information of your text field button class:
CRuntimeClass * CYourRibbonNodeClassNameHere::_OnRibbonGetButtonRTC()
{
return RUNTIME_CLASS( CYourRibbonButtonClassNameHere );
} Your text field button class should be derived from the CExtBarTextFieldButton class and it should implement the CExtBarTextFieldButton::OnClick virtual method. The CExtBarButton::GetStyle() method returns a set of TBBS_***() button styles. If the TBBS_DISABLED() style is present, then the button is disabled. So, your OnClick virtual method will know whether to act like a button or whether to invoke parent class method. There is one more very important thing: the ribbon/toolbar buttons are not clickable in disabled state by default. So, you will also need to override the CExtBarButton::CanBePressedInDisabledState() virtual method in your text field button class and simply return true from it.
|
|
Robert Webb
|
Sep 19, 2008 - 2:03 AM
|
|
|