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"

Get UMG Widget under mouse cursor.

Hi, im Currently trying to Get the UMG widget under the mouse cursor, with the old HUD i used functions like this

     GetHUD()->GetHitBoxAtCoordinates(ScreenPosition, true)

is there any similar way or Strategy to get the UMG Element?

thanks in advance.

Product Version: UE 4.11
Tags:
more ▼

asked May 25 '16 at 04:23 AM in C++ Programming

avatar image

Rainbowdash
41 2 3 5

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

2 answers: sort voted first
more ▼

answered Jun 08 '16 at 10:49 AM

avatar image

Rainbowdash
41 2 3 5

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

For people Goolging this, also consider taking a look at FSlateApplication::LocateWindowUnderMouse

 void ReportWidgetsUnderMouse()
 {
     // Get a reference to the singleton instance of the slate application.
     FSlateApplication& MySlateApplication = FSlateApplication::Get();
 
     // Find a "widget tree path" of all widgets under the mouse cursor.
     // This path will contain not only the top-level widget, but all widgets underneath.
     // For example, if the mouse cursor was over a Button with a Text widget inside of it, then the last 
     // widget in the widget path would be the Text widget, and the next to last widget would be the Button widget.
     FWidgetPath WidgetsUnderCursor = MySlateApplication.LocateWindowUnderMouse( MySlateApplication.GetCursorPos(), MySlateApplication.GetInteractiveTopLevelWindows() );
 
     FString Result = TEXT( "" );
     if ( WidgetsUnderCursor.IsValid() )
     {
         Result += TEXT( " Count:" ) + FString::FromInt( WidgetsUnderCursor.Widgets.Num() );
 
         for ( int32 Idx = 0; Idx < WidgetsUnderCursor.Widgets.Num(); ++Idx )
         {
             FArrangedWidget& Widget = WidgetsUnderCursor.Widgets[Idx];
 
             Result += TEXT( " " ) + Widget.Widget->ToString();
         }
     }
 
     // Print out a quick summary of all widgets that were found under the mouse.
     UE_LOG( LogTemp, Warning, TEXT("%s"), *Result );
 }
more ▼

answered Dec 01 '18 at 09:24 AM

avatar image

Yukova
126 1 58 11

(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