Intermediate
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
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 |
Option Explicit Public Sub JBGrid1_Click() MsgBox "clicked!" End Sub Public Sub Form_Load() Dim row As Integer Dim col As Integer Dim rowIndex As Integer = 2 Dim columnIndex As Integer = 3 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 |
Intermediate
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
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 JBGrid1_Click() Debug.Print "clicked!" End Sub Public Sub JBGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Debug.Print "Mouse Down " & JBGrid1.Parent.getSelectedRow & ";" & JBGrid1.Parent.getSelectedColumn End Sub Public Sub Form_Load() Dim row As Integer Dim col As Integer Dim rowIndex As Integer = 2 Dim columnIndex As Integer = 3 JBGrid1.Cols = 4 JBGrid1.Rows = 16 JBGrid1.RowHeightGlobal = 64 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 |
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
Option Explicit Implements java#awt#Event#MouseListener Public Sub JBGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Debug.Print "Mouse Down " & JBGrid1.Parent.getSelectedRow & ";" & JBGrid1.Parent.getSelectedColumn End Sub Public Sub Form_Load() Dim row As Integer Dim col As Integer Dim rowIndex As Integer = 2 Dim columnIndex As Integer = 3 JBGrid1.Parent.getTableHeader().addMouseListener(Me) JBGrid1.Parent.addMouseListener(Me) JBGrid1.Height =400 JBGrid1.Cols = 4 JBGrid1.Rows = 16 JBGrid1.RowHeightGlobal = 64 JBGrid1.SelectionMode = flexSelectionFree JBGrid1.Editable= jbNotEditable For row = 0 To JBGrid1.Rows - 1 For col = 0 To JBGrid1.Cols - 1 If JBGrid1.Header(JBGrid1.Cols - 1)= "" Then JBGrid1.Header(col) = col 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 mouseClicked(arg2 As MouseEvent) ' capture a single click on the table header for sorting! If arg2.getY < JBGrid1.HeaderHeight Then Debug.Print "header clicked " & JBGrid1.Header(JBGrid1.Parent.getColumnModel.getColumnIndexAtX(arg2.getX)) End If ' capture dblclick on rows you have to scroll to!! If arg2.getClickCount = 2 Then Debug.Print "dblclicked " & JBGrid1.Parent.getSelectedRow & ";" & JBGrid1.Parent.getSelectedColumn End Sub Public Sub mousePressed(arg2 As MouseEvent) End Sub Public Sub mouseReleased(arg2 As MouseEvent) End Sub Public Sub mouseEntered(arg2 As MouseEvent) End Sub Public Sub mouseExited(arg2 As MouseEvent) End Sub |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 |
Public Sub mouseClicked(arg2 As MouseEvent) ' capture a single click on the table header for sorting! ' If arg2.getY < JBGrid1.HeaderHeight Then If InStr(arg2.getComponent,"JTableHeader") Then Debug.Print "header clicked " & JBGrid1.Header(JBGrid1.Parent.getColumnModel.getColumnIndexAtX(arg2.getX)) End If ' capture dblclick on rows you have to scroll to!! If arg2.getClickCount = 2 Then Debug.Print "dblclicked " & JBGrid1.Parent.getSelectedRow & ";" & JBGrid1.Parent.getSelectedColumn End Sub |
Thanks A1880Quoted
Source code
1 2 3 4 5 Implements java#awt#Event#MouseListener Public Sub JBGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Debug.Print "Mouse Down " & JBGrid1.Parent.getSelectedRow & ";" & JBGrid1.Parent.getSelectedColumn End Sub and JBGrid1.SelectionMode = flexSelectionFree JBGrid1.Editable= jbNotEditable 'und diese Zeile ist besonders fies...aber aus irgend einem buggy Grund wohl nötig