06-01-2020, 08:15 PM
When you add items, you need to add an OnAsyncClick event to each item. I create 90+% of my IWBS4 components at run-time and here is how I add them in c++ (example):
TIWBS4DropDownItem * pDropDownItem = dynamic_cast<TIWBS4DropDownItem *> (CalendarNavigationMonthSelectDropDown->DropDownItems->Add());
pDropDownItem->Caption = FormatDateTime(L"mmmm yyyy",nDateStart);
pDropDownItem->Css = L" EventCalendarMonth";
pDropDownItem->OnAsyncClick = OnCalendarNavigationMonthSelectAsyncChange;
When the item is selected from the dropdown, the OnAsyncClick event is fired.
To get the index of the item selected in the event, do something like this:
void __fastcall TVTS3SelectEventCalendarForm::OnCalendarNavigationMonthSelectAsyncChange(TObject *Sender, TStringList *EventParams)
{
// Keep compiler happy
NOT_USED(Sender);
// Get selected month
int nSelectedMonth = EventParams->Values[L"itemidx"].ToIntDef(0);
...
}
Hope this helps!
Shane
TIWBS4DropDownItem * pDropDownItem = dynamic_cast<TIWBS4DropDownItem *> (CalendarNavigationMonthSelectDropDown->DropDownItems->Add());
pDropDownItem->Caption = FormatDateTime(L"mmmm yyyy",nDateStart);
pDropDownItem->Css = L" EventCalendarMonth";
pDropDownItem->OnAsyncClick = OnCalendarNavigationMonthSelectAsyncChange;
When the item is selected from the dropdown, the OnAsyncClick event is fired.
To get the index of the item selected in the event, do something like this:
void __fastcall TVTS3SelectEventCalendarForm::OnCalendarNavigationMonthSelectAsyncChange(TObject *Sender, TStringList *EventParams)
{
// Keep compiler happy
NOT_USED(Sender);
// Get selected month
int nSelectedMonth = EventParams->Values[L"itemidx"].ToIntDef(0);
...
}
Hope this helps!
Shane