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"

[4.6.1] UMG Frontend, C++ Backend

I was hoping I could design the user interface with UMG, but have most of the logic for events in C++ as opposed to blueprint. Is there a decent tutorial/source somewhere for this?

I have tried this tutorial with 4.6.1 and it results in errors coming from the UE4 API for when I extend UUserWidget. https://wiki.unrealengine.com/UMG,_How_to_extend_a_UUserWidget::_for_UMG_in_C%2B%2B.

EDIT: The wiki entry is correct, my issue was putting the Runtime/UMG includes in my [ProjectName].cpp file instead of where they should have resided in the [ProjectName].h. Thank you both I appreciate your patience!

Product Version: Not Selected
more ▼

asked Dec 21 '14 at 11:53 PM in C++ Programming

avatar image

101 7 12 128

avatar image WCode Dec 22 '14 at 03:48 AM

Hello if you have time please let me know what parts are giving you truble and i will update the tutorial.

Also there are a link to a tutorial about delegates for a extended User Wdget at the bottom of the wiki page you linked.

Note: Be warned delegates added in code for UMG widgets comes with its one head akes.

avatar image darknsf Dec 22 '14 at 06:35 AM

The issue pops up when I include "Blueprint/UserWidget.h" in my widget's class. The other includes and dependencies listed in the wiki seem to work.

 'ESlateCheckBoxState' : is not a class or namespace name

Are there additional libraries I should be concerned with?

avatar image Ben.Driehuis Dec 22 '14 at 06:46 AM

Can you paste your code here to the definition using ESlateCheckBoxState. If its a UProperty, remember you will need to use it like:

TEnumAsByte < ESlateCheckBoxState::Type >

Otherwise you also need to make sure you have Slate.h included as that will include the SCheckBox.h you need for that namespace.

Its hard to know without seeing where you are trying to use that enum.

avatar image WCode Dec 22 '14 at 04:37 PM

Did you add the modules for UMG and Slate?

 PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "Slate", "SlateCore", "PhysX", "APEX", "Landscape"});

avatar image darknsf Dec 22 '14 at 10:12 PM

Ben.Driehuis: The only code that is written is the code that is shown in the wiki.

 #pragma once
 #include "Blueprint/UserWidget.h"
 #include "RoMMainMenuWidget.generated.h"
 class ROM_API URoMMainMenuWidget : public UUserWidget

WCode: Yes, UMG, Slate, SlateCore have been added as depenencies.

             new string[] {

Is there some other library I am missing? Are you both using 4.6.1?

avatar image darknsf Dec 23 '14 at 12:37 AM

Gah! It was my fault, I had put the Runtime/UMG includes in my RoM.cpp instead of where the wiki says it should be in the RoM.h.

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

1 answer: sort voted first

Hey there, if you mean you want to extend events like Tick and OnKeyDown, then you can easily :)

All the BlueprintNativeEvent functions in the UUserWidget can be overrided as long as you override the generated c++ functions themselves, ie : _Implementation.


     virtual FEventReply OnKeyDown_Implementation(FGeometry MyGeometry, FKeyboardEvent InKeyboardEvent) override;
     virtual FEventReply OnControllerButtonPressed_Implementation(FGeometry MyGeometry, FControllerEvent ControllerEvent) override;
     virtual FEventReply OnControllerAnalogValueChanged_Implementation(FGeometry MyGeometry, FControllerEvent ControllerEvent) override;
     virtual FEventReply OnMouseWheel_Implementation(FGeometry MyGeometry, const FPointerEvent& MouseEvent) override;
     virtual    void Tick_Implementation(FGeometry MyGeometry, float InDeltaTime) override;

Let me know if you have any problems with this.

more ▼

answered Dec 22 '14 at 12:26 AM

avatar image

496 18 27 142

avatar image darknsf Dec 23 '14 at 12:38 AM

This was not my core issue but this snippet will in no doubt come in handy, thank you!

avatar image darknsf Jan 04 '15 at 03:42 AM

I have a UUserWidget inside of another UUserWidget. The outer widget always seems to steal the event for OnMouseButtonDown_Implementation() before the child can get it. Is there are way around this?

avatar image Ben.Driehuis Jan 04 '15 at 09:00 PM

Not off the top of my head, I am pretty sure those functions only work on the outer user widget.

In a case like that, where I wanted a complicated widget inside a user widget, I have just wrote a new UWidget wrapper around a custom SWidget

avatar image darknsf Jan 04 '15 at 11:49 PM

That's so strange because the blueprint implementation works perfectly, makes me wonder if this is the intended result.


(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