Author Topic: TDBCtrlGrid porting  (Read 2435 times)

Nicola Gorlandi

  • Jr. Member
  • **
  • Posts: 85
TDBCtrlGrid porting
« on: November 06, 2019, 01:52:12 pm »
I need to port in Lazarus a project that use a TDBCtrlGrid. The project will run only in Windows
Is someone avaiable to implement this porting ?
In case I can pay for this job (after an agreement).

Many thanks.


  • Administrator
  • Hero Member
  • *
  • Posts: 9536
  • FPC developer.
Re: TDBCtrlGrid porting
« Reply #1 on: November 06, 2019, 02:15:48 pm »
Port from where exactly? The delphi code is copyrighted and can't be used.


  • Hero Member
  • *****
  • Posts: 572
Re: TDBCtrlGrid porting
« Reply #2 on: November 11, 2019, 06:38:40 pm »
When you want to display other components in a TDBGrid (to emulate a TDBCtrlGrid), you have to "embed" them, following these principles, basically:
- when displaying, the dbGrid is drawn.
- when a cell is selected, it is necessary to embed a component in the cell and give it focus.
- when the component is left (tab, mouse key elsewhere, the component must be unlocked, the grid must have focus, and even redraw itself with the control data.

For overlay, several levels can be used for focus transfers between a cell and the overlay control:
- control incrustation when a cell has the focus, without giving the focus to the control.
- transfer from focus to control only for data entry.

Some general rules can therefore be identified:
- the display of the embedded control can be done in OnDrawDataCell, when dgFocused is part of the State parameter. Events like OnEnter can also be used for this purpose.
OnDrawDataCell is not normally designed for this: it is used to refresh the screen, i.e. to explain how to draw the TRec from the cell by the OS, but...
- unincrust, i. e. assign Visible:= False can be done in TControl.OnExit, and in dbGrid.OnColExit (but does not cover the case of a vertical movement in the same column).
- you must manage keyboard events when the control is embedded, visible. First, it is necessary to make the focus shift between the control and the dbGrid homogeneous:  therefore, you can code the typing of the Tab and navigation arrows keys.

All this, to say that it's not simple (it's just to show the minimal logic, how to replace the inPlaceEditor with other controls). In my humble opinion, the most pragmatic thing is to look at the code of the component that have been notified by Zoran (see,47319.msg338673.html#msg338673), and adapt it so that it'll work with your database too.

Two cents.
« Last Edit: November 11, 2019, 06:40:44 pm by devEric69 »
use: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.


  • Hero Member
  • *****
  • Posts: 3335
  • Compiler Developer
Re: TDBCtrlGrid porting
« Reply #3 on: December 07, 2019, 07:54:44 pm »
This post is already a month old, but I remembered something I recently found: the company MWA Software provides a TDBControlGrid in their Open Source IBX for Lazarus software (the code is here). As it's based on the LCL's grid it's also under LGPL-with-static-linking-exception. Maybe that could even be integrated in Lazarus...

rachel jose

  • New member
  • *
  • Posts: 7
Re: TDBCtrlGrid porting
« Reply #4 on: December 18, 2019, 12:46:23 pm »

I can help as i am having experienced in same.

Contact me via Skype: live:.cid.52caceaa56239236

email :


rachel jose

  • New member
  • *
  • Posts: 7
Re: TDBCtrlGrid porting
« Reply #5 on: December 18, 2019, 12:48:19 pm »
I know the post is one month old but if the contract is still alive or may be new requirement is there then definitely I can help.


TinyPortal © 2005-2018