Discussion:
VFP9 Grid record focus
Kent Belan
2018-11-16 16:49:31 UTC
Permalink
Hello,
I have a weird problem with a grid on a locate screen that I have never
noticed before.

I have a maintenance screen with a locate button, that opens a modal search
form with a grid to select a record.

When I load the grid with several hundred records the first time it loads
fine at the top of the file.

The user selects a record and I return to the maintenance form and show the
record details.

If the user clicks the locate button again, I load the search form with the
grid and position the cursor to the record that was previous selected and
the grid shows the correct record.

The problem is when the user clicks on the grid, it repositions itself to
the first page of the grid and now we are on the wrong record.

Very weird ... Has anyone seen this behavior and possible solution ?

Thanks,
Kent


_______________________________________________
Post Messages to: ***@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/000601d47dcc$59042030$0b0c6090$@mchsi.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Frank Cazabon
2018-11-16 18:00:08 UTC
Permalink
Sounds like you have code running somewhere that you don't expect. Have
you set a breakpoint to track when the record pointer moves in the
grid's recordsource?

Frank.

Frank Cazabon
Post by Kent Belan
Hello,
I have a weird problem with a grid on a locate screen that I have never
noticed before.
I have a maintenance screen with a locate button, that opens a modal search
form with a grid to select a record.
When I load the grid with several hundred records the first time it loads
fine at the top of the file.
The user selects a record and I return to the maintenance form and show the
record details.
If the user clicks the locate button again, I load the search form with the
grid and position the cursor to the record that was previous selected and
the grid shows the correct record.
The problem is when the user clicks on the grid, it repositions itself to
the first page of the grid and now we are on the wrong record.
Very weird ... Has anyone seen this behavior and possible solution ?
Thanks,
Kent
[excessive quoting removed by server]

_______________________________________________
Post Messages to: ***@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/41e289a3-2d94-cda5-d9c5-***@gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Rafael Copquin
2018-11-17 13:28:28 UTC
Permalink
I have a similar problem, this time with a checbox in a column of the grid.
When the user clicks on the checkbox, it performs some code in its click
event and then, instead of staying on that record, the pointer goes up to
the top of the grid. This is annoying.

Finally I solved it with this code in the click event of the checkbox:
local nRec
nRec = recno('mycursor')

** perform some code here

select mycursor
locate for recno() = nRec
this.parent.parent,refresh

In my case, the pointer stays on the record it is supposed to be.

Hope it helps

Rafael Copquin
Post by Kent Belan
Hello,
I have a weird problem with a grid on a locate screen that I have never
noticed before.
I have a maintenance screen with a locate button, that opens a modal search
form with a grid to select a record.
When I load the grid with several hundred records the first time it loads
fine at the top of the file.
The user selects a record and I return to the maintenance form and show the
record details.
If the user clicks the locate button again, I load the search form with the
grid and position the cursor to the record that was previous selected and
the grid shows the correct record.
The problem is when the user clicks on the grid, it repositions itself to
the first page of the grid and now we are on the wrong record.
Very weird ... Has anyone seen this behavior and possible solution ?
Thanks,
Kent
[excessive quoting removed by server]

_______________________________________________
Post Messages to: ***@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/CAHM-jJ0jqr0d6Lxvp_dR1FRe0MVrxvV99-***@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are to
Man-wai Chang
2018-11-19 05:47:29 UTC
Permalink
These wikis might help?
http://fox.wikis.com/wc.dll?Fox~DisplayFindResults

I barely remember that there were tricks in using grid:

1. this.recordsource=this.recordsource

2. select (this.recordsource)
go recno()
this.refresh()

I still think there were some codes in your popup screen that moved
the record pointer of the grid's recordsource. You could re-open the
grid's data source using aliases without moving the record pointer in
the grid.

* something like these:
select 0
use (grid.recordsource) again noupdate alias haha
* do your stuffs
use in haha
Post by Kent Belan
Hello,
I have a weird problem with a grid on a locate screen that I have never
noticed before.
I have a maintenance screen with a locate button, that opens a modal search
form with a grid to select a record.
When I load the grid with several hundred records the first time it loads
fine at the top of the file.
The user selects a record and I return to the maintenance form and show the
record details.
If the user clicks the locate button again, I load the search form with the
grid and position the cursor to the record that was previous selected and
the grid shows the correct record.
The problem is when the user clicks on the grid, it repositions itself to
the first page of the grid and now we are on the wrong record.
Very weird ... Has anyone seen this behavior and possible solution ?
Thanks,
Kent
[excessive quoting removed by server]

_______________________________________________
Post Messages to: ***@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/CAGv=***@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Loading...