FMXGrid VisibleColumnCount

Dear Support,

There is a problem with the function VisibleColumnCount, it returns a wrong value because FCStart and FCStop are both set to 0 at the time they are called in the attached test project.
Also in the attached archive you'll find a modified FMX.TMSCustomGrid unit with changes I had to apply after updating to the latest version made available 3.7.5.8. The project wouldn't compile due to unknown identifier error in the fixed grid cell class. Search for 'ctre' to find the commented out code.
VisibleCols.zip (70.6 KB)
Please advise.

TIA,
Carlos

Hi,

Please use the following code to setup the grid in the constructor of the form. The grid is tied to styling and the style is loaded after the form constructor.

constructor TForm1.Create(AOwner: TComponent);
begin
  inherited;
  TestGrid.NeedStyleLookup;
  TestGrid.ApplyStyleLookup;
  SetupGrid;
end;

Dear Mr. Scheldeman,

Thank you for your prompt reply. I did as per your instructions, but I can't still make any sense of the column count properties. As you can see, for demonstrations purposes, a total of 16 columns are created at run time and three are hidden, not deleted. So, the way I see it, Grid.ColumnCount should be 16 at all times because 3 columns were hidden, not deleted - it is 13 instead. After hiding the 3 columns, Grid.HiddenColumnCount should be 3, which it is. Grid.VisibleColumnCount should be 13, 16 total minus 2 hidden, but it is 10 instead. That said I tend to believe the problem is with ColumnCount reflecting the number of visible columns, 13, not the total number of columns in the grid.

Please advise.
VisibleColsRevised.zip (7.5 KB)

Hi,

The VisibleColumnCount is actually the count of the columns that you can see in the area of the grid. when resizing the grid, you'll notice this changes dynamically. The ColumnCount property is the number of columns that are not hidden. The Columns.Count property is the total amount of columns (hidden + unhidden)

Thank you once again, now I understand which properties to use ir order to get the information I need.
Only two questions remain:

  1. The Need/Apply Style Lookup should always be called before I can use these properties?
  2. Can you tell me if the code I commented out in the FMX.TMSCustomGrid.pas unit in order to be able to compile and keep development the project will not interfere in any other way I don't see right now? Right now I don't need popups in fixed columns. Is there anything to be done there on your side, or should I look elsewhere in my environment? Please see attached for comments tagged 'ctre'.

FMX.TMSCustomGrid.Edited.zip (48.0 KB)

  1. The Need/Apply Style Lookup should only be called if you want to access the grid in the creation procedure of the form (FormCreate), if you add code in the the FormShow, or from a button click, these calls should not be necessary.

  2. Hi, the commented / removed code will not interfere. We cannot simply remove the code of course, so we can look at adding a property to disable the popup capabilities.

  1. Understood, thank you.
  2. You should leave it alone. I can't explain how that source code I sent you showed up, and I just can't put more time to it than I already did. I didn't comment it out because I didn't need popup capabilities in fixed cells, I commented it out because I started getting compiler errors building the project.
    If you take a look at the version history in the file I sent you, you'll see it stops at v2.3.3.1, and the current file goes as far as v2.3.3.9. How that outdated file got into my system beats me, I use the TMS Updater to do all the download and installation work. Lets just leave it as it is, no further action is required, if something similar happens again I'll try and figure out how such thing could happen,

Once again, thank you for your attention, I appreciated it very much.

Thanks for the feedback. If anything comes up, please let me know.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.