Problem with the order when you have to scroll with a column

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

Problem with the order when you have to scroll with a column

Post by REH Outsourcing » Wed Jun 06, 2018 6:15 pm

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.)
Attachments
TEE_GRID.zip
Ejemplo
(3 KiB) Downloaded 1509 times

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

Re: Problem with the order when you have to scroll with a column

Post by Yeray » Tue Jun 12, 2018 9:39 am

Hello,

Please send that .xml to "info at steema dot com" referring this thread so we can run the example here.
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: Problem with the order when you have to scroll with a column

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

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.
Attachments
FormTeeGrid_DEBUG.zip
(3.21 KiB) Downloaded 1422 times

Marc
Site Admin
Site Admin
Posts: 1271
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Problem with the order when you have to scroll with a column

Post by Marc » Mon Jul 09, 2018 10:50 am

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
Attachments
FixedXScroll.zip
(3.3 KiB) Downloaded 1459 times
Steema Support

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

Re: Problem with the order when you have to scroll with a column

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

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 ...

Post Reply