Spread Windows Forms 17
Spread Windows Forms 17.0 Product Documentation / Developer's Guide / Touch Support with the Component / Using Touch Support / Using Touch Support with InputMan Cells
In This Topic
    Using Touch Support with InputMan Cells
    In This Topic

    You can use touch support with GcDateTime and GcTextBox cells.

    You can tap side buttons in the cells to change the cell values.

    Touch support with GcDateTime and GcTextBox cells

    Using Code

    The following example creates side buttons for GcDateTime cells and a GcTextBox cell. The DropDownOpening event has a ByTouch property that returns whether the drop-down button was opened with a touch gesture.

    CS
    Copy Code
    GrapeCity.Win.Spread.InputMan.CellType.SideButtonInfo testbutton = new GrapeCity.Win.Spread.InputMan.CellType.SideButtonInfo();
    testbutton.Behavior = GrapeCity.Win.Spread.InputMan.CellType.SideButtonBehavior.SpinDown;
    testbutton.Delay = 300;
    testbutton.Interval = 5;
    testbutton.Text = "1";
    
    GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType dateCellType = new GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType();
    dateCellType.SideButtons.Add(new GrapeCity.Win.Spread.InputMan.CellType.SideButtonInfo() { Text = "A" });
    this.fpSpread1_Sheet1.Columns[0].CellType = dateCellType;
    
    GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType textCellType = new GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType();
    textCellType.SideButtons.Add(new GrapeCity.Win.Spread.InputMan.CellType.SideButtonInfo() { Text = "B" });
    this.fpSpread1_Sheet1.Columns[1].CellType = textCellType;
    
    GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType dateCellType2 = new GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType();
    dateCellType2.SideButtons.Add(testbutton);
    this.fpSpread1_Sheet1.Columns[2].CellType = dateCellType2;
    
    void IMCellType_DropDownOpening(object sender, GrapeCity.Win.Spread.InputMan.CellType.DropDownOpeningEventArgs e)
            {
               
               listBox1.Items.Add(e.ByTouch.ToString());
            }
    
            private void fpSpread1_EditModeOn(object sender, EventArgs e)
            {
                if (fpSpread1.EditingControl is GrapeCity.Win.Spread.InputMan.CellType.GcDateTime)
                    ((GrapeCity.Win.Spread.InputMan.CellType.GcDateTime)fpSpread1.EditingControl).DropDownOpening += new EventHandler(IMCellType_DropDownOpening);
            }
    
            private void fpSpread1_EditModeOff(object sender, EventArgs e)
            {
                if (fpSpread1.EditingControl is GrapeCity.Win.Spread.InputMan.CellType.GcDateTime)
                    ((GrapeCity.Win.Spread.InputMan.CellType.GcDateTime)fpSpread1.EditingControl).DropDownOpening -= new EventHandler(IMCellType_DropDownOpening);
            }
    
    VB
    Copy Code
    Dim testbutton As New GrapeCity.Win.Spread.InputMan.CellType.SideButtonInfo()
    testbutton.Behavior = GrapeCity.Win.Spread.InputMan.CellType.SideButtonBehavior.SpinDown
    testbutton.Delay = 300
    testbutton.Interval = 5
    testbutton.Text = "1"
    
    Dim dateCellType As New GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType()
    dateCellType.SideButtons.Add(New GrapeCity.Win.Spread.InputMan.CellType.SideButtonInfo() With {.Text = "A"})
    fpSpread1_Sheet1.Columns(0).CellType = dateCellType
    
    Dim textCellType = New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
    textCellType.SideButtons.Add(New GrapeCity.Win.Spread.InputMan.CellType.SideButtonInfo() With {.Text = "B"})
    fpSpread1_Sheet1.Columns(1).CellType = textCellType
    
    Dim dateCellType2 As New GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType()
    dateCellType2.SideButtons.Add(testbutton)
    fpSpread1_Sheet1.Columns(2).CellType = dateCellType2
    
    Private Sub IMCellType_DropDownOpening(ByVal sender As Object, ByVal e As GrapeCity.Win.Spread.InputMan.CellType.DropDownOpeningEventArgs)
            ListBox1.Items.Add(e.ByTouch.ToString())
        End Sub
    
        Private Sub fpSpread1_EditModeOff(sender As Object, e As EventArgs) Handles fpSpread1.EditModeOff
            If TypeOf (fpSpread1.EditingControl) Is GrapeCity.Win.Spread.InputMan.CellType.GcDateTime Then
                RemoveHandler CType(fpSpread1.EditingControl, GrapeCity.Win.Spread.InputMan.CellType.GcDateTime).DropDownOpening, AddressOf IMCellType_DropDownOpening
            End If
        End Sub
    
        Private Sub fpSpread1_EditModeOn(sender As Object, e As EventArgs) Handles fpSpread1.EditModeOn
            If TypeOf (fpSpread1.EditingControl) Is GrapeCity.Win.Spread.InputMan.CellType.GcDateTime Then
                AddHandler CType(fpSpread1.EditingControl, GrapeCity.Win.Spread.InputMan.CellType.GcDateTime).DropDownOpening, AddressOf IMCellType_DropDownOpening
            End If
        End Sub
    
    See Also