[Lazarus] Deleting items in OI

Vojtěch Čihák vojtech.cihak at atlas.cz
Wed Oct 25 19:30:03 CEST 2017


Hi,
 
I got this code for design time editing (note the line+comment *** aHook.SelectOnlyThis(aECTC.Tabs);  { force the OI to refresh } ***).
That line should refresh OI so the deleted item (CollectionItem) is removed (node in OI).
It worked in recent Lazarus versions, but it doesn't work in the latest trunk (i.e. item is removed but related node in OI persists).
I don't know which revision broke it.
What should I do?
 
Note: Lazarus (TPageControl) have not this problem. It uses plain DeletePersistent() method (in ComponentEditor.pas) .
 
procedure TECTabCtrlEditor.ExecuteVerb(Index: Integer);
var aECTC: TECTabCtrl;
    aECTab: TECTab;
    aHook: TPropertyEditorHook;
begin
  if Component is TECTabCtrl
    then aECTC:=TECTabCtrl(Component)
    else exit;  { Exit! }
    begin
      aHook:=nil;
      if not GetHook(aHook) then exit;  { Exit! }
      case Index of
        0: begin
             aECTab:=aECTC.AddTab(etaLast, True);
             aHook.PersistentAdded(aECTab, True);
           end;
        1: begin
             aECTab:=aECTC.AddTab(etaBeside, True);
             aHook.PersistentAdded(aECTab, True);
           end;
        2: begin
             aECTab:=aECTC.Tabs[aECTC.TabIndex];
             aHook.PersistentDeleting(aECTab);
             aECTC.DeleteTab(aECTC.TabIndex);
             aHook.SelectOnlyThis(aECTC.Tabs);  { force the OI to refresh }
           end;
        3: aECTC.MovePrevious();
        4: aECTC.MoveNext();
      end;
      Modified;
    end;
end;               
 
V.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20171025/0969aa89/attachment.html>


More information about the Lazarus mailing list