if not isnull(loMincontrol) local lcMinControl lcMinControl = sys(1272,locontrol) loMinControl = .null. lcMinControl = 'thisform'+substr(lcMinControl,at('.',lcMincontrol)) + '.setfocus()' eval(lcMinControl) endif>You probably do not want to set first focus to any object which has a controlcount such as GRID,PAGE,CONTAINER et al.
>local loMinControl >loMinControl = .null. >For each loControl in ThisForm.Controls > if not if pemstatus(locontrol,'controlcount',5) > if pemstatus(locontrol,'setfocus',5) and locontrol.enabled > if isnull(loMinControl) or loControl.tabindex < lomincontrol.tabindex > lomincontrol = locontrol > endif > endif > endif >endfor > >note: loMincontrol is a hanging reference until end of setfocus > >if not isnull(loMincontrol) > loMinControl.setfocus() >endif >loMinControl = .null. >>
>>local loMinControl >>loMinControl = .null. >>for each loControl in ThisForm.Controls >> if isnull(loMinControl) >> if upper(loControl.BaseClass) <> "GRID" and pemstatus(loControl, 'SetFocus', 5) and loControl.Enabled >> loMinControl = loControl >> endif >> loop >> endif >> if upper(loControl.BaseClass) <> "GRID" and pemstatus(loControl, 'SetFocus', 5) and loControl.Enabled >> if loControl.TabIndex < loMinControl.TabIndex >> loMinControl = loControl >> endif >> endif >>endfor >>if not isnull(loMinControl) >> loMinControl.SetFocus() >>endif >>