CGridListCtrlEx
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CGridEditorComboBox Class Reference

CComboBox for inplace edit. For internal use by CGridColumnTraitCombo. More...

Inheritance diagram for CGridEditorComboBox:

Public Member Functions

 CGridEditorComboBox (int nRow, int nCol, UINT nMaxWidthPixels, UINT nMaxHeightItems, BOOL bShowDropDown)
 CGridEditorComboBox - Constructor.
 
virtual BOOL Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID)
 Creates the CComboBox control, and subclasses the internal CEdit control to implement special behavior for completing cell value editing. More...
 
virtual void EndEdit (bool bSuccess)
 The cell value editor was closed and the entered should be saved. More...
 

Protected Member Functions

afx_msg void OnKillFocus (CWnd *pNewWnd)
 WM_KILLFOCUS message handler called when CComboBox is loosing focus to other control. More...
 
afx_msg void OnSetFocus (CWnd *pOldWnd)
 WM_SETFOCUS message handler called when CComboBox is receiving focus from other control. More...
 
afx_msg void OnDestroy ()
 WM_DESTROY message handler called when CComboBox window is about to be destroyed. More...
 
afx_msg void OnDropDown ()
 CBN_DROPDOWN message handler called when the CComboBox control is expanded into a dropdown list. More...
 
afx_msg void OnCloseUp ()
 CBN_CLOSEUP message handler called when the CComboBox control dropdown list is closed up. More...
 
afx_msg void OnChangeSelection ()
 CBN_SELCHANGE, CBN_SELENDOK message handler called when the selection in the CComboBox control has been modified. More...
 
afx_msg void OnChar (UINT nChar, UINT nRepCnt, UINT nFlags)
 WM_CHAR message handler to monitor selection modifications. More...
 
virtual void PostNcDestroy ()
 Called by the default OnNcDestroy (WM_NCDESTROY) message handler, when CComboBox window has been be destroyed. More...
 
virtual BOOL PreTranslateMessage (MSG *pMsg)
 Hook to proces windows messages before they are dispatched. More...
 
 DECLARE_MESSAGE_MAP ()
 

Protected Attributes

CGridEditorComboBoxEdit m_Edit
 Subclassed edit control inside the CComboBox.
 
bool m_Completed
 Ensure the editor only reacts to a single close event.
 
bool m_Modified
 Register if selection was modified while the editor was open.
 
int m_Row
 The index of the row being edited.
 
int m_Col
 The index of the column being edited.
 
UINT m_MaxWidthPixels
 Max width (in pixels) of the CComboBox when doing dropdown.
 
UINT m_MaxHeightItems
 Max height (in items) of the CComboBox when doing dropdown.
 
BOOL m_ShowDropDown
 Show drop down of the CComboBox at edit begin.
 

Detailed Description

CComboBox for inplace edit. For internal use by CGridColumnTraitCombo.

Member Function Documentation

BOOL CGridEditorComboBox::Create ( DWORD  dwStyle,
const RECT &  rect,
CWnd *  pParentWnd,
UINT  nID 
)
virtual

Creates the CComboBox control, and subclasses the internal CEdit control to implement special behavior for completing cell value editing.

Parameters
dwStyleSpecifies the style of the combo box
rectPoints to the position and size of the combo box
pParentWndpecifies the combo box's parent window. It must not be NULL.
nIDSpecifies the combo box's control ID.
void CGridEditorComboBox::EndEdit ( bool  bSuccess)
virtual

The cell value editor was closed and the entered should be saved.

Parameters
bSuccessShould the entered cell value be saved
void CGridEditorComboBox::OnChangeSelection ( )
protected

CBN_SELCHANGE, CBN_SELENDOK message handler called when the selection in the CComboBox control has been modified.

void CGridEditorComboBox::OnChar ( UINT  nChar,
UINT  nRepCnt,
UINT  nFlags 
)
protected

WM_CHAR message handler to monitor selection modifications.

Parameters
nCharSpecifies the virtual key code of the given key.
nRepCntRepeat count (the number of times the keystroke is repeated as a result of the user holding down the key).
nFlagsSpecifies the scan code, key-transition code, previous key state, and context code
void CGridEditorComboBox::OnCloseUp ( )
protected

CBN_CLOSEUP message handler called when the CComboBox control dropdown list is closed up.

void CGridEditorComboBox::OnDestroy ( )
protected

WM_DESTROY message handler called when CComboBox window is about to be destroyed.

Used to unsubclass the internal CEdit control.

void CGridEditorComboBox::OnDropDown ( )
protected

CBN_DROPDOWN message handler called when the CComboBox control is expanded into a dropdown list.

Used to restrict the width of the dropdown list to the max width.

void CGridEditorComboBox::OnKillFocus ( CWnd *  pNewWnd)
protected

WM_KILLFOCUS message handler called when CComboBox is loosing focus to other control.

Used register that cell value editor should close.

Parameters
pNewWndPointer to the window that receives the input focus (may be NULL or may be temporary).
void CGridEditorComboBox::OnSetFocus ( CWnd *  pOldWnd)
protected

WM_SETFOCUS message handler called when CComboBox is receiving focus from other control.

Used to display drop down automatically

Parameters
pOldWndContains the CWnd object that loses the input focus (may be NULL).
void CGridEditorComboBox::PostNcDestroy ( )
protectedvirtual

Called by the default OnNcDestroy (WM_NCDESTROY) message handler, when CComboBox window has been be destroyed.

Used to delete the inplace CComboBox editor object as well. This is necessary when the CComboBox is created dynamically.

BOOL CGridEditorComboBox::PreTranslateMessage ( MSG *  pMsg)
protectedvirtual

Hook to proces windows messages before they are dispatched.

Catch keyboard events that can should cause the cell value editor to close

Parameters
pMsgPoints to a MSG structure that contains the message to process
Returns
Nonzero if the message was translated and should not be dispatched; 0 if the message was not translated and should be dispatched.