Forum > Databases

[SOLVED] Make DBGrid row unselectable

(1/1)

pcurtis:
How do I make a DBGrid row un-selectable based on a field in the underlying dataset?

It should jump to the next valid available record, or if none available not move.

Thanks.

Handoko:
I believe that won't be easy. Because TDBGrid is for simply showing data of the linked datasource, it will be less flexible for doing 'other' things.

But if you don't mind using TStringGrid, I haven't tried but it should be much easier.

Here I have an example for programmatically moving the focus cell:
https://forum.lazarus.freepascal.org/index.php/topic,37286.msg250687.html#msg250687

So you can set any condition you like, and then move the selection to wherever you want. But if you have problem loading data to show it to a TStringGrid, here I have a demo showing how to load data from a dbf file to StringGrid:
https://forum.lazarus.freepascal.org/index.php/topic,37181.msg249208.html#msg249208

pcurtis:
OK, thanks I'll have a look.

@Handoko - I've been looking and found the solution I need. I will stop using DBGrid, Stringgrid is, as you said, much better. You have to think a little differently but it's worth it.
Thanks.

Navigation

[0] Message Index

Go to full version