Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example creates a sheet with a combo box list in cell B2. One command button will clear the list. Another command button will delete one list item at a time.

C++

void CTestDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{

    m_Command1.SetWindowText("Clear List");
    m_Command1.SetWindowText ("Delete Item");
    m_Spread1.SetRow(2);
    m_Spread1.SetCol(2);
    m_Spread1.SetCellType(CellTypeComboBox);
    m_Spread1.SetTypeComboBoxList("Item1\tItem2\tItem3");
}

void CTestDlg::OnButton1()
{
    m_Spread.TypeComboBoxClear(2, 2);
}

    void CTestDlg::OnButton2()
{
    int nItem;
    nItem = m_Spread1.GetTypeComboBoxIndex()
    m_Spread1.TypeComboBoxRemoveItem(2, 2, nItem);
}

Visual Basic

Private Sub Command1_Click()
    fpSpread1.TypeComboBoxClear 2, 2
End Sub

Private Sub Command2_Click()
    Dim Item As Integer
    Item = fpSpread1.TypeComboBoxIndex
    fpSpread1.TypeComboBoxRemoveItem 2, 2, Item
End Sub

Private Sub Form_Load()
    Command1.Caption = "Clear List"
    Command2.Caption = "Delete Item"
    fpSpread1.Col = 2
    fpSpread1.Row = 2
    fpSpread1.CellType = CellTypeComboBox
    fpSpread1.TypeComboBoxList = "Item1" & Chr(9) & "Item2" & Chr(9) & "Item3"
End Sub

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.