Hi, 21.02.2016 13:37, tha...@thaddy.com: [...]
x := (Sender As TComboBox); 8. 9. case x.Name of 10. 'ComboBox01':if x.ItemIndex = -1 then x.ItemIndex := PrjIndex else 11. begin
And what's wrong with just this: if Sender = Combobox1 then ... else if Sender = Combobox2 then ... else Regards, Nikolai
12. end; 13. 'ComboBox02':if x.ItemIndex = -1 then x.ItemIndex := HubIndex else 14. begin 15. end; 16. 'ComboBox03':if x.ItemIndex = -1 then x.ItemIndex := RimIndex else 17. begin 18. end; 19. 'ComboBox04':if x.ItemIndex = -1 then x.ItemIndex := SpkIndex else 20. begin 21. end; 22. end; 23. End; 24. end; 25. 26. Now how much nicer it would be if you could write someting along the lines of: 1. procedure TFrame00.ComboBoxChanged(Sender: TObject); 2. begin 3. If Sender Is TComboBox Then 4. case TCombobox(sender) of 5. Combobox1:; 6. ComboBox2:; 7. ComboBox3:; 8. end; 9. end; 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@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel