Topic: How to display a form from selected cell in a TAbleGrid ?

Hello

I was testing a mouse event (OnKeyDown or OnKeyPress) inside à TableGrid.
Here is the pitch :

I display a Tablegrid with many cells and many values. Clicking right button (or left button) of the mouse, I wanted open a form with datas about  value contained in a special cell.
Here If I click into a celle containing value about a provider, right button displays the form with all datas about this one in the cell.
(See attchement picture).
I planned for it to use Vcl Grids.TGridCoord to retrieve coordinates X and Y of the mouse pointer.
It seems that this VCL is not implemented.
I've also tried OnMouseEnter and OnMouseLeave, same fail.
Is there another way to succeed ?

Thanks for your help

JB

Post's attachments

Attachment icon example.jpg 22.39 kb, 366 downloads since 2016-06-28 

Re: How to display a form from selected cell in a TAbleGrid ?

Hello,


Please attach your project, I will try to implement it to your project.


Thanks.

Dmitry.

Re: How to display a form from selected cell in a TAbleGrid ?

Hello Dmitry

Thanks for your interest.
Please the attachment on support@drive-software.com

JB

Re: How to display a form from selected cell in a TAbleGrid ?

Please send again, may be I accidentally remove your e-mail.

Dmitry.

Re: How to display a form from selected cell in a TAbleGrid ?

Hello Dmitry

Made on support mail

JB

Re: How to display a form from selected cell in a TAbleGrid ?

jean.brezhonek wrote:

Hello Dmitry

Made on support mail

JB

Please check out this script:

procedure Accueil_TableGrid1_OnCellClick (Sender: string; ACol, ARow: Integer);
var
    id_FOURNISSEURS: integer;
begin
    if (ACol = 4) and (Accueil.TableGrid1.dbItemID<>-1) then
    begin
        id_FOURNISSEURS := SQLExecute('SELECT IFNULL(id_FOURNISSEURS,-1) FROM ARTICLES WHERE id='+Accueil.TableGrid1.sqlValue);
        if id_FOURNISSEURS<>-1 then
        begin
            Fournisseur.Edit1.Text := SQLExecute('SELECT NOM_FOURNISSEUR FROM FOURNISSEURS WHERE id='+IntToStr(id_FOURNISSEURS));
            Fournisseur.Edit2.Text := SQLExecute('SELECT CONTACT_FOURNISSEUR FROM FOURNISSEURS WHERE id='+IntToStr(id_FOURNISSEURS));
            Fournisseur.Edit3.Text := SQLExecute('SELECT PRENOM_CONTACT FROM FOURNISSEURS WHERE id='+IntToStr(id_FOURNISSEURS));
            Fournisseur.Edit4.Text := SQLExecute('SELECT ADRESSE FROM FOURNISSEURS WHERE id='+IntToStr(id_FOURNISSEURS));
            Fournisseur.Edit5.Text := SQLExecute('SELECT VILLE FROM FOURNISSEURS WHERE id='+IntToStr(id_FOURNISSEURS));
            Fournisseur.Edit6.Text := SQLExecute('SELECT CP FROM FOURNISSEURS WHERE id='+IntToStr(id_FOURNISSEURS));
            Fournisseur.Edit7.Text := SQLExecute('SELECT TELEPHONE FROM FOURNISSEURS WHERE id='+IntToStr(id_FOURNISSEURS));
            Fournisseur.Edit8.Text := SQLExecute('SELECT PORTABLE FROM FOURNISSEURS WHERE id='+IntToStr(id_FOURNISSEURS));
            Fournisseur.Edit9.Text := SQLExecute('SELECT FAX FROM FOURNISSEURS WHERE id='+IntToStr(id_FOURNISSEURS));
            Fournisseur.Edit10.Text := SQLExecute('SELECT COURRIEL FROM FOURNISSEURS WHERE id='+IntToStr(id_FOURNISSEURS));

            Fournisseur.Button5.dbGeneralTableId := id_FOURNISSEURS;
            Fournisseur.ShowModal;
        end;
    end;

end;


About Fournisseur.ComboBox1, I think the component not should be on the form.

Dmitry.

Re: How to display a form from selected cell in a TAbleGrid ?

Hello Dmitry

GREAT !!! GREAT !!!

It Works fine ! Amazing !

Last thing : How can I display a HandPoint cursor when mouse enters on ACol=4 , or a messagebox telling user he can see informations about a provider when he clicks on this column ?

I've tried many tests but without success.

Why do you say : 'About Fournisseur.ComboBox1, I think the component not should be on the form.'
This allows the inventory manager to know the payment terms granted by the supplier (payments 30 days, 60 days or 90 days).

Thanks again Dmitry, great job.

JB

Re: How to display a form from selected cell in a TAbleGrid ?

jean.brezhonek wrote:

Hello Dmitry

GREAT !!! GREAT !!!

It Works fine ! Amazing !

Last thing : How can I display a HandPoint cursor when mouse enters on ACol=4 , or a messagebox telling user he can see informations about a provider when he clicks on this column ?

I've tried many tests but without success.

Why do you say : 'About Fournisseur.ComboBox1, I think the component not should be on the form.'
This allows the inventory manager to know the payment terms granted by the supplier (payments 30 days, 60 days or 90 days).

Thanks again Dmitry, great job.

JB

jean.brezhonek
Just add this line to event Accueil_TableGrid1_OnChange

Accueil.TableGrid1.Columns[4].Cursor := crHandPoint;

Form "Fournisseur" saving data to database table "FOURNISSEURS" but ComboBox uses foreign key from database table "ARTICLES", button "SaveRecord" can save data only in one table.

Dmitry.