[Lazarus] how to get Type of Sender or Components[i] in order to Cast?
Sven Barth
pascaldragon at googlemail.com
Mon Jul 27 14:27:33 CEST 2015
Am 27.07.2015 11:37 schrieb "Mark Morgan Lloyd" <
markMLl.lazarus at telemetry.co.uk>:
>
> Now obviously I could have a separate property holding an enumeration,
but it's a pity that it's not possible to do something like
>
> case MainForm.OutputComponent of
> TListBox: begin end;
> TMemo: begin end;
> ...
> otherwise
> // Fatal exception since this is a serious programming error
> end;
I had already thought about a TClass-case myself, but the first problem is
whether the case labels should be strict ("x.ClassType = y") or loose ("x
is y") [for Strings and Ordinals that is no problem]. And if the latter,
what if the type is a TEdit, but you have labels for example for
TCustomEdit and TControl? Also ranges should probably not be allowed (e.g.
TControl..TEdit).
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20150727/776f9f15/attachment-0003.html>
More information about the Lazarus
mailing list