Example #1
0
MenuItem* ComboBox::AddItem( const UnicodeString& strLabel, const String& strName, Gwen::Event::Handler* pHandler, Gwen::Event::Handler::Function fn )
{
	MenuItem* pItem = m_Menu->AddItem( strLabel, L"", pHandler, fn );
	pItem->SetName( strName );

	pItem->onMenuItemSelected.Add( this, &ComboBox::OnItemSelected );

	//Default
	if ( m_SelectedItem == NULL )
		OnItemSelected( pItem );

	return pItem;
}
Example #2
0
MenuItem* ComboBox::AddItem(const std::string& label, const std::string& name)
{
    MenuItem* item = _menu->AddItem(label, "");
    item->SetName(name);
    item->SetTextPadding(Padding(2, 0, 0, 0));
    item->_on_selected.Add(this, &ComboBox::OnItemSelected);

    if (_selected_item == nullptr)
    {
        OnItemSelected(item);
    }

    return item;
}