Advertisement
Guest User

Untitled

a guest
Oct 17th, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. TMySelectionEditor = class(TSelectionEditor)
  2. public
  3. procedure RequiresUnits(Proc: TGetStrProc); override;
  4. end;
  5.  
  6. procedure Register;
  7.  
  8. implementation
  9.  
  10. procedure TMySelectionEditor.RequiresUnits(Proc: TGetStrProc);
  11. var
  12. comp: TMyComponent;
  13. I: Integer;
  14. begin
  15. inherited RequiresUnits(Proc);
  16. Proc('ExtraUnit');
  17. // might be a better way of doing the code from here onwards?
  18. if (Designer=nil)or(Designer.Root=nil) then Exit;
  19.  
  20. for I := 0 to Designer.Root.ComponentCount - 1 do
  21. begin
  22. if (Designer.Root.Components[i] is TMyComponent) then
  23. begin
  24. comp := TMyComponent(Designer.Root.Components[i]);
  25. if comp.SampleProperty = True then
  26. Proc('ExtraUnit2');
  27. Proc(comp.ObjProperty.UnitName);
  28. end;
  29. end;
  30. end;
  31.  
  32. procedure Register;
  33. begin
  34. RegisterSelectionEditor(TMyComponent, TMySelectionEditor);
  35. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement