General information
Category:
Forms & Form designer
Title:
Setting focus on grid in page frame
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?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only