Juvarunst
(Juvarunst)
1
I am adding a lot of “toolbar buttons”
I do not want to write this code: (Because there is too much repetition)
I want to cycle create UI_COMMAND
like this:
A command with name CommandList[i] already exists in context MapEditor2D
How to cycle create UI_COMMAND?
Firefly74
(Firefly74)
2
you can simply use the function used by the macro :
#define UI_COMMAND( CommandId, FriendlyName, InDescription, CommandType, InDefaultChord ) \
UI_COMMAND_Function( this, CommandId, TEXT(LOCTEXT_NAMESPACE), TEXT(#CommandId), TEXT(#CommandId) TEXT("_ToolTip"), "." #CommandId, TEXT(FriendlyName), TEXT(InDescription), CommandType, InDefaultChord );
in this case it would give something like :
UI_COMMAND_Function( this, CommandList[i], TEXT(LOCTEXT_NAMESPACE), TEXT("GenCommandName")+i, TEXT("GenCommandName")+i, TEXT("_ToolTip"), "." #CommandId, TEXT("test button"), TEXT("i'im note"), UserInterfaceAction::Button, FInputChord());
that should work !
edit: ok took me too long to answer ^^
Juvarunst
(Juvarunst)
3
I got it, I use UI_COMMAND_Function
Alon_1
(Alon_1)
5
Hi, I have the same problem.
Can you please share with me your full code of how you use UI_COMMAND_Function
in for loop?