SSSetTypeComboBoxEx Function
Applies To
fpSpread DLL control
Description
Sets the style, list items, drop-down list display, edit field maximum characters, and optional control to display for the drop-down list for combo box cells.
Syntax
LPSS_CELLTYPE SSSetTypeComboBoxEx(HWND hWnd, LPSS_CELLTYPE lpCellType, long Style, LPCTSTR lpItems, short dMaxRows, short dMaxEditLen, short dComboWidth, HWND hWndDropDown, BYTE bAutoSearch);
LPSS_CELLTYPE TSpread::SetTypeComboBoxEx(LPSS_CELLTYPE lpCellType, long Style, LPCTSTR lpItems, short dMaxRows, short dMaxEditLen, short dComboWidth, HWND hWndDropDown, BYTE bAutoSearch);
Parameters
The following parameters are available:
Parameter | Description | |
---|---|---|
hWnd | Window handle of the fpSpread control | |
lpCellType | Pointer to structure to contain cell type information | |
Style | Combo box style Use the (|) OR operator and combine the following values as indicated: |
|
Constant | Description | |
SS_CB_DROPDOWN | Allows user to edit text portion of combo box (If this style is not used, the text portion is static.) |
|
Use one of the following values: | ||
SSS_ALIGN_TOP | (Default) Aligns text at the top of cells | |
SSS_ALIGN_BOTTOM | Aligns text at the bottom of cells | |
SSS_ALIGN_VCENTER | Centers text vertically within the cell | |
Use one of the following values: | ||
SSS_ALIGN_LEFT | (Default) Aligns text to the left in the cell | |
SSS_ALIGN_RIGHT | Aligns text to the right in the cell | |
SSS_ALIGN_CENTER | Centers text horizontally within the cell | |
lpItems | List of items to display (The string should be formatted with tab-delimited items.) |
|
dMaxRows | Specifies the number of rows to display in the drop-down list | |
dMaxEditLen | Specifies the maximum number of characters of text that the user can enter in the edit field | |
dComboWidth | Specifies the width of the drop-down list Set this parameter as follows: |
|
Setting | Description | |
0 - Cell Width | Sets the width to the current width of the cell | |
Constant: SS_COMBOWIDTH_CELLWIDTH | ||
1 - Widest Item | Sets the width to display the longest line of text in the drop-down list and aligns the list according to the description in the "Remarks" section | |
Constant: SS_COMBOWIDTH_AUTORIGHT | ||
–n - Right Justify | Sets the width, n, where n is a negative number less than –1, of the drop-down list and right aligns the list to the selection box | |
n - Width | Sets the width, n, where n is a positive number greater than 1, of the drop-down list and aligns the list according to the description in the "Remarks" section | |
–1 | Right justifies the drop-down list to the selection box and sets the width to display the longest line of text in the drop-down list | |
Constant: SS_COMBOWIDTH_AUTOLEFT | ||
hWndDropDown | Specifies the window handle of the control to use as the drop-down list | |
bAutoSearch | Specifies the type of search the user can perform when searching for a specific list item when the SS_CB_DROPDOWN style is not specified. | |
Setting | Description | |
0 - None | Removes the searching capability | |
Constant: SS_COMBOBOX_AUTOSEARCH_NONE | ||
1 - Single Char | (Default) Lets the user type a single search character | |
Constant: SS_COMBOBOX_AUTOSEARCH_SINGLECHAR | ||
2 - Multiple Char | Lets the user type more than one search character | |
Constant: SS_COMBOBOX_AUTOSEARCH_MULTIPLECHAR | ||
3 - Single Char (Greater or Equal) | Lets the user type a single search character and, if the search character is not found, moves to the next item starting with a greater character | |
Constant: SS_COMBOBOX_AUTOSEARCH_SINGLECHARGREATER |
Remarks
This function is applied to the current sheet setting unless you first call the SSSetSheet function to specify the sheet for which you are calling this function.
This function initializes a structure of the specified type (SS_CELLTYPE). You can use this structure to set an individual cell or block of cells using the SSSetCellType or SSSetCellTypeRange functions.
Call this function instead of the SSSetTypeComboBox function if you want to specify one of the following features for the combo box cell:
-
The maximum number of rows in the drop-down list.
The dMaxRows parameter specifies how many rows the drop-down list displays. If the list contains fewer rows than the setting of this property, the list will only display the rows that contain data. For example, if the list only contains three items, and this property is set to its default value of six, the drop-down list only displays three items.
-
The maximum number of characters allowed in the edit field.
A beep sounds to notify the user when the maximum number of characters is reached (unless you have called the SSSetBool function and set the SSB_NOBEEP boolean to TRUE), and the control prevents the user from typing more characters. If the user tries to paste in a value with more characters than the allowed amount, or such a value is provided through code, the value is truncated to the number of allowed characters.
- The width and display of the drop-down list.
-
A different control to display as the combo box drop-down list.
You can enhance the combo box cell provided with the fpSpread control by having the fpCombo control in our List ProTM product (version 2.1 and later) display as the drop-down list.
-
The type of search the user can perform when searching for a specific list item.
Note: The auto search feature works only in non-editable combo box cells, that is, when the SS_CB_DROPDOWN style is not specified for the cell. Typing a character initiates a search for the first item that begins with that character. If the item found is not visible in the list, the control scrolls to the first item that matches that character or characters. The control highlights the found item. If the search character is not found and the setting is 1 (SS_COMBO_AUTOSEARCH_SINGLECHAR), no item is highlighted. If the setting is 2 (SS_COMBO_AUTOSEARCH_MULTIPLECHAR), the selection highlighting moves to the closest available match for the search string as the characters are entered (for example, to highlight "Variegated" type "var"). If none of the items begin with the first character entered, the Spread control does not move the selection. If the setting is 3 (SS_COMBO_AUTOSEARCH_SINGLECHARGREATER), the Spread control highlights the next greater item if the search character is not found. For example, the first item starting with the letter "g" will be highlighted if the user searched for the letter "f" and none of the items begin with that letter. For example, assume control is displays five rows. List item "Willow Springs" is in row 10 and "Wilmington" is in row 20. When you type the letter "w", the list scrolls to "Willow Springs". When you type the letters "i" and then "l", nothing changes. If the fourth letter you type is "m", the list will scroll to "Wilmington". If the fourth letter you type is "z" (no match is found), the list scrolls so that the first row is the top row in the list.
If you want to display an empty list in the combo box, you must pass in a NULL pointer to the lpItems parameter. If instead the parameter points to an empty string, the function adds one blank item to the combo box.
The justification of the drop-down list is determined by the setting of the dComboWidth parameter as follows:
-
The drop-down list is left-justified when the following are true:
dComboWidth parameter value is . . . and the Cell width is . . . 1 < longest line in the drop-down list >1 < longest line in the drop-down list -
The drop-down list is right-justified when the following are true:
dComboWidth parameter value is . . . and the Cell width is . . . 1 > longest line in the drop-down list >1 > longest line in the drop-down list –1 no effect <–1 no effect
Return Value
Pointer to the SS_CELLTYPE structure, or NULL if any of the parameters are invalid.
See Also
Creating and Setting up a Combo Box Cell
Creating a Combo Box Cell Using the FarPoint fpCombo Control
Specifying the Width and Alignment of the Combo Box Drop-Down List
SSSetBool, SSSetCellType, SSSetCellTypeRange, SSSetSheet, SSSetTypeComboBox functions
ActiveX Correspondence
TypeComboBoxAutoSearch, TypeComboBoxCount, TypeComboBoxCurSel, TypeComboBoxEditable, TypeComboBoxhWnd, TypeComboBoxIndex, TypeComboBoxList, TypeComboBoxMaxDrop, TypeComboBoxString, TypeComboBoxWidth, TypeMaxEditLen properties