Adding MultiSelect to firemonkey’s TGrid

Delphi XE4 is nice and the Firemonkey framework is a lot more stable than the version that was included with XE2.
However there is still a lot of functionality missing and that is why I added MultiSelect to the TGrid component.
I’ve choosen to create a copy of the original file and hopefully Embarcadero wil include it with their next update.
In the attached PDF you can read which changes are needed in the original source code. I’ve only included the changes. If someone of Embarcadero gives permission to publish the whole file then I will update the post with it.

To use this is your project, just make sure the changed file is in the search path before the original dcu / pas file.
You will not be able to change the MultiSelect in the IDE (it is not used for the components in Delphi) but you can change the MultiSelect property in the OnCreate event of your form.

PDF with the explanation about adding MultiSelect to the Firemonkey grid:
FMX.Grid

Advertisements

About Picto-Selector

Creator of Picto-Selector, father of 3 children, one of them Autistic
This entry was posted in Delphi, Firemonkey, Software. Bookmark the permalink.

6 Responses to Adding MultiSelect to firemonkey’s TGrid

  1. Aneal says:

    Hey Evelien,
    Nice implementation and even nicer offer. How can Embarcadero fail with people like you around,eh?

  2. Mike says:

    Hi, can you publish an example with all the code??? Because I tried to do it and not worked. Can you help me please???

  3. D. Horn says:

    This is great.
    Thanks for the help.

    Some minor points for anybody else using this:

    There are one or two places in the PDF where a line is truncated but you should be able to easily figure out the problems from compiler errors.

    With XE5, I received two instances of the following compiler error:
    F2051: Unit %s was compiled with a different version of %s.%s (Delphi)

    In my case, the fix was to copy
    Fmx.Bind.Editors.pas
    Fmx.Bind.Grid.pas
    from
    Program Files (x86)\Embarcadero\RAD Studio\12.0\source\databinding\components\
    into my project and recompile.

  4. D. Horn says:

    I just took a quick look at XE7.

    There are enough changes to FMX.Grid that it’s no longer the case of simply making the changes you document.

    In particular, TCustomGrid.SelCell has been replaced with TCustomGrid.SelectCell and the implementation is quite a bit different.

    Before I spend any time trying to figure this out, is anybody already working on this?

    Thanks,

    Dan

    P.S. I noticed that TCustomGrid has a member called FSelections. At a glance, it seems to be already fulfilling at least part of the role performed by the new member FSelectedRows. Has anybody thought about using it in place of FSelectedRows?

  5. D. Horn says:

    FWIW:

    Also, any updates should include a new method for clearing the list of selections.

    I needed this because of a cosmetic glitch that occurs when I change the current selected item in the grid via code: eg,
    StringGrid1.Selected := sel;

    For those who don’t wish to make further changes, the following will also work to clear the selection list:
    StringGrid1.MultiSelect := False;
    StringGrid1.MultiSelect := True;

  6. I have no XE7, so I can not comment on it. But feel free to add a working example

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s