Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP Grid Odd Behavior

Status
Not open for further replies.

ggreen61

Programmer
Jun 19, 2013
198
US
Hello--

I am seeing odd behavior in the VFP 9 (last SP) Grid object. I have the grid populated and start at row 1. I can select any displayed row using the mouse and the values are correctly displayed for the selected row. If I use the mouse to page down by clicking in the scroll bar (not dragging), I can still select any row using the mouse and the values are correctly displayed for the selected row. However, if I use the mouse and select the scroll bar button and drag it down (or up), when I select a row, the values displayed for the row are overwritten with the values from the row above the selected row. If I use the keyboard page up or page down, the display of the values for row selection by the mouse is correct. Seems to only occur when I use the mouse to drag the scroll button.

I thought that possibly the use of SetAll to set row height, font color, and backcolor via the Dynamic properties might be the culprit. However, removed all of these with the behavior persisting.

Can anyone duplicate this behavior? If so, has there been a solution for this behavior? I am seeing this behavior on Windows 10 Home v22H2 (not tested on other versions of Windows).


Greg
 
I just dragged&dropped customers from the northwindo sample database on a form and got a (native) grid.

Running that form I can't select a row, when I start selecting I only select one textbox, i.e. ALFKI.

I wonder what else you set in the grid, I guess AllowCellSelection is .f., and what you see, perhaps you should post screenshots.

If I click the mousewheel I get a grey windrose and unless I click once more, moving the mouse pointer around that windrose the grid will scroll in the direction the mouse pointer is relative to the windrose. That might not be standard, but I don't have any weird thing like rows being repeated while scrolling.

It sounds like the grid population with rows that become visible is somehow hindered´for you, which could point out a graphics driver issue. It might help to switch hardware graphics acceleration off, if it's on.
Also, is there any special column controls other than the default textbox, ActiveX, any trickery with code in backstyle_access of grid column controls?

Chriss
 
Below is a screen shot of a grid after being scrolled via the mouse drag of the scroll-bar button; the records in the red rectangular box are correct:

1_di2rug.jpg


Now the second record in the red rectangular box is selected via mouse click; the above row is duplicated over the correct row values:

2_crkxsu.jpg


This anomaly does not occur if the scroll is via a click of the mouse on the scroll bar (up or down) or if the keyboard is used to scroll. The grid is in read-only and the AllowCellSelection is set to false, ScrollBars is set to 2-Vertical, GridLines is set to 2-Vertical, DeleteMark is set to False, and SplitBar is set to false; all other properties are set to default values.

Greg
 
Update -- found the issue. In my base class for the grid I had sometime ago put the following in the Scrolled() event:

Code:
LPARAMETERS nDirection
this.DoScroll(nDirection)

This was the culprit. I removed the code and now the grid behaves as expected.

Greg
 
Okay, that's still surprising. I can understand that reacting to scrolliung with additional scrolling would cause trouble, like double scrolling or scrolling back and forth, but not a double row.

So I think the doubled row could be an artifact of this feedback effect and if you'd add thisform.refresh() it would just do double scrolling.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top