In following code I need to guarantee the focus goes to the first readable control. I don't know the Tabindex of the first control because depends of the form, and this code is inside class and not always the first control is readable or has the property tabindex.
In my case (after instantiate the form class)
the first control is a textbox readonly=.f., tabindex=1,
the second control is a textbox readonly= .t., tabindex=2,
the third control is a combobox readonly=.t., tabindex=3
FOR EACH oCont IN Thisform.Controls
IF oCont.Baseclass = 'Pageframe'
FOR EACH Ctrl IN oCont.Page1.Controls
IF PEMSTATUS(Ctrl,'TabIndex',5) = .T. AND ;
PEMSTATUS(Ctrl,'Readonly',5) = .T. AND ;
Ctrl.Readonly = .F.
Ctrl.SetFocus()
EXIT
ENDIF
ENDFOR
EXIT
ENDIF
ENDFOR
What is happening is that instead the focus goes to the second control (tabindex=2) is going to third (tabindex=3). What is wrong?
Antonio Carlos Kleinübing
Systems Analyst