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

Calling Tabindex? 2

Status
Not open for further replies.

DaBuzz

Programmer
Nov 8, 2002
40
US
Is there a way to setfocus where tabindex=1?

I have an add button control and when I click that instead of having to code the specific field with "thisform.cid1.setfocus" and then if I change tab order having to go back in and change the control from cid1 to eid1, I would rather have a generic call that said to setfocus on whichever field is set to tab order 1.

Thanks for any input.
 
Off the top of my head, and totally un-tested:

Code:
FOR EACH loControl in THISFORM.Controls
  IF PEMSTATUS(loControl, "TabIndex", 5)
    IF lo.Control.TabIndex = 1
      loControl.SetFocus
    ENDIF
  ENDIF
ENDFOR

This assumes that the control in question is placed directly on the form, rather than in some container such as a pageframe. If that's not the case, you would have to do some drilling.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike,

THANKS!!

It worked with one small edit I changed lo.Control.Tabindex to loControl.Tabindex.

Other than a fat finger I figured you might be testing me just to see if I knew anything. Just enough to be dangerous!
I've not used the PEMSTATUS before so that was also a good thing to learn about.

Great posting!! Thanks for the quick help.
[2thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top