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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tab Stuck In Field

Status
Not open for further replies.

gbcpastor

Programmer
Jun 12, 2010
77
US
What would make a tab press not advance to the next field? I have several fields on a form and when it gets to the 4th field and I press tab, it says in the 4th field and won't advance to 5th 6th and so on. If I click on next field, it then will tab to the rest. I checked all my user functions and I can't see anything wrong.
 
Some possibilities:

1. The next field has its TabStop property set to .F.

2. The next field has some code in its When event that is causing the problem (less likely).

3. The field from which you are trying to tab has some code its Valid event that is returning .F. (even less likely).

My money would be on the first of the above.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
It might also be that the fields' TabIndex properties are not what you expect. It could be that you are successfully tabbing out of Field 4, but the focus is going somewhere unexpected, such as a command button, rather than one of your fields.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thanks Mike, I'll check those out. Seems reasonable.
 
I don't see how TabStop could be the issue. If every field after the 4th had TabStop = .F., tab would go back to the first field.

My guess is something in the Valid or LostFocus of the 4th field.

Tamar
 
Tamar, the reason I placed the possibility of Valid code in third place, and flagged it as "even less likely", is that he said that he had checked all the "user functions" and couldn't see anything wrong. But I agree that if the Valid was returning .F., that would explain the behaviour. Maybe "user functions" doesn't include methods or events.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Is the 4th field an editbox? And is it set to AllowTabs=.T., then your tabs will show in the editbox text, though, and CTRL+TAB is necessary for moving the focus on.

You explicitly say you stay in the control, wrong tab order would do that, you'd still move on to somewhere else, Tabstop .f. in other controls, too.

Like Mike I don't know what you mean with user code, it could mean you looked into your own code within that control. But is it a class? Did you look into class code, parent class code? Alos of the next control, which can reject getting focus in the WHEN event. And you can of course get stuck in a control by it either not allowing focus change in valid or lostfocus. If this is legacy code, the ErrorMessage event might be used instead of the Valid.

In such situations you don't see what happens, but what happens is not normal, it helps to look at what runs, as there is too much places to look into source code. Either single-stepping through code with the debugger or recording with COVERAGE. It's hard to decide where to start with the debugger it and the influence of the debugger window causing focus changes also doesn't help about such situations. So SET COVERAGE TO coverage.log and then see what happens, I bet you find the reason.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Hello,

I would bet on Mike's 1. tabstop set to .f. or Mike's Post 4 with unexpected taborder
because he writes he can leave the field with click, so to my opinion it cannot be lostfocus or valid or when code.

Tom
 
Found it! It's an unknown error in a class called "acombo". I changed it to a simple combobox and it was happy. Thanks for the help.

Just fyi, when I referred to user code, it should have said "User Procedures" within the objects.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top