Share via


CComboBox::SetCueBanner

Sets the cue text that is displayed for a combo box control.

BOOL SetCueBanner(
     LPCTSTR lpszText
);

Parameters

Parameter

Description

[in] lpszText

Pointer to a null-terminated buffer that contains the cue text.

Return Value

true if the method is successful; otherwise, false.

Remarks

Cue text is a prompt that is displayed in the input area of the combo box control. The cue text is displayed until the user provides input.

This method sends the CB_SETCUEBANNER message, which is described in the Windows SDK.

Requirements

Header: afxwin.h

This method is supported in Windows Vista and later.

Additional requirements for this method are described in Build Requirements for Windows Vista Common Controls.

Example

The following code example defines the variable, m_combobox, that is used to programmatically access the combo box control. This variable is used in the next example.

    // Variable to access the combo box control
    CComboBox m_combobox;

The following code example sets the cue banner for the combo box control.

    // Add extra initialization here.

    // Add 20 items to the combo box. The Resource Editor
    // has already been used to set the style of the combo
    // box to CBS_SORT.
    CString str;
    for (int i = 1; i <= 20; i++)
    {
        str.Format(_T("Item %2d"), i); 
        m_combobox.AddString(str);
    }
    // Set the minimum visible item
    m_combobox.SetMinVisibleItems( 10 );
    // Set the cue banner
    m_combobox.SetCueBanner(_T("Select an item..."));

    // End of extra initialization.

See Also

Reference

CComboBox Class

Hierarchy Chart

CComboBox::GetCueBanner

CB_SETCUEBANNER

Other Resources

CComboBox Members