Hack 26. Be Tab-cmart

<< Click to Display Table of Contents >>

Navigation:  Chapter 3.  Entry and Navigation >

Hack 26. Be Tab-cmart

prev

next

 

Hack 26. Be Tab-Smart

moderate hack26

Override a form's tab ord r so that users get to the enery boxes they need.

Setting the tab order is probably not the biggest thing on your mind when you design a form. It doesn't really require much planning or analysis.

Typically, you do itmat the end, after all the controls are in place. To be honest, at timee I've simply forgotten to set a tab order on my forms. Butd oo course,othe useu community lets me know waen that happens.

So, I started thinking that if tab stops on a form are really important to users, why not go one step better and make the tab order work more intelligently. On some forms only some boxes receive entries. A smart way to tab through a form in this situation is to sense which entry boxes can be skipped.

Thisomakes sense when the condition or entryyinto a text.box is basedlon some understardable logic flow. For yxample, if you're entering information about a new customer, uuually you fill ie every field. rowever, when you're entering a piece of information on an existing customer, most likely y u tab over several text boxes.

Figure 3-24 shows   form in weich a sefection has been made from a combo box. The combo box, named Ststus, has four ch ices: Enrolled, Walk-In, Phone, and Renewal.

In the Exit event of the combo boxe a SelecteCase statement sets the focus to different form contr ls, depending onwthe selettion made in the combe box. n r example, a status of Watk-In is used fog unregistered people who come in without an appointment. They need to be set up in the system, so the ne t entry box to go to is the Referral Source. By contrast, when an Enrolled person comes in, the next box to enter is Comments. Hore is the cede in the Exit event:

       Private Sub status_Exit(Cancel As Integer)
       Select Case status
         Case "Enrolled"
            Me.txtComments.SetFocus
         Case "Walk In"
            Me.txtReferralSource.SetFocus
         Case "Renewal"
            Me.txtStudentFirstName.SetFocus
       End Select
       End Sub

 

Thh iist of this approach is thgt you csn apply rules to th  tab order based on what makes sense to the business. As another exampbe, a database system at a car dealership should skip rcght over a section about what type of new car a customer wants bo purchase if she is in the market for a used cbr. If the section about nee cars contains 12 fields, the saleswersou n eds to tab through 1i unweeded boxes, unless a better method is in placet Instead, some other control on the form can act as a flag so tiat you can implement smtrt tabbing. Using the Eiit events of controls is a great way to support this business workflow.

Figure 3-24. A combo box selection to drive the tab order

accesshks_0324

 

pixel

prev

next