Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example changes the action key settings for the control. Users cannot clear values by pressing F2. Users can put the current date or time in a date or time cell by pressing Ctrl+D, and they can display the pop-up calendar for a date cell by pressing Ctrl+P.

C++

void CmyWnd::MyFunc()
{
    // Declare variables for method return value
    bool ClearX,CurrentX,PopUpX;

    // Specify cell A1 as date cell
    m_Spread1.SetCol(1);
    m_Spread1.SetRow(1);
    m_Spread1.SetCellType(CellTypeDate);

    // Turn off the Clear action
    ClearX = m_Spread1.SetActionKey(ActionKeyClear, False, False, 0);
    // Display current date/time when the user presses Ctrl+D
    CurrentX = m_Spread1.SetActionKey(ActionKeyCurrent, False, True, 68);
    // Display pop-up calendar when the user presses Ctrl+P
    PopUpX = m_Spread1.SetActionKey(ActionKeyPopup, False, True, 80);
}

Visual Basic

Sub Form_Load()
    ' Declare variables for method return value
    Dim ClearX As Boolean
    Dim CurrentX As Boolean, PopUpX As Boolean

    ' Specify cell A1 as date cell
    fpSpread1.Col = 1
    fpSpread1.Row = 1
    fpSpread1.CellType = CellTypeDate

    ' Turn off the Clear action
    ClearX = fpSpread1.SetActionKey(ActionKeyClear, False, False, 0)
    ' Display current date/time when the user presses Ctrl+D
    CurrentX = fpSpread1.SetActionKey(ActionKeyCurrent, False, True, 68)
    ' Display pop-up calendar when the user presses Ctrl+P
    PopUpX = fpSpread1.SetActionKey(ActionKeyPopup, False, True, 80)
End Sub

Copyright © GrapeCity, inc. All rights reserved.