Ultraplayer Newbie cheater
  Reputation: 0
  Joined: 06 Apr 2019 Posts: 20
 
  | 
		
			
				 Posted: Mon Jun 22, 2020 2:24 am    Post subject: [Bug] Recalculate New Addresses | 
				       | 
			 
			
				
  | 
			 
			
				Sometimes I need to change offset of the selected item (Select item -> RMB menu -> Recalculate new addresses). And, when more than one items is selected it works fine. BUT, if only one item is selected, CE changing ALL items' addresses.
 
 
 	  | Code: | 	 		  unit MainUnit;
 
 
procedure TMainForm.Calculatenewvaluepart21Click(Sender: TObject);
 
...
 
  updatelist:=TList.create;
 
  if (addresslist.SelCount=1) then //recalculate all siblings and their children
 
  begin
 
    tn:=addresslist.selectedRecord.treenode.parent;
 
    if tn=nil then //everything - Original Comment
 
                   // WHY???
 
                   // I'm do NOT select everything, only one item (see check above "SelCount=1")
 
                   // And if no parent node - this is just selected item (NOT everything)
 
    begin
 
      for i:=0 to addresslist.count-1 do begin
 
        updatelist.Add(addresslist[i]);
 
      end;
 
    end
 
 | 	  
 
 
My solution is:
 
 	  | Code: | 	 		      if tn=nil then
 
    begin
 
      for i:=0 to addresslist.count-1 do
 
        if addresslist[i].isSelected then
 
          updatelist.Add(addresslist[i]);
 
    end
 
 | 	  
 | 
			 
		  |