Beginner
Jabaco JBGRID
Does anyone know if you can set focus on the JBGRID once the form loads? There does not seem to be a property to do that like .SetFocus
Is there maybe a general way to set focus on ANY component textbox, button, label etc?
Is there maybe a general way to set focus on ANY component textbox, button, label etc?
I am ROOT if you see me laughing you better have a backup!
Hi,
I've tried the following to answer you question:
It might inspire you for own experiments, but the code does not work.
To focus on a button, you simply write "Command1.Parent.requestFocus()", but I could not make that work for the JBGrid as a whole nor for a single DataMatrix element. Might be a misunderstanding on my side or a deficiency in the Jabaco framework.
Greetings!
A1880
I've tried the following to answer you question:
|
|
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 |
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 = 6 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 |
It might inspire you for own experiments, but the code does not work.
To focus on a button, you simply write "Command1.Parent.requestFocus()", but I could not make that work for the JBGrid as a whole nor for a single DataMatrix element. Might be a misunderstanding on my side or a deficiency in the Jabaco framework.
Greetings!
A1880
Beginner
Nope that was a perfect example. Same problem still. I will continue to experiment. I know the WINAPI have a function like this but i would like to stay away from WINAPI's as much as possible. And I have found a JAVA class thingy that will do the job. Just need to add it in somehow 
Thx for the suggestion though!

Thx for the suggestion though!
I am ROOT if you see me laughing you better have a backup!
The Parent of a JBGrid is a JTable.
The usual way of removing rows from a JTable is to go via its DefaultTableModel.
Unfortunately, the model of a JTable in Jabaco is a JBGridModel which hasn't got a DefaultTableModel.
Long answer short: I don't know how to remove rows from an existing JBGrid.
Recreating/redrawing might be the workaround for the time being.
Looking through the documentation of javax.swing I get more and more thankful that the Jabaco framework hides major parts of swing's complexity.
However, until the Jabaco framework gets more waterproof, one has to look underneath into low-level java APIs.
Cheers
A1880
The usual way of removing rows from a JTable is to go via its DefaultTableModel.
Unfortunately, the model of a JTable in Jabaco is a JBGridModel which hasn't got a DefaultTableModel.
Long answer short: I don't know how to remove rows from an existing JBGrid.
Recreating/redrawing might be the workaround for the time being.
Looking through the documentation of javax.swing I get more and more thankful that the Jabaco framework hides major parts of swing's complexity.
However, until the Jabaco framework gets more waterproof, one has to look underneath into low-level java APIs.
Cheers
A1880
Similar threads
-
General topics, questions and discussions »-
Multi-line jbgrid header
(Jun 25th 2009, 1:10pm)
-
General topics, questions and discussions »-
SQLITE 3 support
(Jan 29th 2009, 9:33am)
-
General topics, questions and discussions »-
get selected row or column
(Jun 18th 2009, 6:43pm)
-
General topics, questions and discussions »-
Accessing Excel Files
(Feb 3rd 2009, 1:34pm)
