CODListBoxComponent Class

class CODListBoxComponent: public CODControlComponent

This is a windowed component class that encapsulates a list box control. It overrides the  CODWndComponent::CreateWnd and creates an list box control.

This class contains a number of functions that are simple wrappers around Windows API functions that take a window handle. For complete documentation on the wrapper functions, consult the Windows API documentation.

Defined in: OdWndComp.h

Class Members

 CODListBoxComponent(const UINT nCtlID = 1)

Constructor.

 CODListBoxComponent(const CODListBoxComponent& src)

Copy constructor.

virtual  ~CODListBoxComponent()

Destructor.

virtual BOOL  CreateWnd(HWND hParent)

Creates and returns a window object to caller.

CODListBoxComponent&  operator=(const CODListBoxComponent& src)

Assignment operator.

virtual CODComponent*  Dup() const

Creates a copy of this component.

virtual void  Serialize(CArchive& ar)

Serializes the window component.

inline int GetCount() const

Returns the number of strings in a list box.

inline int GetHorizontalExtent() const

Returns the width in pixels that a list box can be scrolled horizontally.

inline void SetHorizontalExtent(int cxExtent)

Sets the width in pixels that a list box can be scrolled horizontally.

inline int GetTopIndex() const

Returns the index of the first visible string in a list box.

inline int SetTopIndex(int nIndex)

Sets the zero-based index of the first visible string in a list box.

inline LCID GetLocale() const

Retrieves the locale identifier for a list box.

inline LCID SetLocale(LCID nNewLocale)

Sets the locale identifier for a list box.

inline int InitStorage(int nItems, UINT nBytes)

Preallocates blocks of memory for list box items and strings.

inline UINT ItemFromPoint(POINT pt, BOOL& bOutside) const

Returns the index of the list-box item nearest a point.

inline int GetCurSel() const

Returns the zero-based index of the currently selected string in a list box.

inline int SetCurSel(int nSelect)

Selects a list-box string.

inline int GetSel(int nIndex) const

Returns the selection state of a list-box item.

inline int SetSel(int nIndex, BOOL bSelect = TRUE)

Selects or deselects a list-box item in a multiple-selection list box.

inline int GetSelCount() const

Returns the number of strings currently selected in a multiple-selection list box.

inline int GetSelItems(int nMaxItems, LPINT rgIndex) const

Returns the indices of the strings currently selected in a list box.

inline void SetAnchorIndex(int nIndex)

Sets the anchor in a multiple-selection list box to begin an extended selection.

inline int GetAnchorIndex() const

Retrieves the zero-based index of the current anchor item in a list box.

inline SEC_DWORD GetItemData(int nIndex) const

Returns the 32/64-bit value associated with the list-box item.

inline int SetItemData(int nIndex, SEC_DWORD dwItemData)

Sets the 32/64-bit value associated with the list-box item.

inline void* GetItemDataPtr(int nIndex) const

Returns a pointer to a list-box item.

inline int SetItemDataPtr(int nIndex, void* pData)

Sets a pointer to the list-box item.

inline int GetItemRect(int nIndex, LPRECT lpRect) const

Returns the bounding rectangle of the list-box item as it is currently displayed.

inline int GetText(int nIndex, LPTSTR lpszBuffer) const

Copies a list-box item into a buffer.

inline int GetTextLen(int nIndex) const

Returns the length in bytes of a list-box item.

inline void SetColumnWidth(int cxWidth)

Sets the column width of a multicolumn list box.

inline BOOL SetTabStops(int nTabStops, LPINT rgTabStops)

Sets the tab-stop positions in a list box.

inline BOOL SetTabStops()

Sets the tab-stop positions in a list box.

inline BOOL SetTabStops(const int& cxEachStop)

Sets the tab-stop positions in a list box.

inline int SetItemHeight(int nIndex, UINT cyItemHeight)

Sets the height of items in a list box.

inline int GetItemHeight(int nIndex) const

Determines the height of items in a list box.

inline int FindStringExact(int nIndexStart, LPCTSTR lpszFind) const

Finds the first list-box string that matches a specified string.

inline int GetCaretIndex() const

Determines the index of the item that has the focus rectangle in a multiple-selection list box.

inline int SetCaretIndex(int nIndex, BOOL bScroll = TRUE)

Sets the focus rectangle to the item at the specified index in a multiple-selection list box.

inline int AddString(LPCTSTR lpszItem)

Adds a string to a list box.

inline int DeleteString(UINT nIndex)

Deletes a string from a list box.

inline int InsertString(int nIndex, LPCTSTR lpszItem)

Inserts a string at a specific location in a list box.

inline void ResetContent()

Clears all the entries from a list box.

inline int Dir(UINT attr, LPCTSTR lpszWildCard)

Adds filenames from the current directory to a list box.

inline int FindString(int nStartAfter, LPCTSTR lpszItem) const

Searches for a string in a list box.

inline int SelectString(int nStartAfter, LPCTSTR lpszItem)

Searches for and selects a string in a single-selection list box.

inline int SelItemRange(BOOL bSelect, int nFirstItem, int nLastItem)

Selects or deselects a range of strings in a multiple-selection list box.