Skip to content

List index out of bounds exception when editng a node #1312

@Npc8

Description

@Npc8

Reproduction Steps:

  1. compile Advanced with VT8.1.2.
  2. switch to 'Property tree simulation'.
  3. click an editable node, such as 'Title' or 'Theme'.
  4. the following error occurs:
---------------------------
Advanced
---------------------------
List index out of bounds (-1).  TList<System.Classes.TCollectionItem> range is 0..1.

TBaseVirtualTree.DoEdit called TBaseVirtualTree.ScrollIntoView, but FFocusedColumn was not updated (it's still -1) before execute the following code

    if Horizontally then
      // 2) scroll horizontally
      // Center only if there is enough space for the focused column, otherwise left align, see issue #397.
      ScrolledHorizontally := ScrollIntoView(FFocusedColumn, Center and (R.Width <= (ClientWidth - Header.Columns.GetVisibleFixedWidth)), Node);
  

I manually update the FFocusedColumn before calling ScrollIntoView, and it works as expected, but I'm unsure if it's the most appropriate approach.

    FFocusedColumn:= FEditColumn;
    ScrollIntoView(FFocusedNode, toCenterScrollIntoView in FOptions.SelectionOptions, not (toDisableAutoscrollOnEdit in FOptions.AutoOptions));
    

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions