TADvPolyList Wchich item is selected

Hi there,
How do i know wchich item is selected in TAdvPolyList ?

Cheers

Hi, 

You can use AdvPolyList1.List.SelectedItem;


Yeah, i tried this, but :
           AdvPolyList1->SelectItem(0);
           ShowMessage(AdvPolyList1->List->SelectedItem()->Index);
Gives me access violation  (C++ Builder XE6 Pro) :(

also in POlylist overwiew demo2  (Delphi XE2 Starter):
AdvVerticalPolyList3.SelectItem(0);
ShowMessage(IntToStr(AdvVerticalPolyList3.List.SelectedItem.Index));

Or if i click on item and try to get selected index...


---------------------------
Debugger Exception Notification
---------------------------
Project FairWare.exe raised exception class $C0000005 with message 'access violation at 0x00536d76: read of address 0x00000008'.
---------------------------
Cheers



Of course delphi Tokyo 10.2 Starter

You always need to check if the SelectedItem is assigned to avoid an access violation. But do you really have selectable items?


The AdvVerticalPolyList3 in the sample does not have selectable items, therefore setting the Selectable property to true of the first item will allow it to be selected.

  AdvVerticalPolyList3.Items[0].Selectable := True;
  AdvVerticalPolyList3.SelectItem(0);
  ShowMessage(IntToStr(AdvVerticalPolyList3.List.SelectedItem.Index));