CMFCRibbonEdit Class
Implements an edit control that is located on a ribbon bar.
class CMFCRibbonEdit : public CMFCRibbonButton
Name | Description |
---|---|
CMFCRibbonEdit::CMFCRibbonEdit | Constructs a CMFCRibbonEdit object. |
Name | Description |
---|---|
CMFCRibbonEdit::CanBeStretched | Indicates whether the height of the CMFCRibbonEdit control can increase vertically to the height of a ribbon row. |
CMFCRibbonEdit::CMFCRibbonEdit | Constructs a CMFCRibbonEdit object. |
CMFCRibbonEdit::CopyFrom | Copies the state of the specified CMFCRibbonEdit object to the current CMFCRibbonEdit object. |
CMFCRibbonEdit::CreateEdit | Creates a new text box for the CMFCRibbonEdit object. |
CMFCRibbonEdit::DestroyCtrl | Destroys the CMFCRibbonEdit object. |
CMFCRibbonEdit::DropDownList | Drops down a list box. |
CMFCRibbonEdit::EnableSpinButtons | Enables and sets the range of the spin button for the text box. |
CMFCRibbonEdit::GetCompactSize | Retrieves the compact size of the CFMCRibbonEdit object. |
CMFCRibbonEdit::GetEditText | Retrieves the text in the text box. |
CMFCRibbonEdit::GetIntermediateSize | Retrieves the intermediate size of the CMFCRibbonEdit object. |
CMFCRibbonEdit::GetTextAlign | Retrieves the alignment of the text in the text box. |
CMFCRibbonEdit::GetWidth | Retrieves the width, in pixels, of the CMFCRibbonEdit control. |
CMFCRibbonEdit::HasCompactMode | Indicates whether the display size for the CMFCRibbonEdit control can be compact. |
CMFCRibbonEdit::HasFocus | Indicates whether the CMFCRIbbonEdit control has the focus. |
CMFCRibbonEdit::HasLargeMode | Indicates whether the display size for the CMFCRibbonEdit control can be large. |
CMFCRibbonEdit::HasSpinButtons | Indicates whether the text box has a spin button. |
CMFCRibbonEdit::IsHighlighted | Indicates whether the CMFCRibbonEdit control is highlighted. |
CMFCRibbonEdit::OnAfterChangeRect | Called by the framework when the dimensions of the display rectangle for the CMFCRibbonEdit control changes. |
CMFCRibbonEdit::OnDraw | Called by the framework to draw the CMFCRibbonEdit control. |
CMFCRibbonEdit::OnDrawLabelAndImage | Called by the framework to draw the label and image for the CMFCRibbonEdit control. |
CMFCRibbonEdit::OnDrawOnList | Called by the framework to draw the CMFCRibbonEdit control in a commands list box. |
CMFCRibbonEdit::OnEnable | Called by the framework to enable or disable the CMFCRibbonEdit control. |
CMFCRibbonEdit::OnHighlight | Called by the framework when the pointer enters or leaves the bounds of the CMFCRibbonEdit control. |
CMFCRibbonEdit::OnKey | Called by the framework when the user presses a keytip and the CMFCRibbonEdit control has the focus. |
CMFCRibbonEdit::OnLButtonDown | Called by the framework to update the CMFCRibbonEdit control when the user presses the left mouse button on the control. |
CMFCRibbonEdit::OnLButtonUp | Called by the framework when the user releases the left mouse button. |
CMFCRibbonEdit::OnRTLChanged | Called by the framework to update the CMFCRibbonEdit control when the layout changes direction. |
CMFCRibbonEdit::OnShow | Called by the framework to show or hide the CMFCRibbonEdit control. |
CMFCRibbonEdit::Redraw | Updates the display of the CMFCRibbonEdit control. |
CMFCRibbonEdit::SetACCData | Sets the accessibility data for the CMFCRibbonEdit object. |
CMFCRibbonEdit::SetEditText | Sets the text in the text box. |
CMFCRibbonEdit::SetTextAlign | Sets the text alignment of the text box. |
CMFCRibbonEdit::SetWidth | Sets the width of the text box for the CMFCRibbonEdit control. |
The following example demonstrates how to construct a CMFCRibbonEdit
object, show spin buttons next to the edit control, and set the text of the edit control. This code snippet is part of the MS Office 2007 Demo sample.
CMFCRibbonEdit *pEditIndentLeft = new CMFCRibbonEdit(ID_PAGELAYOUT_INDENT_LEFT, 72, _T("Left:\nil"), 13);
// specify the min and max value of the spin button control
pEditIndentLeft->EnableSpinButtons(0, 1000);
// set the text of the edit control
pEditIndentLeft->SetEditText(_T("0"));
Header: afxRibbonEdit.h
Indicates whether the height of the CMFCRibbonEdit control can increase vertically to the height of a ribbon row.
virtual BOOL CanBeStretched();
Always returns FALSE.
Constructs a CMFCRibbonEdit object.
CMFCRibbonEdit(
UINT nID,
int nWidth,
LPCTSTR lpszLabel = NULL,
int nImage = -1);
CMFCRibbonEdit();
nID
[in] Command ID for the CMFCRibbonEdit
control.
nWidth
[in] The width, in pixels, of the text box for the CMFCRibbonEdit
control.
lpszLabel
[in] The label for the CMFCRibbonEdit
control.
nImage
[in] Index of the small image to use for the CMFCRibbonEdit
control. The collection of small images is maintained by the parent ribbon category.
The CMFCRibbonEdit
control does not use a large image.
Copies the state of the specified CMFCRibbonEdit object to the current CMFCRibbonEdit object.
virtual void CopyFrom(const CMFCRibbonBaseElement& src);
src
[in] The source CMFCRibbonEdit
object.
The src parameter must be of type CMFCRibbonEdit
.
Creates a new text box for the CMFCRibbonEdit object.
virtual CMFCRibbonRichEditCtrl* CreateEdit(
CWnd* pWndParent,
DWORD dwEditStyle);
pWndParent
[in] A pointer to the parent window of the CMFCRibbonEdit
object.
dwEditStyle
[in] Specifies the style of the text box. You can combine the window styles listed in the Remarks section with the edit control styles that are described in the Windows SDK.
A pointer to the new text box if the method was successful; otherwise, NULL.
Override this method in a derived class to create a custom text box.
You can apply the following Window Styles to a text box:
WS_CHILD
WS_VISIBLE
WS_DISABLED
WS_GROUP
WS_TABSTOP
Destroys the CMFCRibbonEdit object.
virtual void DestroyCtrl();
Drops down a list box.
virtual void DropDownList();
By default this method does nothing. Override this method to drop down a list box.
Enables and sets the range of the spin button for the text box.
void EnableSpinButtons(
int nMin,
int nMax);
nMin
[in] The minimum value of the spin button.
nMax
[in] The maximum value of the spin button.
Spin buttons display an up and down arrow and enable users to move through a fixed set of values.
Retrieves the compact size of the CMFCRibbonEdit object.
virtual CSize GetCompactSize(CDC* pDC);
pDC
[in] Pointer to a device context for the CMFCRibbonEdit
object.
The compact size of the CMFCRibbonEdit
object.
Retrieves the text in the text box.
CString GetEditText() const;
The text in the text box.
Retrieves the intermediate size of the CMFCRibbonEdit object.
virtual CSize GetIntermediateSize(CDC* pDC);
pDC
[in] Pointer to a device context for the CMFCRibbonEdit
object.
The intermediate size of the CMFCRibbonEdit
object.
Retrieves the alignment of the text in the text box.
int GetTextAlign() const;
A text alignment enumerated value. See the Remarks section for possible values.
The returned value is one of the following edit control styles:
ES_LEFT for left alignment
ES_CENTER for center alignment
ES_RIGHT for right alignment
For more information about these styles, see Edit Control Styles.
Retrieves the width, in pixels, of the CMFCRibbonEdit control.
int GetWidth(BOOL bInFloatyMode = FALSE) const;
bInFloatyMode
[in] TRUE if the CMFCRibbonEdit
control is in floating mode; otherwise, FALSE.
The width, in pixels, of the CMFCRibbonEdit
control.
Indicates whether the display size for the CMFCRibbonEdit control can be compact.
virtual BOOL HasCompactMode() const;
Always returns TRUE.
By default this method always returns TRUE. Override this method to indicate whether the display size can be compact.
Indicates whether the CMFCRibbonEdit control has the focus.
virtual BOOL HasFocus() const;
TRUE if the CMFCRibbonEdit
control has the focus; otherwise FALSE.
Indicates whether the display size for the CMFCRibbonEdit control can be large.
virtual BOOL HasLargeMode() const;
Always returns FALSE.
By default this method always returns FALSE. Override this method to indicate whether the display size can be large.
Indicates whether the text box has a spin button.
virtual BOOL HasSpinButtons() const;
TRUE if the text box has a spin button; otherwise FALSE.
Indicates whether the CMFCRibbonEdit control is highlighted.
virtual BOOL IsHighlighted() const;
TRUE if the CMFCRibbonEdit
control is highlighted; otherwise FALSE.
Called by the framework when the dimensions of the display rectangle for the CMFCRibbonEdit control change.
virtual void OnAfterChangeRect(CDC* pDC);
pDC
[in] Pointer to a device context for the CMFCRibbonEdit
control.
Called by the framework to draw the CMFCRibbonEdit control.
virtual void OnDraw(CDC* pDC);
pDC
[in] Pointer to a device context for the CMFCRibbonEdit
control.
Called by the framework to draw the label and image for the CMFCRibbonEdit control.
virtual void OnDrawLabelAndImage(CDC* pDC);
pDC
[in] Pointer to a device context for the CMFCRibbonEdit
control.
Called by the framework to draw the CMFCRibbonEdit control in a commands list box.
virtual void OnDrawOnList(
CDC* pDC,
CString strText,
int nTextOffset,
CRect rect,
BOOL bIsSelected,
BOOL bHighlighted);
pDC
[in] Pointer to a device context for the CMFCRibbonEdit
control.
strText
[in] The display text.
nTextOffset
[in] Distance, in pixels, from the left side of the list box to the display text.
rect
[in] The display rectangle for the CMFCRibbonEdit
control.
bIsSelected
[in] This parameter is not used.
bHighlighted
[in] This parameter is not used.
The commands list box displays ribbon controls to enable users to customize the quick access toolbar.
Called by the framework to enable or disable the CMFCRibbonEdit control.
virtual void OnEnable(BOOL bEnable);
bEnable
[in] TRUE to enable the control; FALSE to disable the control.
Called by the framework when the pointer enters or leaves the bounds of the CMFCRibbonEdit control.
virtual void OnHighlight(BOOL bHighlight);
bHighlight
[in] TRUE if the pointer is in the bounds of the CMFCRibbonEdit
control; otherwise, FALSE.
Called by the framework when the user presses a keytip and the CMFCRibbonEdit control has the focus.
virtual BOOL OnKey(BOOL bIsMenuKey);
bIsMenuKey
[in] TRUE if the keytip displays a pop-up menu; otherwise, FALSE.
TRUE if the event was handled; otherwise, FALSE.
Called by the framework to update the CMFCRibbonEdit control when the user presses the left mouse button on the control.
virtual void OnLButtonDown(CPoint point);
point
[in] This parameter is not used.
Called by the framework when the user releases the left mouse button.
virtual void OnLButtonUp(CPoint point);
point
[in] This parameter is not used.
Called by the framework to update the CMFCRibbonEdit control when the layout changes direction.
virtual void OnRTLChanged(BOOL bIsRTL);
bIsRTL
[in] TRUE if the layout is right-to-left; FALSE if the layout is left-to-right.
Called by the framework to show or hide the CMFCRibbonEdit control.
virtual void OnShow(BOOL bShow);
bShow
[in] TRUE to show the control; FALSE to hide the control.
Updates the display of the CMFCRibbonEdit control.
virtual void Redraw();
This method redraws the display rectangle for the CMFCRibbonEdit
object by indirectly calling CWnd::RedrawWindow with the RDW_INVALIDATE, RDW_ERASE, and RDW_UPDATENOW flags set.
Sets the accessibility data for the CMFCRibbonEdit object.
virtual BOOL SetACCData(
CWnd* pParent,
CAccessibilityData& data);
pParent
Pointer to the parent window for the CMFCRibbonEdit
object.
data
The accessibility data for the CMFCRibbonEdit
object.
Always returns TRUE.
Sets the text in the text box.
void SetEditText(CString strText);
strText
[in] The text for the text box.
Sets the text alignment of the text box.
void SetTextAlign(int nAlign);
nAlign
[in] A text alignment enumerated value. See the Remarks section for possible values.
The parameter nAlign is one of the following edit control styles:
ES_LEFT for left alignment
ES_CENTER for center alignment
ES_RIGHT for right alignment
For more information about these styles, see Edit Control Styles.
Sets the width of the text box for the CMFCRibbonEdit control.
void SetWidth(
int nWidth,
BOOL bInFloatyMode = FALSE);
nWidth
[in] The width, in pixels, of the text box.
bInFloatyMode
TRUE to set the width for floating mode; FALSE to set the width for regular mode.
The CMFCRibbonEdit
control has two widths depending on its display mode: floating mode and regular mode.
Hierarchy Chart
Classes
CMFCRibbonButton Class
CMFCRibbonBar Class