Results 1 to 4 of 4

Thread: 'with do' question

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    I actually don't do that but it was shorter to type this way
    thanks

  2. #2
    If you are adding all of this labels to some list you could go and create your own TMyLabel class which is deprecated class of TLabel. Doing so you can change default TLabel constructor so that Label gets added into your list ass soon as it is created:
    Code:
    type
      TMyLabel = class(TLabel)
      public
        constructor Create(Owner: TComponent; List: TObjectList);
      end;
    
      ....
    
    constructor TMyLabel.Create(Owner: TComponent; List: TList);
    begin
        inherited Create(Owner);
        List.Add(self);
    end;
    And now you can simply use:
    Code:
    with TMyLabel.create(Form1,someList) do begin
      ...
    end;

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •