lol, how many times have you made this mistake ? it's very weird until you found why everything is going wrong :)

lol, how many times have you made this mistake ? it's very weird until you found why everything is going wrong :)

procedure TForm1.FormCreate(Sender: TObject);
var
Button: TButton;
begin
Button := TButton(Self);
Button.Parent := Self;
end:

Comments

  1. this mistake? never

    similar? forgot to set parent (;

    ReplyDelete
  2. I sure everyone that write a lot of code makes similar silly mistakes when tired.

    I will counter with "how many times do I come into a tech forum thats is flagged as having a new tech post to find that it is not".

    It took a half minute of my day to come and take a look at your post.

    I want a refund.

    ReplyDelete
  3. let's open a "Delphi Developpers Discussion" group instead of a Discussion topic

    ReplyDelete
  4. Paul TOTH You could name the community GSmiley

    ReplyDelete
  5. Евгений Савин its not a type cast, it's a typo

    ReplyDelete
  6. It's a typo that is also a type cast .....

    ReplyDelete
  7. If there just would be something like static code analyzers (or the compiler itself) that could find suspicious hardcasts ...

    ReplyDelete
  8. Paul TOTH​ safe type cast raises exception on your code. Unsafe cast does not.

    ReplyDelete
  9. Евгений Савин he meant to write button := TButton.Create(self);

    ReplyDelete

Post a Comment