Lazarus

Miscellaneous => Jobs => Topic started by: Nicola Gorlandi on November 06, 2019, 01:52:12 pm

Title: TDBCtrlGrid porting
Post by: Nicola Gorlandi 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.
Title: Re: TDBCtrlGrid porting
Post by: marcov on November 06, 2019, 02:15:48 pm
Port from where exactly? The delphi code is copyrighted and can't be used.
Title: Re: TDBCtrlGrid porting
Post by: devEric69 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 https://forum.lazarus.freepascal.org/index.php/topic,47319.msg338673.html#msg338673 (https://forum.lazarus.freepascal.org/index.php/topic,47319.msg338673.html#msg338673)), and adapt it so that it'll work with your database too.

Two cents.
Title: Re: TDBCtrlGrid porting
Post by: PascalDragon 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 (https://www.mwasoftware.co.uk/) provides a TDBControlGrid in their Open Source IBX for Lazarus software (the code is here (https://svn.mwasoftware.co.uk/viewvc/public/ibx/trunk/ibcontrols/DBControlGrid.pas?revision=263&view=markup)). 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...
Title: Re: TDBCtrlGrid porting
Post by: rachel jose on December 18, 2019, 12:46:23 pm
Hi,

I can help as i am having experienced in same.

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

email : rachel@cisinlabs.com

Regards,
Rachel
Title: Re: TDBCtrlGrid porting
Post by: rachel jose 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