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"

I cannot call OnValueChanged(...) of SNumericEntryBox

Hello.

I was trying to add SNumericEntryBox to my plug-in (for now I have SButton working on).

I done it with:

 SNew(SNumericEntryBox<int32>)
 .AllowSpin(true)
 .MinValue(1).MaxValue(1000)
 .MinSliderValue(1).MaxSliderValue(1000).Value(100)

I can now see the numeric entry box in my plug-in.

But when I wanted to handle value change event, adding .OnValueChanged(&Locals::numberChanged):

 SNew(SNumericEntryBox<int32>)
 .AllowSpin(true)
 .MinValue(1).MaxValue(1000)
 .MinSliderValue(1).MaxSliderValue(1000).Value(100)
 .OnValueChanged(&Locals::numberChanged)

With following Locals structure:

 FCopyPluginEdModeToolkit::FCopyPluginEdModeToolkit()
 {
     struct Locals
     {
         
         static void numberChanged(int32 copies){
             OnButtonClick(FVector{ 0.0f, 0.0f, float(copies) }); //or whatever code here
         }
 
         static FReply OnButtonClick(FVector InOffset){
             //that works fine for SButton
             //...
         }
 ...

I got an compile-time error:

 error C2664: 'SNumericEntryBox<int32>::FArguments &SNumericEntryBox<int32>::FArguments::OnValueChanged(const TBaseDelegate<void,int32> &)' : cannot convert argument 1 from 'void (__cdecl *)(int32)' to 'const TBaseDelegate<void,int32> &'


Product Version: UE 4.10
Tags:
more ▼

asked Dec 09 '15 at 07:01 AM in C++ Programming

avatar image

PolGraphic
6 1 3

avatar image alsanoja Mar 14 '19 at 01:00 AM

Did you ever find a good solution? I am attempting the same thing and am having trouble passing in my delegate.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Try to use .OnValueChanged_Static(&Locals::numberChanged)

Protip: if youre about to create more advanced/complex UI, dont make your methods static in local struct, just take them out and put them in your main class.

more ▼

answered Dec 11 '15 at 10:46 PM

avatar image

szyszek
595 16 10 36

(comments are locked)
10|2000 characters needed characters left
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