Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example creates a sheet that has a second column of combo box cells. The combo box cells provide a list of items the user can select from, or the user can type into the combo box edit field. The combo box limits content to 10 characters or less. Only the active combo box cell in the column displays its drop-down button. The contents of the edit field for the combo boxes are vertically centered in the cell.

C++

void CmyWnd::MyFunc()
{
    // Specify the second column as combo box cells
    fpSpread1.SetRow(-1);
    fpSread1.SetCol(2);
    fpSpread1.SetCellType(CellTypeComboBox);
    // Display the button in the current cell only
    fpSpread1.SetButtonDrawMode(ButtonDrawModeCurrentCell);
    // Allow up to 10 characters in the edit field
    fpSpread1.SetTypeMaxEditLen(10);
    // Center the text in the edit field vertically
    fpSpread1.SetTypeVAlign(TypeVAlignCenter);
    // Let users type text in the edit field
    fpSpread1.SetTypeComboBoxEditable(True);
    // Provide a drop-down list for the combo box
    fpSpread1.SetTypeComboBoxList("North\tSouth\tEast\tWest");
}

Visual Basic

Sub Form_Load()
    ' Specify the second column as combo box cells
    fpSpread1.Col = 2
    fpSpread1.Row = -1
    fpSpread1.CellType = CellTypeComboBox
    ' Display the button in the current cell only
    fpSpread1.ButtonDrawMode = ButtonDrawModeCurrentCell
    ' Allow up to 10 characters in the edit field
    fpSpread1.TypeMaxEditLen = 10
    ' Center the text in the edit field vertically
    fpSpread1.TypeVAlign = TypeVAlignCenter
    ' Let users type text in the edit field
    fpSpread1.TypeComboBoxEditable = True
    ' Provide a drop-down list for the combo box
    fpSpread1.TypeComboBoxList = "North" + Chr$(9) + "South" + Chr$(9) + "East" + Chr$(9) + "West"
End Sub

Copyright © GrapeCity, inc. All rights reserved.