When sorting, the size of all the columns changes and the gr

TeeGrid VCL / FMX for Embarcadero RAD Studio, Delphi, C++ Builder and Lazarus Free Pascal.
Post Reply
REH Outsourcing
Newbie
Newbie
Posts: 25
Joined: Tue Mar 13, 2018 12:00 am

When sorting, the size of all the columns changes and the gr

Post by REH Outsourcing » Wed Jun 06, 2018 5:51 pm

Delphi version: Seattle
TTeeGrid version: VCL & FMX Registered version-1.05
Multidevice Application (FMX)
Platform: WIN32

I have attached your demo (Unit_Custom_Sorting.pas/fmx) with an added column of type integer so that you can reproduce the behavior.

The following happens, if you click on any of the three columns everything works as expected.

The unexpected behavior occurs when in the new column "id" the focus is placed in some cell of that column and click on the header of the column "id", to change the order.

At that time the width of all columns grows to a size that does not fit in the grid and the grid becomes unmanageable.

This behavior I have only observed in columns that contain numbers. that's why I added the id column as integer.

PD:
I also attached an example in TEE_GRID.zip and Lib_GridEx, with TVirtualFDDatasetData a descendant of TVirtualDBData, to facilitate the ordering of a TFDDataSet (The demo.xml file is not included, if you wish, request it and send it to you in separate mail.)
Attachments
Custom Sorting.zip
C:\Program Files (x86)\Steema Software\Steema TeeGrid for VCL & FMX Registered version-1.05\demos\FireMonkey\Custom Sorting\
(2.54 KiB) Downloaded 2304 times
TEE_GRID.zip
My sample
(3 KiB) Downloaded 2283 times

REH Outsourcing
Newbie
Newbie
Posts: 25
Joined: Tue Mar 13, 2018 12:00 am

Re: When sorting, the size of all the columns changes and the gr

Post by REH Outsourcing » Fri Jun 08, 2018 11:47 am

Good afternoon Yeray,

I have been able to observe that in certain occasions in the call to Tee.GridData.DB.TVirtualDBData.AutoWidth (), it resulted: = APainter.TextWidth ('0') * tmpL; returns unexpectedly high values (eg 199990,15625) and therefore the grid is not able to display the columns correctly.

This happens, when doing tests, I change TeeGrid.Data to assign another datasource, and coincidentally the focus is in a numeric cell.
It also occurs when the sort is enabled and the column button is pressed and the focus is in a numeric cell.

The first time TeeGrid.Data is assigned, the data is displayed correctly.

I suspect that the problem may have to do with the alignment on the right.

Saludos

REH Outsourcing
Newbie
Newbie
Posts: 25
Joined: Tue Mar 13, 2018 12:00 am

Re: When sorting, the size of all the columns changes and the gr

Post by REH Outsourcing » Fri Jun 08, 2018 11:54 am

I attached images of the appearance before and after the problem.
Attachments
After sort or reopen.jpg
After sort o reopen and cell focus on numerico column
After sort or reopen.jpg (82.79 KiB) Viewed 55761 times
Before sort or reopen.jpg
Before sort o reopen and cell focus on numerico column
Before sort or reopen.jpg (81.36 KiB) Viewed 55761 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: When sorting, the size of all the columns changes and the gr

Post by Yeray » Tue Jun 12, 2018 8:24 am

Hello,
REH Outsourcing wrote:I have attached your demo (Unit_Custom_Sorting.pas/fmx) with an added column of type integer so that you can reproduce the behavior.

The following happens, if you click on any of the three columns everything works as expected.

The unexpected behavior occurs when in the new column "id" the focus is placed in some cell of that column and click on the header of the column "id", to change the order.

At that time the width of all columns grows to a size that does not fit in the grid and the grid becomes unmanageable.

This behavior I have only observed in columns that contain numbers. that's why I added the id column as integer.
I can reproduce this problem with Seattle, but not with Berlin/Tokyo:
2018-06-12_10-17-55.gif
2018-06-12_10-17-55.gif (61.71 KiB) Viewed 55758 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

REH Outsourcing
Newbie
Newbie
Posts: 25
Joined: Tue Mar 13, 2018 12:00 am

Re: When sorting, the size of all the columns changes and the gr

Post by REH Outsourcing » Tue Jun 12, 2018 11:03 am

Good morning Yeray,

I confirm that the problem is specific to FMX:WIN32 Seattle, when compiling the demonstration project in Tokyo it works correctly.
It is evident that in Seattle there must be some kind of problem, which causes the width of columns to change.

I attach the simplified test project plus the data.

Additionally I observe the following:
.- When TTeeGrid.Editing.AlwaysVisible, the editor is shown but it is not editable, when it is false, it can be edited without problems. (FMX:WIN32: Seattle & Tokyo)
.- TTeeGrid.Editing.Editing.EnterKey = NextCell, is not taken into account, after pressing Enter, the newly edited cell loses focus, but the focus does not go to the next cell, or to any other (FMX:WIN32 Seattle & Tokyo)
Attachments
FormTeeGrid_DEBUG.zip
Demo and data
(3.21 KiB) Downloaded 2279 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: When sorting, the size of all the columns changes and the gr

Post by Yeray » Tue Jun 12, 2018 12:05 pm

Hello,
REH Outsourcing wrote:I confirm that the problem is specific to FMX:WIN32 Seattle, when compiling the demonstration project in Tokyo it works correctly.
It is evident that in Seattle there must be some kind of problem, which causes the width of columns to change.
The only workaround I can think on right now is to set the "id" column to be aligned to the Left, in Seattle:

Code: Select all

  TeeGrid1.Columns[2].TextAlignment:=TColumnTextAlign.Custom;
  TeeGrid1.Columns[2].TextAlign.Horizontal:=THorizontalAlign.Left;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

REH Outsourcing
Newbie
Newbie
Posts: 25
Joined: Tue Mar 13, 2018 12:00 am

Re: When sorting, the size of all the columns changes and the gr

Post by REH Outsourcing » Tue Jun 12, 2018 4:02 pm

Thanks Yeray, at the moment that workaround serves me.

REH Outsourcing
Newbie
Newbie
Posts: 25
Joined: Tue Mar 13, 2018 12:00 am

Re: When sorting, the size of all the columns changes and the gr

Post by REH Outsourcing » Mon Jul 09, 2018 5:22 pm

You can see an alternative solution, in this post, "Problem with the order when you have to scroll with a column"

18690545
Newbie
Newbie
Posts: 1
Joined: Fri Jan 22, 2021 12:00 am

Re: When sorting, the size of all the columns changes and the gr

Post by 18690545 » Wed Jan 27, 2021 8:34 pm

olá sou novo por aqui, gostaria de saber se a um meio de ordenar as colunas sem precisar de código.

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: When sorting, the size of all the columns changes and the gr

Post by Yeray » Wed Feb 03, 2021 2:00 pm

Hello,
olá sou novo por aqui, gostaria de saber se a um meio de ordenar as colunas sem precisar de código.
There's no editor option to sort columns for the moment so I'm afraid the only way to achieve it with code.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply