Page 1 of 1
Problem with the order when you have to scroll with a column
Posted: Wed Jun 06, 2018 6:15 pm
by 18683216
Delphi version: Seattle
TTeeGrid version: VCL & FMX Registered version-1.05
Multidevice Application (FMX)
Platform: WIN32
When the sort is enabled in a TTeeGrid, and all the columns are not shown, if you navigate to a non-visible column (scroll right) and press the header to sort, the first columns are shown again, and the scroll bar remains on the right.
I attached an example, (the demo.xml file is not included, if you wish, request it and send it to you in separate mail.)
Re: Problem with the order when you have to scroll with a column
Posted: Tue Jun 12, 2018 9:39 am
by yeray
Hello,
Please send that .xml to "info at steema dot com" referring this thread so we can run the example here.
Re: Problem with the order when you have to scroll with a column
Posted: Tue Jun 12, 2018 4:55 pm
by 18683216
Good afternoon Yeray,
Most of the problems that I am finding I am evaluating in the form contained in the file that I attach, also includes the data in xml format.
The problem discussed in this post, has as workaround, for FMX.Win32.Seattle, forcing all the numerical columns to be aligned to the left, as you suggested in the post
Re: When sorting, the size of all the columns changes and the gr.
Code: Select all
TeeGrid1.Columns [2] .TextAlignment: = TColumnTextAlign.Custom;
TeeGrid1.Columns [2] .TextAlign.Horizontal: = THorizontalAlign.Left;
Greetings.
Re: Problem with the order when you have to scroll with a column
Posted: Mon Jul 09, 2018 10:50 am
by Marc
Greetings,
The attached modified units resolve the "x-displacement after sort" issue. The x relocation is caused due to the combined behaviour of grid & dataset and needs to be corrected with the example client code.
Regards,
Marc
Re: Problem with the order when you have to scroll with a column
Posted: Mon Jul 09, 2018 5:19 pm
by 18683216
Gracias Marc,
This workaorund, solves the problem discussed in this thread, and
additionally, it solves other problems related to a TTeeGrid, associated with a TDataSet:
.- After modifying the contents of a cell, scroll to the first page
.- After calling TFDataSet.RefreshRecord, scroll to the first page
.- When ordering, the fields that were aligned to the right, changed the width of the columns.
For the solution to be generic, it is necessary to restore the horizontal and vertical scroll after calling methods that modify or refresh the TDataSet, eg:
Code: Select all
{STEEMA WORKAROUND Problem with the order when you have to scroll with a column}
X: = TeeGrid1.Current.Rows.Scroll.X;
Y: = TeeGrid1.Current.Rows.Scroll.Y;
Column: = <- Optionally, Get the selected column
Row: = <- Optionally, Get the index of the selected row.
{STEEMA WORKAROUND Problem with the order when you have to scroll with a column}
// Call TDataSet.Refresh, TFDDataSet.RefreshRecord, TTeeGri.Data.SetValue or Sort a TFDDataSet,
{STEEMA WORKAROUND Problem with the order when you have to scroll with a column}
TGridAccess (TeeGrid1) .ChangeVertScroll (Y);
TGridAccess (TeeGrid1) .ChangeHorizScroll (X);
// Optionally, re-select the selected cell.
TeeGrid1.Selected.Change (Column, Row);
{STEEMA WORKAROUND Problem with the order when you have to scroll with a column}
Greetings and thanks for this alternative solution, I was having enough problems ...