Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting focus on grid in page frame
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00247045
Message ID:
00247048
Views:
20
>I have a page frame with two pages. Each page has a grid, which is the only control on each page. Whenever the user activates a page I want focus to be on the grid. To do this I have placed the following code in the Activate event on each page:
>
>THISFORM.pageframex.pagex.gridx.SetFocus
>
>On each grid, if the user enters a valid account number in column 1, I want to skip to column 4. To do this I set a public variable gl_ok to true in the Valid of the text box in column 1 and then have the following code in the LostFocus event of that text box:
>
>IF gl_ok = .T.
> This.Parent.Parent.Column4.text1.SetFocus
>ENDIF
>
>Sometimes this works, but often the focus goes from Column 1 to Column 2. Other times it goes from Column 1 to the page tab then to Column 4. I set step on and what seems to be happenning is that when I try to set focus on Column 4, the code in the Activate event is executed, which overides the set focus in the LostFocus event.
>
>What code should I use, and where should I place it, to get the focus to behave as I want?

You can try putting NoDefault before the setfocus line of code...

IF gl_ok = .T.
NoDefault
This.Parent.Parent.Column4.text1.SetFocus
ENDIF
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform