Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Workaround for a bug
Message
 
 
To
14/06/2001 15:09:25
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00519598
Message ID:
00519663
Views:
16
This message has been marked as the solution to the initial question of the thread.
>>>I did force a SetFocus() on one of my control whenever I call the Refresh() method. This solves the problem.
>>>
>>>I was wondering, instead of adding a control, is there a way to detect the control #1 in the tab sequence so we can focus on that?
>>
>>You could loop through the Controls() collection looking for the first visible control that has a SetFocus method that is not a grid, but I think that would be a PITA.
>
>The advantages of it is that we will set the focus to the first control of the form, the focus will be on a visible one so we will see and we won't have to handle an extra control to handle that workaround.

I have only tested this code for the conditions in it. There may be other factors that prevent a control from receiving focus, like visible property.
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 
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform