Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-04

TsWorkshetGrid isn't scrolling enough

8 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Frans

Hi.

I have a form with a TsWorksheetGrid and a TEdit component. It loads data from a xls file and the grid is filled as aspected.
I want to use the TEdit field to search for an unknown row, based on the content of the 4th column. The whole idea is that the Grid react on every character in TEdit. I use the method Edit1OnChange:

So far so good. I start filling TEdit and after the first character ('h) the grid is responding perfecty. The first row where column 4 starts with that character becomes visible. But when I enter the second character ('u', TEdit shows 'hu'), the cellcursor goes to the newer row, but the scrolling of the grid is insufficient. The new row is not visible.

More strange is that a second attempt, after positioning the cursor in the top of the grid, succesfull is, the grid is now scrolling as aspcted.

mvg Frans van Leeuwen M 06-51695390 -------------- next part -------------- A non-text attachment was scrubbed... Name: TestFpSpreadsheet.zip Type: application/x-zip-compressed Size: 74794 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160405/b9a8cf58/attachment-0001.bin>

Reply by email

Werner Pamler
to Frans
Show quoted text 15 lines
I have a form with a TsWorksheetGrid and a TEdit component. It loads data from a xls file and the grid is filled as aspected. I want to use the TEdit field to search for an unknown row, based on the content of the 4th column. The whole idea is that the Grid react on every character in TEdit. I use the method Edit1OnChange: So far so good. I start filling TEdit and after the first character ('h) the grid is responding perfecty. The first row where column 4 starts with that character becomes visible. But when I enter the second character ('u', TEdit shows 'hu'), the cellcursor goes to the newer row, but the scrolling of the grid is insufficient. The new row is not visible. More strange is that a second attempt, after positioning the cursor in the top of the grid, succesfull is, the grid is now scrolling as aspcted.

I'm sorry - I cannot reproduce this behavior, on my system the row scrolls perfectly into view. I tested your demo with fps-trunk / Laz-trunk / fpc-3.0 and fps-1.6.1 / Laz-1.6 / fpc-3.0, both on Win 7. What are your fpspreadsheet / Lazarus / FPC versions? On which operating system?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160405/0fe11650/attachment-0001.html> -------------- next part --------------
A non-text attachment was scrubbed...
Name: dgbbbeaj.png
Type: image/png
Size: 60165 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160405/0fe11650/attachment-0001.png>

Reply by email

Frans
to Werner Pamler

Hi.

I used Laz 1.6/FPC 3.0 on Win7. I'm not sure wich version of fps, I think 1.6.

mvg
Frans van Leeuwen
M 06-51695390

Op 05-04-2016 om 21:16 schreef Werner Pamler:

Show quoted text 28 lines
> I have a form with a TsWorksheetGrid and a TEdit component. It loads data from a xls file and the > grid is filled as aspected. > I want to use the TEdit field to search for an unknown row, based on the content of the 4th > column. The whole idea is that the Grid react on every character in TEdit. I use the method > Edit1OnChange: > > So far so good. I start filling TEdit and after the first character ('h) the grid is responding > perfecty. The first row where column 4 starts with that character becomes visible. But when I > enter the second character ('u', TEdit shows 'hu'), the cellcursor goes to the newer row, but the > scrolling of the grid is insufficient. The new row is not visible. > > More strange is that a second attempt, after positioning the cursor in the top of the grid, > succesfull is, the grid is now scrolling as aspcted. I'm sorry - I cannot reproduce this behavior, on my system the row scrolls perfectly into view. I tested your demo with fps-trunk / Laz-trunk / fpc-3.0 and fps-1.6.1 / Laz-1.6 / fpc-3.0, both on Win 7. What are your fpspreadsheet / Lazarus / FPC versions? On which operating system? -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Werner Pamler
to Frans
I used Laz 1.6/FPC 3.0 on Win7. I'm not sure wich version of fps, I think 1.6.

Strange... I went back to 1.4.4, no problem there either. Maybe a high-dpi issue? What is your screen pixel density? Mine is 96 dpi (in Windows, this is called "100% standard").

Reply by email

Frans
to Werner Pamler

Hi.

I have 96 dpi, but I use Windows classic as thema. When I switch to Windows 7 Basic, the grid works fine.

mvg
Frans van Leeuwen
M 06-51695390

Op 05-04-2016 om 22:21 schreef Werner Pamler:

Show quoted text 12 lines
> I used Laz 1.6/FPC 3.0 on Win7. I'm not sure wich version of fps, I think 1.6. Strange... I went back to 1.4.4, no problem there either. Maybe a high-dpi issue? What is your screen pixel density? Mine is 96 dpi (in Windows, this is called "100% standard"). -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Werner Pamler
to Frans
I have 96 dpi, but I use Windows classic as thema. When I switch to Windows 7 Basic, the grid works fine.

No luck, I switched to Win-Classic design, stll works fine. Since TsWorksheetGrid is a modified LCL TCustomDrawGrid and IIRC does not change anything with respect to scrolling I suspect that the bug is in grids.pas. Could you please run the attached demo. It is like your own demo but replaces the TsWorksheetGrid by a standard TStringGrid. On my system, this demo behaves correctly as well.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestFPSpreadsheet-stringgrid.zip
Type: application/x-zip-compressed
Size: 2309 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160406/95b10aad/attachment.bin>

Reply by email

Frans
to Werner Pamler

Hi.

Your demo works fine, so I will change my program. I've noticed another point: on my computer is the fontsize and the row heigth greater in my program than in your demo.
I've tried changing the fontsize, in the object inspector and in the code, but that makes no difference.

I use this code in a much bigger program where also TStringGrids are used. There too is the fontsize bigger for the worksheetgrid then in the StringGrids. Why? I do not know.

Thanks for your time and help.

mvg
Frans van Leeuwen
M 06-51695390

Op 06-04-2016 om 14:31 schreef Werner Pamler:

Show quoted text 17 lines
> I have 96 dpi, but I use Windows classic as thema. > When I switch to Windows 7 Basic, the grid works fine. No luck, I switched to Win-Classic design, stll works fine. Since TsWorksheetGrid is a modified LCL TCustomDrawGrid and IIRC does not change anything with respect to scrolling I suspect that the bug is in grids.pas. Could you please run the attached demo. It is like your own demo but replaces the TsWorksheetGrid by a standard TStringGrid. On my system, this demo behaves correctly as well. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Werner Pamler
to Frans
Frans wrote 11 lines
Hi. Your demo works fine, so I will change my program. I've noticed another point: on my computer is the fontsize and the row heigth greater in my program than in your demo. I've tried changing the fontsize, in the object inspector and in the code, but that makes no difference. I use this code in a much bigger program where also TStringGrids are used. There too is the fontsize bigger for the worksheetgrid then in the StringGrids. Why? I do not know.

So you are saying that the StringGrid scrolls correctly, the WorksheetGrid does not? No good for the WorksheetGrid, and hard to debug because I cannot reproduce the error...

Font size and row heights of the WorksheetGrid are controlled by settings in the file, not by Grid properties. Add the following lines to your code in Formshow after LoadfromSpreadsheetFile:

   sWorksheetGrid1.Workbook.SetDefaultFont('Calibri', 10);   // font
name and font size in pts.
   sWorksheetGrid1.Worksheet.DefaultRowHeight := 1.0;   // units are lines

and play with the values to see if there are combinations for with the scrolling issue disappears. (The currently used value are DefaultFont = 'Arial', 10-pt and DefaultRowHeight = 1.2)

Reply by email