Recent

Author Topic: How to skip column in dbgrid  (Read 438 times)

rcmz

  • New Member
  • *
  • Posts: 20
How to skip column in dbgrid
« 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

wp

  • Hero Member
  • *****
  • Posts: 7553
Re: How to skip column in dbgrid
« Reply #1 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?
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

rcmz

  • New Member
  • *
  • Posts: 20
Re: How to skip column in dbgrid
« Reply #2 on: July 08, 2020, 11:05:25 pm »
Hello,

Skip the column when I press tab


TIA
Ramiro

wp

  • Hero Member
  • *****
  • Posts: 7553
Re: How to skip column in dbgrid
« Reply #3 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.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

rcmz

  • New Member
  • *
  • Posts: 20
Re: How to skip column in dbgrid
« Reply #4 on: July 09, 2020, 02:05:43 am »
Thx, I will try it.

I will get back to you later.

Ramiro

rcmz

  • New Member
  • *
  • Posts: 20
Re: How to skip column in dbgrid
« Reply #5 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