The "Parent" of a JBGrid is a JTable which knows ClientProperties.
Look at the following sample:
|
Jabaco Source
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
Option Explicit
Public Sub Form_Load()
Dim row As Integer
Dim col As Integer
Dim rowIndex As Integer = 2
Dim columnIndex As Integer = 3
JBGrid1.Parent.putClientProperty "JTable.autoStartsEdit", java#lang#Boolean.TRUE
JBGrid1.Cols = 4
JBGrid1.Rows = 16
JBGrid1.SelectionMode = flexSelectionFree
JBGrid1.Editable= jbEditOnClick
For row = 0 To JBGrid1.Rows - 1
For col = 0 To JBGrid1.Cols - 1
JBGrid1.DataMatrix(row, col) = row & ";" & col
JBGrid1.DataMatrix(row, col).CanGetFocus = True
JBGrid1.DataMatrix(row, col).Editable= True
JBGrid1.DataMatrix(row, col).Enabled= True
JBGrid1.DataMatrix(row, col).TextAlign= fmTextAlignCenter
Next col
Next row
JBGrid1.Refresh
JBGrid1.Parent.clearSelection()
JBGrid1.Parent.changeSelection(rowIndex, columnIndex, False, False)
JBGrid1.DataMatrix(rowIndex, columnIndex).Parent.requestFocus
JBGrid1.DataMatrix(rowIndex, columnIndex).SetFocus
Me.Refresh
End Sub
Public Sub JBGrid1_KeyPress(KeyAscii As Integer)
Debug.Print "KeyPress " & KeyAscii
End Sub
Public Sub JBGrid1_KeyDown(KeyCode As Integer, Shift As Integer)
Debug.Print "KeyDown " & KeyCode & " " & Shift
End Sub
|
It probably takes some event handling to establish proper keyboard handling.
Please post your findings.
Greetings
A1880