I am compiling in Windows 32 bit. Delphi Sydney latest update.
I fill a TTMSFNCComboBox with the code below:
cbox.Items.AddObject('Something, TObject(1);
I attempt to set the cbox with the following code:
cbox.ItemIndex := Items.IndexOfObject(TObject(1));
cbox.ItemIndex ALWAYS returns -1.
Anyone have an idea what is wrong with this code? This code works with VCL comboboxes.
Thank you,
Lee
Tunde
(Tünde Keller)
3
Hi,
We are unable to reproduce this issue. The following works as expected:
procedure TForm3.Button1Click(Sender: TObject);
begin
TMSFNCComboBox1.ItemIndex := TMSFNCComboBox1.Items.IndexOfObject(TObject(1)); //Set the ItemIndex
ShowMessage(IntToStr(TMSFNCComboBox1.ItemIndex)); //Shows '0'
end;
procedure TForm3.FormCreate(Sender: TObject);
begin
TMSFNCComboBox1.Items.AddObject('something', TObject(1));
end;
Are you doing any extra steps? Can you provide a small sample or code snippet that reproduces the behavior you are experiencing?