GrapeCity Forums

The GrapeCity Message Boards
Welcome to GrapeCity Forums Sign in | Join | Help
in Search

Left, right, down and up arrow keys

Last post 08-03-2010, 10:22 AM by lg_sony_27. 3 replies.
Sort Posts: Previous Next
  •  07-31-2010, 10:14 AM 91420

    Left, right, down and up arrow keys

    Hi, I've been wantitng to use the arrow keys in my app but cant seem to do it right.  right now, I can use the up and down arrow keys (edit mode) but the the left and right are not working.

    Private Sub FpSpread1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles FpSpread1.KeyPress

    'Map the enter key

    Dim im As FarPoint.Win.Spread.InputMap

    Dim im2 As FarPoint.Win.Spread.InputMap

    im = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused)

    im2 = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused)

    im.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow)

    im2.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow)

    im2.Put(New FarPoint.Win.Spread.Keystroke(Keys.Delete, Keys.None), FarPoint.Win.Spread.SpreadActions.ClearSelectedCells)

    End Sub

     

    Private Sub FpSpread1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles FpSpread1.KeyDown

    'For delete and backspace keys

    If e.KeyCode = Keys.Delete Or e.KeyCode = Keys.Back Then

    FpSpread1.ActiveSheet.Cells(FpSpread1.ActiveSheet.ActiveRowIndex, FpSpread1.ActiveSheet.ActiveColumnIndex).Value = Nothing

    End If

    Flag = True

    End Sub

  •  08-01-2010, 10:17 AM 91421 in reply to 91420

    Re: Left, right, down and up arrow keys

    tried the code below in Form-Load event and I got this error "The index 1 is not between 0 and 1."  I have 18 sheets.

    Dim num As New FarPoint.Win.Spread.CellType.NumberCellType

    num.AcceptsArrowKeys = FarPoint.Win.SuperEdit.AcceptsArrowKeys.None

    Dim num1 As New FarPoint.Win.Spread.CellType.GeneralCellType

    num1.AcceptsArrowKeys = FarPoint.Win.SuperEdit.AcceptsArrowKeys.None

    With FpSpread1

    .Sheets(0).DefaultStyle.CellType = num

    .Sheets(1).DefaultStyle.CellType = num

    '.Sheets(2).DefaultStyle.CellType = num

    '.Sheets(3).DefaultStyle.CellType = num

    .Sheets(12).DefaultStyle.CellType = num

    .Sheets(12).Columns(120).CellType = num1

    End With

  •  08-02-2010, 9:12 AM 91429 in reply to 91421

    Re: Left, right, down and up arrow keys

    Hello,

    I used the below code during form load event and it seems to be working fine for all the sheets.

     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            FpSpread1.Sheets.Count = 18
            Dim num As New FarPoint.Win.Spread.CellType.NumberCellType
            num.AcceptsArrowKeys = FarPoint.Win.SuperEdit.AcceptsArrowKeys.None
            Dim num1 As New FarPoint.Win.Spread.CellType.GeneralCellType
            num1.AcceptsArrowKeys = FarPoint.Win.SuperEdit.AcceptsArrowKeys.None
            With FpSpread1
                .Sheets(0).DefaultStyle.CellType = num
                .Sheets(1).DefaultStyle.CellType = num
                .Sheets(2).DefaultStyle.CellType = num
                .Sheets(3).DefaultStyle.CellType = num
                .Sheets(12).DefaultStyle.CellType = num
                .Sheets(12).Columns(120).CellType = num1
            End With
        End Sub

    Please let me know if I am missing something, also test the same with the latest version of Spread for windows forms.

    Thanks,

     


    Deepak Sharma
    GrapeCity FarPoint
  •  08-03-2010, 10:22 AM 91447 in reply to 91429

    Re: Left, right, down and up arrow keys

    I think I may have found the reason why i am getting the error. It's because I put the code before I call sub myformat() which contains these codes

            With FpSpread1
                '.EnableCrossSheetReference = False
                .AllowDragFill = True
                .AllowUserFormulas = True
                .EditModeReplace = True
                .AutoClipboard = True
                .Sheets.Count = 18
                .Sheets(0).SheetName = "1stGrading"
                .Sheets(1).SheetName = "2ndGrading"
                .Sheets(2).SheetName = "1-2Deliberation"
                .Sheets(3).SheetName = "3rdGrading"
                .Sheets(4).SheetName = "1-3Deliberation"
                .Sheets(5).SheetName = "4thGrading"
                .Sheets(6).SheetName = "FinalGrade"
                .Sheets(7).SheetName = "Conduct1st"
                .Sheets(8).SheetName = "Conduct2nd"
                .Sheets(9).SheetName = "Conduct3rd"
                .Sheets(10).SheetName = "Conduct4th"
                .Sheets(11).SheetName = "ConductFinal"
                .Sheets(12).SheetName = "RHGP1st"
                .Sheets(13).SheetName = "RHGP2nd"
                .Sheets(14).SheetName = "RHGP3rd"
                .Sheets(15).SheetName = "RHGP4th"
                .Sheets(16).SheetName = "RHGPFinal"
                .Sheets(17).SheetName = "Attendance"
            End With

     

    I am doing this in Form_Load that's why I am getting the error. sub myformat() should come first before acceptarrowkeys.

    num.AcceptsArrowKeys = FarPoint.Win.SuperEdit.AcceptsArrowKeys.None
    num1.AcceptsArrowKeys = FarPoint.Win.SuperEdit.AcceptsArrowKeys.None
       With FpSpread1
          .Sheets(0).DefaultStyle.CellType = num
          .Sheets(1).DefaultStyle.CellType = num
          .Sheets(2).DefaultStyle.CellType = num
          .Sheets(3).DefaultStyle.CellType = num
          .Sheets(12).DefaultStyle.CellType = num
          .Sheets(12).Columns(120).CellType = num1
       End With
       myformat()

View as RSS news feed in XML
     FarPoint Forums Home