x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to cycle create UI_COMMAND?

I am adding a lot of "toolbar buttons"

I do not want to write this code: (Because there is too much repetition) alt text

I want to cycle create UI_COMMAND

like this: alt text alt text

A command with name CommandList[i] already exists in context MapEditor2D

How to cycle create UI_COMMAND?

Product Version: UE 4.17
Tags:
1.png (185.4 kB)
2.png (57.4 kB)
3.png (6.2 kB)
more ▼

asked Feb 08 '18 at 02:10 PM in C++ Programming

avatar image

Juvarunst
90 19 21 27

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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 ^^

more ▼

answered Feb 08 '18 at 02:42 PM

avatar image

Firefly74
1.4k 14 17 31

avatar image Juvarunst Feb 08 '18 at 05:13 PM

Thank you :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I got it, I use UI_COMMAND_Function

more ▼

answered Feb 08 '18 at 02:37 PM

avatar image

Juvarunst
90 19 21 27

avatar image Alon_1 Apr 17 '19 at 02:54 PM

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?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question