ComboBoxString OnSelectionChanged syntax

Hi,

I have trouble with specifying OnSelectionChanged of ComboBoxString event in C++.
The standard way with AddDynamic seems doesnt work.

pTerritorySelector->OnSelectionChanged.AddDynamic(this, &UEditorScreen::OnSelectTerritory);

Severity	Code	Description	Project	File	Line	Suppression State
Error	C2664	'void TBaseDynamicMulticastDelegate<FWeakObjectPtr,void,FString,ESelectInfo::Type>::__Internal_AddDynamic<UEditorScreen>(UserClass *,void (__cdecl UEditorScreen::* )(FString,ESelectInfo::Type),FName)': cannot convert argument 2 from 'void (__cdecl UEditorScreen::* )(void)' to 'void (__cdecl UEditorScreen::* )(FString,ESelectInfo::Type)'	Strategeist	F:\Spirits\SpiritsUEClean\Strategeist\Source\Strategeist\UI\EditorScreen.cpp	38	

How I should include this ESelectInfo?
If I add that, I get another error that AddDynamic has too many parameters.
Also, this FName should refer to method name instead of method pointer?

Unfortunately the forums still down in this moment and I didnt find any solution and documentation doesnt say anything about correct parameters here.

thanks for the help,
Gabor

found the problem. :slight_smile:
the binded function should include the correct parameters.

void myobject::OnSelectTerritory(FString sItem, ESelectInfo::Type seltype)
{
...
}

then the AddDynamic works fine with “standard” syntax.

Thank you so much dude from 2016! I was going nuts over this problem!!!

1 Like