Recent

Author Topic: [SOLVED] Editing second and later columns in TLazVirtualString  (Read 820 times)

egsuh

  • Hero Member
  • *****
  • Posts: 1273
I can't do this.
I set

    toEditable=true
    toEditOnClick=true
    EditDelay=0

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. 
« Last Edit: July 04, 2022, 11:27:55 am by egsuh »

jamie

  • Hero Member
  • *****
  • Posts: 6090
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.
The only true wisdom is knowing you know nothing

wp

  • Hero Member
  • *****
  • Posts: 11853
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.

egsuh

  • Hero Member
  • *****
  • Posts: 1273
@wp

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


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


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.

wp

  • Hero Member
  • *****
  • Posts: 11853
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.

egsuh

  • Hero Member
  • *****
  • Posts: 1273
I found that TreeOptions.SelectionOptions.toExtendedFocus must be set true as well. Somehow I must have set this option off. Thank you for kind help.

 

TinyPortal © 2005-2018