Defines whether the dropdown portion is sized to its optimal width.
C
BOOL WINAPI SftBox_GetDropDownOptimalWidth(HWND hwndCtl); void WINAPI SftBox_SetDropDownOptimalWidth(HWND hwndCtl, BOOL fSet);
C++
BOOL CSftBox::GetDropDownOptimalWidth() const; void CSftBox::SetDropDownOptimalWidth(BOOL fSet);
hwndCtl
The window handle of the combo box control.
fSet
Set to TRUE to size the dropdown portion to its optimal width, otherwise set to FALSE.
GetDropDownOptimalWidth returns TRUE if the dropdown portion is sized to its optimal width, otherwise FALSE is returned.
The GetDropDownOptimalWidth and SetDropDownOptimalWidth functions define whether the dropdown portion is sized to its optimal width.
By default, the dropdown portion is not sized to its optimal width (FALSE).
When the dropdown portion is shown, its width is normally determined by the width defined using SetDroppedWidth. If optimal width is enabled, the dropdown portion is made wide enough so the complete horizontal extent plus the row header width (see SetRowHeaderWidth) and, if needed, the vertical scroll bar can be displayed without horizontal scrolling. The dropdown portion is never made narrower than the width defined using SetDroppedWidth. Its width is limited so it does not extend beyond the monitor's work area.
The optimal width is based on the horizontal extent, which must be defined using SetHorizontalExtent or RecalcHorizontalExtent once the items have been added. If no horizontal extent is defined, SetDropDownOptimalWidth has no effect.
The setting is used the next time the dropdown portion of a dropdown or dropdown list combo box is shown. It has no effect on a simple combo box.
LONG index;
int i;
InitColumn(&aCols[0], 0, 100, TEXT("Color"));
InitColumn(&aCols[1], 1, 100, TEXT("Description"));
SftBox_SetColumns(hwndBox, 2, aCols);
SftBox_SetShowHeaderDropDown(hwndBox, TRUE);// Column titles in the dropdown only
SftBox_SetDroppedHeight(hwndBox, 12); // Show up to 12 items
SftBox_SetDropDownOptimalWidth(hwndBox, TRUE);// The dropdown is as wide as its columns
SftBox_SetDisableNoScroll(hwndBox, TRUE); // Scroll bars always shown, needed for the sizing box
SftBox_SetShowResizer(hwndBox, TRUE); // The user can resize the dropdown
SftBox_SetDarkMode(hwndBox, SFTBOX_DARKMODE_AUTO);
// Register the size of the cell pictures before adding items.
// All pictures in the cells of a control are the same size.
{
SFTBOX_COLUMN aCols[2];
LONG index;
InitColumn(&aCols[0], 0, 100, _T("Color"));
InitColumn(&aCols[1], 1, 100, _T("Description"));
box.SetColumns(2, aCols);
box.SetShowHeaderDropDown(TRUE); // Column titles in the dropdown only
box.SetDroppedHeight(12); // Show up to 12 items
box.SetDropDownOptimalWidth(TRUE); // The dropdown is as wide as its columns
box.SetDisableNoScroll(TRUE); // Scroll bars always shown, needed for the sizing box
box.SetShowResizer(TRUE); // The user can resize the dropdown
box.SetDarkMode(SFTBOX_DARKMODE_AUTO);
// Register the size of the cell pictures before adding items.
// All pictures in the cells of a control are the same size.
{See Also C/C++ API | Categories | Notifications