Lazarus

Programming => General => Topic started by: rcmz on July 08, 2020, 07:19:29 pm

Title: How to skip column in dbgrid
Post by: rcmz on July 08, 2020, 07:19:29 pm
Hello,

How can I skip a column using dbgrid ?

I tried to use dbgrid, tkdbgrid and rxdbgrid, no samples on how to skip a cell or column.

Also having problems with formating when editing a cell for examples I need this format 9-999-999, I did asign to displayformat 9-999-999.

TIA
Ramiro

Using Lazarus 2.04
Title: Re: How to skip column in dbgrid
Post by: wp on July 08, 2020, 08:01:22 pm
Skip in which way? Hiding the column? Or skip it when you press the arrow or tab key?
Title: Re: How to skip column in dbgrid
Post by: rcmz on July 08, 2020, 11:05:25 pm
Hello,

Skip the column when I press tab


TIA
Ramiro
Title: Re: How to skip column in dbgrid
Post by: wp on July 08, 2020, 11:58:37 pm
The key method in the LCL grids to prevent selecting a cell is the function SelectCell(ACol, ARow) which must return false for this case. Unfortunately it is a bit awkward to access it from TDBGrid - see attached demo. Maybe there is an easier way, but this one came to my mind first.
Title: Re: How to skip column in dbgrid
Post by: rcmz on July 09, 2020, 02:05:43 am
Thx, I will try it.

I will get back to you later.

Ramiro
Title: Re: How to skip column in dbgrid
Post by: rcmz on July 09, 2020, 02:24:40 am
Hello again,

I tried your sample grid and in part it covers the column I want to skip in my project.

I have 7 columns, column 3 is coverd by your sample project but in column 6 and 7 the difference to column 3 is that if column 6 haves a value than column 7 should be skip and go to next row, if you want to edit column 7 then column 6 should have 0 or no value.

How can I do this ?

I come from using as my grid DevExpress and all of this column options are in the properties or events so I think I got a litle rusty on doing it may self.  ;)

TIA
Ramiro
TinyPortal © 2005-2018