Topic: tGrid Popup Menu

I wanted to have more user friendly tGrid right click popup menu.


I did the visuals but need the code behind buttons so that they can function. I know all this functions are already in MVD but I like to customize the tGrid right click menu also want to add cell copying to popup menu, instead of explaining users that they need to ctrl+mouse click to copy a cell.


Hopefully, Dmitry can provide the code.
If anybody else can, please do so.


Please see the sample project attached below:

Post's attachments

Attachment icon tGrid Popup Menu Test.zip 7.47 kb, 353 downloads since 2017-10-01 

Adam
God... please help me become the person my dog thinks I am.

Re: tGrid Popup Menu

Check it out

procedure MenuClick1 (Sender: string);
begin
  frmInvoice.ShowRecord('Invoice', Form1.tgMainInv.dbItemID);
end;

procedure MenuClick4 (Sender: string);
begin
  ClipboardSet( Form1.tgMainInv.Cells[Form1.tgMainInv.SelectedColumn, Form1.tgMainInv.SelectedRow] );
end;

procedure MenuClick2 (Sender: string);
var
    s: string;
    i,c: integer;
begin
    s := '';
    c := Form1.tgMainInv.Columns.Count-1;
    for i := 0 to c do s := s + Form1.tgMainInv.Cells[i, Form1.tgMainInv.SelectedRow]+ ' | ';
    ClipboardSet(s);
end;

procedure MenuClick3 (Sender: string);
var
    s: string;
    iCol,c: integer;
    iRow,q: integer;
begin
    s := '';

    q := Form1.tgMainInv.RowCount-1;
    c := Form1.tgMainInv.Columns.Count-1;

    for iRow := 0 to q do
    begin
        for iCol := 0 to c do
        begin
            s := s + Form1.tgMainInv.Cells[iCol, iRow]+ ' | ';
        end;
        s:= s + #13#10;
    end;

    ClipboardSet(s);
end;

procedure MenuClick5 (Sender: string);
begin
  // not support
end;
Dmitry.

3 (edited by AD1408 2017-10-04 15:16:27)

Re: tGrid Popup Menu

Hi Dmitry,


Thank you very much............
Truly appreciated........................


One more question...
How can I place a horizontal line between desired menu items - like on default popup menu items?


=============
EDIT:
I found the following solution for horizontal menu item separator

MyItem := TMenuItem.Create (PopupMenu);
MyItem.Caption := '-';
PopupMenu.Items.Add(MyItem);
Adam
God... please help me become the person my dog thinks I am.