DelphiGeek / mustangpeakvirtualshelltools

Automatically exported from code.google.com/p/mustangpeakvirtualshelltools
0 stars 0 forks source link

New (custom) items are not added in the correct group (TVirtualMultiPathExplorerEasyListview with property Grouped=True) #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Place a TVirtualMultiPathExplorerEasyListview component on a form
2. Set the "Grouped" property to True
3. Create a group (AGroup) by Groups.Add()
4. Set caption of the group (optional)
5. Add an item to the group by using AddCustomItem(AGroup, ANamespace, True);

What is the expected output? What do you see instead?
The item should be added to the specified group when calling 
AddCustomItem(AGroup, ...) and should be visible.
Instead no item is shown.

What version of the product are you using? On what operating system?
VirtualExplorerEasyListview.pas v2.4.0

Please provide any additional information below.

Original issue reported on code.google.com by tomm...@gmx.at on 11 Oct 2012 at 11:07

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Located the bug in the function 
TCustomVirtualExplorerEasyListview.AddCustomItem:
The InsertCustom method is called with a wrong (first) parameter.

When 'Group' has been specified (not nil), it has to use the Group.Items
NOT Groups[0].Items !

From Line #4231:
  if Assigned(Group) then
    Result := Groups[0].Items.InsertCustom(Groups[0].Items.Count, ItemClass) as TExplorerItem
  else begin
    if Grouped then
      Result := FindGroup(NS).Items.AddCustom(ItemClass, nil) as TExplorerItem
    else
      Result := Items.AddCustom(ItemClass, nil) as TExplorerItem;
  end;

The correct code would be:

  if Assigned(Group) then
    // ** FIX ** 10/12/2012 tommiii@gmx.at **
    Result := Group.Items.InsertCustom(Group.Items.Count, ItemClass) as TExplorerItem
  else begin
    if Grouped then
      Result := FindGroup(NS).Items.AddCustom(ItemClass, nil) as TExplorerItem
    else
      Result := Items.AddCustom(ItemClass, nil) as TExplorerItem;
  end;

Please correct the bug in the next release.

Thanks!

Best Regards,

Tom I.

Original comment by tomm...@gmx.at on 11 Oct 2012 at 11:16