Tab Sequence
Hi,
I have a data entry form on which I am trying to set the tab sequence. By default it is going forwards through the controls - top to bottom, left to right - which is a good starting point. What I want to do is to omit things like labels from the tab sequence. I can't find a way to do this. There doesn't seem to be a TabIndex property on the controls.
Any help much appreciated!
Rgds
Roger L
ps I am rediscovering VB6 as a great environment - but even more powerful when backed by Java - have used SQLite up until now but H2 is quite something!
I have a data entry form on which I am trying to set the tab sequence. By default it is going forwards through the controls - top to bottom, left to right - which is a good starting point. What I want to do is to omit things like labels from the tab sequence. I can't find a way to do this. There doesn't seem to be a TabIndex property on the controls.
Any help much appreciated!
Rgds
Roger L
ps I am rediscovering VB6 as a great environment - but even more powerful when backed by Java - have used SQLite up until now but H2 is quite something!
Hi,
Suprised there was no-one who could help me on what I thought was a fairly simple and basic, but important, topic in the usability of data entry screens, I have managed to roughly solve my problem by using the 'CanGetFocus' property of the controls on my screen - but its not exactly what I wanted and I'm sure there must be a better way. I guess I must investigate Swing a little more - but surely I won't have to drop back to java code for this!
Roger L
Suprised there was no-one who could help me on what I thought was a fairly simple and basic, but important, topic in the usability of data entry screens, I have managed to roughly solve my problem by using the 'CanGetFocus' property of the controls on my screen - but its not exactly what I wanted and I'm sure there must be a better way. I guess I must investigate Swing a little more - but surely I won't have to drop back to java code for this!
Roger L
Yes, you are right. There is probably no easy solution.
I've found the following link on Swing Focus Traversal Policy.
It look like a major extension to the Jabaco framework to get this implemented.
Comparing the simple Tabindex approach of VB6 to the convoluted solution of Swing,
I consider this another example for why Swing should be hidden from 95% of all developers.
Please let us know your solution.
Greetings
A1880
I've found the following link on Swing Focus Traversal Policy.
It look like a major extension to the Jabaco framework to get this implemented.
Comparing the simple Tabindex approach of VB6 to the convoluted solution of Swing,
I consider this another example for why Swing should be hidden from 95% of all developers.
Please let us know your solution.
Greetings
A1880
TabOrder
Hello forum,
thanks to A1880 for the very useful link, I made a tiny little example and a handy class hopefully to get a grip on the TabOrder-problem.
Form: Form1 with a few Controls see the screenshot below
Class TabOrder: SuperClass: java#awt#FocusTraversalPolicy
regards
OlimilO
thanks to A1880 for the very useful link, I made a tiny little example and a handy class hopefully to get a grip on the TabOrder-problem.
Form: Form1 with a few Controls see the screenshot below
|
|
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 |
Option Explicit Public Sub Form_Load() 'omit Frame1 from tab sequence: Frame1.Parent.setFocusable(False) End Sub Public Sub OptTabOrder1_Click() Dim myTabOrder As New TabOrder 'either build up the tab sequence by adding the 'components to the taborder consecutively myTabOrder.Add(OptionBox1) myTabOrder.Add(OptionBox2) myTabOrder.Add(OptionBox3) myTabOrder.Add(OptionBox4) myTabOrder.Add(CheckBox4) myTabOrder.Add(CheckBox3) myTabOrder.Add(CheckBox2) myTabOrder.Add(CheckBox1) Form1.Parent.setFocusTraversalPolicy(myTabOrder) End Sub Public Sub OptTabOrder2_Click() Dim myTabOrder As New TabOrder(1, 8)' (LBound To UBound) 'optionally build up the tab sequence by using the 'TabIndex property myTabOrder.TabIndex(OptionBox1) = 1 myTabOrder.TabIndex(OptionBox2) = 4 myTabOrder.TabIndex(OptionBox3) = 5 myTabOrder.TabIndex(OptionBox4) = 8 myTabOrder.TabIndex(CheckBox1) = 2 myTabOrder.TabIndex(CheckBox2) = 3 myTabOrder.TabIndex(CheckBox3) = 6 myTabOrder.TabIndex(CheckBox4) = 7 Form1.Parent.setFocusTraversalPolicy(myTabOrder) End Sub Public Sub OptTabDefault_Click() Form1.Parent.setFocusTraversalPolicy(Nothing) End Sub |
Class TabOrder: SuperClass: java#awt#FocusTraversalPolicy
|
|
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 |
Option Explicit Dim myLBound As Integer Dim myOrder As New java#util#Vector Public Sub TabOrder() End Sub Public Sub TabOrder(iLBound As Integer, iUBound As Integer) myLBound = iLBound myOrder.setSize(iUBound - myLBound + 1) End Sub Public Sub Add(ctrl As Component) myOrder.add(ctrl) End Sub Public Property Get TabIndex(ctrl As Component) As Integer TabIndex = myOrder.indexOf(ctrl) + myLBound End Property Public Property Let TabIndex(ctrl As Component, Index As Integer) Index = Index - myLBound If Index >= Count Then Add(ctrl) Else myOrder.setElementAt(ctrl, Index) End If End Property Public Property Get Count() As Integer Count = myOrder.size End Property ' ########## ' FocusTraversalPolicy ' ########## ' Private Function getNext(direction As Integer, _ aComponent As Component) As Component If Count > 0 Then Dim Index As Integer = (myOrder.indexOf(aComponent) + direction) Dim cmp As Component, cnt As Integer ' this do loop is an intelligence for error tolerance ;) Do While (cmp = Nothing) And (cnt < Count) If Index = Count Then Index = 0 If Index < 0 Then Index = Count - 1 cmp = Cast(myOrder.get(Index), Component) Index = Index + direction cnt = cnt + 1 Loop getNext = cmp End If End Function Public Function getComponentAfter(focusCycleRoot As Container, _ aComponent As Component) As Component getComponentAfter = getNext(+1, aComponent) End Function Public Function getComponentBefore(focusCycleRoot As Container, _ aComponent As Component) As Component getComponentBefore = getNext(-1, aComponent) End Function Public Function getDefaultComponent(focusCycleRoot As Container) As Component getDefaultComponent = getFirstComponent(focusCycleRoot) End Function Public Function getLastComponent(focusCycleRoot As Container) As Component getLastComponent = Cast(myOrder.lastElement, Component) End Function Public Function getFirstComponent(focusCycleRoot As Container) As Component getFirstComponent = Cast(myOrder.firstElement, Component) End Function |
regards
OlimilO
Cool!
That is useful indeed.
My dream would be to get this included in IDE and framework.
I would like to use the old TabIndex() paradigm of VB6 without worrying about extra classes and other complications.
Each control could have a TabIndex() property. The initialization of Form, Dialog or Usercontrol would then automatically
setup the appropriate tab order according to TabIndex values.
Controls without TabIndex or with the same TabIndex value are sorted according to their name.
Greetings
A1880
That is useful indeed.
My dream would be to get this included in IDE and framework.
I would like to use the old TabIndex() paradigm of VB6 without worrying about extra classes and other complications.
Each control could have a TabIndex() property. The initialization of Form, Dialog or Usercontrol would then automatically
setup the appropriate tab order according to TabIndex values.
Controls without TabIndex or with the same TabIndex value are sorted according to their name.
Greetings
A1880
thanks. it's just one solution of many, to a problem though
it's no big deal to spent two new properties TabIndex (Integer) and TabStop (Boolean) to every Jabaco-control. But the VB-IDE does even more. whenever you set the TabIndex in the property-editor, the VB-IDE checks
A) the maxindex, and
B) sets the TabIndex of all other controls accordingly.
e.g. TabStop by default is true to all controls so all controls on one form must have a TabIndex.
->A) if you have 10 controls on the form it's not possible to set TabIndex = 20.
->B) if you want to set the TabIndex of all your controls you have to take care it's a bit tricky
I always had problems in setting the TabIndex in the VB-IDE.
it's a kind of logic, should the Jabaco-IDE mimic this behaviour too, even if it could be much better and easier?
moreover, Swing and VB do not have the same behaviour for OptionButtons. in VB the OptionButtons are grouped together in one TabStop whereas in Jabaco every OptionBox has it's own TabStop.
this is possible already if we integrate the TabOder-class into the Jabaco-Framework, the Jabaco-IDE must only check the MaxIndex.
sorted by name...
hmm, that's a different behaviour than the VB-IDE has. could you please make a more detailed explanation or a suggestion by code.
regards
OlimilO
Quoted
included in IDE and framework ... Each control could have a TabIndex() property
it's no big deal to spent two new properties TabIndex (Integer) and TabStop (Boolean) to every Jabaco-control. But the VB-IDE does even more. whenever you set the TabIndex in the property-editor, the VB-IDE checks
A) the maxindex, and
B) sets the TabIndex of all other controls accordingly.
e.g. TabStop by default is true to all controls so all controls on one form must have a TabIndex.
->A) if you have 10 controls on the form it's not possible to set TabIndex = 20.
->B) if you want to set the TabIndex of all your controls you have to take care it's a bit tricky
I always had problems in setting the TabIndex in the VB-IDE.
it's a kind of logic, should the Jabaco-IDE mimic this behaviour too, even if it could be much better and easier?
moreover, Swing and VB do not have the same behaviour for OptionButtons. in VB the OptionButtons are grouped together in one TabStop whereas in Jabaco every OptionBox has it's own TabStop.
Quoted
The initialization of Form, Dialog or Usercontrol would then automatically
setup the appropriate tab order according to TabIndex values
this is possible already if we integrate the TabOder-class into the Jabaco-Framework, the Jabaco-IDE must only check the MaxIndex.
Quoted
Controls without TabIndex or with the same TabIndex value are sorted according to their name
sorted by name...
hmm, that's a different behaviour than the VB-IDE has. could you please make a more detailed explanation or a suggestion by code.
regards
OlimilO
Thanks for your explanations. I have to confess that I am no real TabIndex-Expert.
VB6 assigns TabIndex values in an incremental fashion whenever a new control is inserted.
Therefore, the easiest way for the VB6 developer is to insert the controls in the required Tab order.
My suggestion to use the names might not be ideal, but it has the benefit of being clear and unique.
And it is easy to rename controls and thus achieve a reordering.
I haven't tried what happens in VB6 if you assign identical TabIndex values to several controls.
In doubt I would prefer to get the VB6 style in Jabaco.
Jabaco should invent own improvements only if there are convincing reasons.
Greetings
A1880
VB6 assigns TabIndex values in an incremental fashion whenever a new control is inserted.
Therefore, the easiest way for the VB6 developer is to insert the controls in the required Tab order.
My suggestion to use the names might not be ideal, but it has the benefit of being clear and unique.
And it is easy to rename controls and thus achieve a reordering.
I haven't tried what happens in VB6 if you assign identical TabIndex values to several controls.
In doubt I would prefer to get the VB6 style in Jabaco.
Jabaco should invent own improvements only if there are convincing reasons.
Greetings
A1880
Which attributes of a control are actually taken into consideration in the Jabaco IDE property dialog?
Is this a hard-coded list of properties or can this be influenced by changing the framework or some XML file?
In other words:
Do we need an IDE update to get the TabIndex property properly handled by the IDE?
Well, I think we do need an update.
By adding an additional TabIndex parameter to the param list of Form1.jsrc, I've fooled
the IDE. It now shows the TabIndex property in the property dialog for my Textbox:
Obviously, this is good for nothing.
The TabIndex property appears in the list but does not influence the generated code.
Greetings
A1880
Is this a hard-coded list of properties or can this be influenced by changing the framework or some XML file?
In other words:
Do we need an IDE update to get the TabIndex property properly handled by the IDE?
Well, I think we do need an update.
By adding an additional TabIndex parameter to the param list of Form1.jsrc, I've fooled
the IDE. It now shows the TabIndex property in the property dialog for my Textbox:
|
|
Source code |
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 |
<Object Type="VB/TextBox"> <Param Name="Index" Value="" /> <Param Name="BorderStyle" Value="fmBorderStyleSingle" /> <Param Name="HScrollBar" Value="sbShowNever" /> <Param Name="VScrollBar" Value="sbShowNever" /> <Param Name="Text" Value="Text1" /> <Param Name="BackColorSel" Value="-2147483635" /> <Param Name="ForeColorSel" Value="-2147483634" /> <Param Name="MultiLine" Value="False" /> <Param Name="TabSize" Value="4" /> <Param Name="ForwardTab" Value="True" /> <Param Name="Locked" Value="False" /> <Param Name="FontName" Value="Arial" /> <Param Name="FontBold" Value="False" /> <Param Name="FontItalic" Value="False" /> <Param Name="FontSize" Value="9" /> <Param Name="BackColor" Value="-2147483643" /> <Param Name="ForeColor" Value="-2147483640" /> <Param Name="Width" Value="161" /> <Param Name="Height" Value="57" /> <Param Name="Left" Value="80" /> <Param Name="TabIndex" Value="80" /> <<<<<<<---------------------- <Param Name="Top" Value="80" /> <Param Name="ToolTip" Value="" /> <Param Name="Enabled" Value="True" /> <Param Name="Visible" Value="True" /> <Param Name="Tag" Value="" /> <Param Name="MousePointer" Value="vbDefault" /> <Param Name="MouseIcon" Value="Nothing" /> <Param Name="CanGetFocus" Value="True" /> <Param Name="(Name)" Value="Text1" /> </Object> |
Obviously, this is good for nothing.
The TabIndex property appears in the list but does not influence the generated code.
Greetings
A1880
Quoted
I have to confess that I am no real TabIndex-Expert
me neither, in fact you will get one if you dive deeper
OK sounds reasonable.
Quoted
... but it has the benefit of being clear and unique.
And it is easy to rename controls and thus achieve a reordering
Quoted
In doubt I would prefer to get the VB6 style in Jabaco
Suggestion: Property TabStop As JabacoTabStop
|
|
Jabaco Source |
1 2 3 4 5 |
Enum JabacoTabStop VB6TabStop = -1 ' (True) compatible when importing VB6-Projects TabStopFalse = 0 ' the component is excluded from TabStops SwingDefaultFocusPolicy = 1 ' for new Jabaco project (nothing has to be done) End Enum |
Quoted
Jabaco should invent own improvements only if there are convincing reasons
Yes also my opinion. The existing solution adopted from Swing is a convincing solution and it's not an own improvment.
Quoted
Which attributes of a control are actually taken into consideration in the Jabaco IDE property dialog?
good question, looking forward to hearing from Manuel
regards
OlimilO
Similar threads
-
Suggestions »-
inconvenience and sudden death in find&replace dialog
(Apr 13th 2010, 2:29pm)
-
Bugreports and known bugs »-
[VERSION 1.5.2] Startup problem
(Jan 26th 2010, 11:42am)
-
Bugreports and known bugs »-
[VERSION 1.5.2] Sample Application "Calculator" - unary operations
(Feb 6th 2010, 12:34pm)
-
General topics, questions and discussions »-
All forms load, but only one form.Show executes
(Aug 19th 2009, 9:38pm)
-
General topics, questions and discussions »-
Is there an error in the automatic class name completion
(Jun 24th 2009, 9:42am)
