Forum > LCL

[SOLVED] Editing second and later columns in TLazVirtualString

(1/2) > >>

I can't do this.
I set


and all columns' coEditable=true.

But when I click on a cell, only the first cell (cell of first column) is foucsed and get editable. I'd like to edit third column only. 

Where is this component , is it an add on? Because I don't see it in the stock list up too
Maybe its a package that isn't installed by default.

This is the Lazarus adaption of the TVirtualStringTree needed by the Online-Package-Manager.

IIRC, you must turn on the toGridExtensions in the MiscOptions to get grid-like behaviour.


Thank you for your advice. But still this does not work.  I set as :

procedure TForm1.vstFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode;
  Column: TColumnIndex);
   Sender.EditNode(Node, Column);

But "Column" is always 0, regardless of which column I click. So when I click a node the first column is always in edit mode.

Have a look at the attached sample project which allows editing of a grid-like VST of all columns, or restricts editing to a specific column or even to some specific cells.

The MiscOption toGridExtensions must be active in the VST.TreeOptions to activate grid-like behaviour of the VST.
And the MiscOption toEditing must be active to enable editing of any cell; however further restrictions can apply.

To restrict editing to some particular column you delete the coEditing option of that column.

To restrict editing to some particular cells only you write a handler for the OnEditing event in which you set the argument "Allowed" to false for all those cells which cannot be edited. You can identify the cells by means of the Column argument and the Node^.Index.

For editing cells you must transfer the edited text from the VST cell editor to your own data structure. This happens in the OnNewText event. It is the opposite of OnGetText.


[0] Message Index

[#] Next page

Go to full version