[fpc-devel] Ability to handle instance pointers as ordinal type.
n-a-zhubr at yandex.ru
Sun Feb 21 11:49:15 CET 2016
21.02.2016 13:37, thaddy at thaddy.com:
> x := (Sender As TComboBox);
> case x.Name of
> 'ComboBox01':if x.ItemIndex = -1 then x.ItemIndex := PrjIndex else
And what's wrong with just this:
if Sender = Combobox1 then
else if Sender = Combobox2 then
> 'ComboBox02':if x.ItemIndex = -1 then x.ItemIndex := HubIndex else
> 'ComboBox03':if x.ItemIndex = -1 then x.ItemIndex := RimIndex else
> 'ComboBox04':if x.ItemIndex = -1 then x.ItemIndex := SpkIndex else
> Now how much nicer it would be if you could write someting along the
> lines of:
> procedure TFrame00.ComboBoxChanged(Sender: TObject);
> If Sender Is TComboBox Then
> case TCombobox(sender) of
> In other words, use the instance pointer as an ordinal value.
> It looks a lot more logical but as it stands it is of course invalid syntax.
> Is it possible to implement?
> If so, has it any value? To me at least it looks feasable and less like
> syntactic sugar than some features.
> fpc-devel maillist - fpc-devel at lists.freepascal.org
More information about the fpc-devel