Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tabbing to a Disabled control

Status
Not open for further replies.

RichS

Programmer
Apr 24, 2000
380
US
I am developing guidelines for writing applications that are accessible to blind persons. If a control is disabled there is not an efficient way to inform a blind user that the control even exists.

Does any one know if there is a way to tab stop at a disabled control (or possibly a workaround)?

Is anyone developing apps that can be used by blind persons?

Thanks
Rich
 
IIRC, any control that is disabled gets ignored in the tab order list, so there's no inherent way to make a disabled control accept focus (which is all tabbing to a control is). The only way around it is to enable all controls, then have a bunch of handling in the Click, Change, KeyPress, etc., events to make it act disabled. I've never done it before, so I don't know what kind of scope this entails, but I imagine it can be done.

HTH,
jp
 
Thanks jp,
That's what I am afraid of, because it is a lot to maintain for complex forms and could be confusing to sighted users.

Rich
 
Yeah this looks to be fairly tricky. I guess the idea of having something disabled is so that it doesn't fire anything which is OK for sighted users but as you say it could be hard for blind persons to figure out.

If you were just tabbing between text boxes then you could maybe set them up as a control array and do something like:
Code:
Option Explicit
Dim intLastFocus As Long
Dim intCurrentFocus As Long

Private Sub Text1_LostFocus(Index As Integer)
intCurrentFocus = Text1(Index).Index
End Sub

Private Sub Text1_GotFocus(Index As Integer)
intCurrentFocus = Text1(Index).Index
CheckForDisabled intLastFocus, intCurrentFocus
End Sub

Function CheckForDisabled(LastFocus As Long, CurrentFocus As Long)

If CurrentFocus = 0 Then Exit Function
If CurrentFocus - LastFocus <> 1 Then MsgBox &quot;Enter what you need to do here i.e. Beep etc&quot;

End Function

which would check the index of the control against the last one (unless it was going back to the first control) but this is by no means workable yet as there are so many things that aren't taken into consideration i.e. movements to command buttons etc. The only other way I could think of is to create an array containing the names of the controls in the order that they are supposed to be in. You could then have a string for the last control and the current control and make sure they are in the same order.

Apart from that I'm pretty stuck too.
 
Set the Tag property to something like -1/0 for Locked/Unlocked.

Whenever you set a control to enabled = false, set the Tag property as well to -1, and vica-versa.
In the control's KeyPress AND KeyDown events, check this property, and if True

If Val(ctrl.Tag)=vbTrue Then
then set the KeyCode or KeyAscii to 0 and Call a Beep.

Have an option somewhere in your setup or options dialog to allow the user to decide which method they want to use. If the Tag method, then check this option prior to setting the Enabled property to False, and if True, do not disable the control.

You may be better off creating a user control for each basic control which you use the most. Then you do not need to code the KeyDown/press events all the time.

 
Based on CClint's idea, you could take it one stage further and incorporate a Microsoft Speech engine

If Text1.enabled Then
Text1.SetFocus
else Genie.Speak &quot;Say something useful&quot;
end if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top