In my Delphi form, I have an ImageList with 4 pictures. There is also a ComboBox named ComboBox1 and a TImage component called Image9 .
I created onChange for my ComboBox because I would like to do something like this: if ComboBox element 1 is selected, load image 1 into your ImageList. In the same case, if ComboBox element 3 is selected (for example), load image 3 from ImageList.
The code I wrote is as follows:
case ComboBox1.Items[ComboBox1.ItemIndex] of 0: begin ImageList1.GetBitmap(0,Image9.Picture); end; 1: begin ImageList1.GetBitmap(1,Image9.Picture); end; 2: begin ImageList1.GetBitmap(2,Image9.Picture); end; 3: begin ImageList1.GetBitmap(3,Image9.Picture); end; end;
Using this code, the IDE (I use Delphi XE4) gives me an error on the case ComboBox1.Items[ComboBox1.ItemIndex] of , because it says that the type Ordinal is required. What can I do?
source share