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"

OnClicked Event only fires when double clicked.

Hey, i have a issue with the OnClicked Event when i click on a button which is a child of a child .. I explain :

I have a inventory system with a main widget which contain my inventory widget and this inventory widget contain the slots widgets (slots are generated automatically, they are in the Grid Panel) :

Main HUD :

alt text

Inventory Widget :

alt text

Slot Widget :

alt text

The problem is i have to doubleclick on my "Btn_Slot" to launch a "OnClicked" event.

Edit :

  • If i create a simple button directly on my main widget, i have no issue when i click on it.

  • If i put my "W_Inventory_Slot" directly on my main widget, i have to double click on the button to launch the "Onclicked" event".

The "ItemIcon" and "TextAmount" are "Self Hit Test Invisible".

I need help and tell me if you want more info about this !

Product Version: UE 4.18
Tags:
capture.jpg (15.3 kB)
capture2.jpg (20.4 kB)
capture3.jpg (16.4 kB)
more ▼

asked Jan 20 '18 at 05:10 AM in Blueprint Scripting

avatar image

Bonobro_
14 3 3 5

avatar image StuntThumper88 Jan 20 '19 at 08:21 PM

Confirm that the widget is focused. The first click may be focusing it, then the second is the normal click event

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

1 answer: sort voted first

Sounds a bit as if the wInventory was not getting the focus it needs to pass onto the button (when the mouse enters it) - could you try setting the wInventory to SelfHitTestInvisble or Visible? See if that helps.

The "ItemIcon" and "TextAmount" are "Self Hit Test Invisible".

You can set them to HitTestInvisible here - since you'll never want to click them anyway, saves performance.

more ▼

answered Jan 20 '18 at 08:13 AM

avatar image

Everynone
12.6k 72 24 53

avatar image Bonobro_ Jan 20 '18 at 11:19 AM

Hey, thanks for your answer, I tried to setting the wInventory to SelfHitTestInvisible (it was visible) but i have the same issue.. There is a problem in the W_Inventory_Slot i think, because when i put it directly in my main HUD, i have to double click on it to fire the "OnClicked".. Maybe i missed something, i'm new on unreal ..

avatar image Everynone Jan 20 '18 at 12:43 PM

Could you confirm something for me, please?

When you run the project, your initial click on the button (that's inside a custom widget) does not register, right. But once you've clicked it once, addition clicks do register correctly? Even if you start clicking other UI elements or leave the widget.

avatar image Everynone Jan 20 '18 at 12:59 PM

If you need the initial click to instantly register with widgets, change the Default Viewport Mouse Capture Mode to Capture During Mouse Down. It's in the Project Settings > Engine > Input. Bottom right corner of the image below:

alt text

capture.png (45.7 kB)
avatar image Bonobro_ Jan 20 '18 at 02:54 PM

After clicking one time, additional clicks don't register correctly.. Only double click fire "OnClicked". I already tried to change the Default Viewport Mouse Capture Mode, but same issue .. =(

If i put a simple button in my W_Main, "OnClicked" of this button fire with only 1 click, if it can help

avatar image Everynone Jan 20 '18 at 02:59 PM

So it's only the nested widget that acts up.

I asked after giving it a quick test in an empty project and seeing it works fine with custom widgets nested with buttons.

An additional question then. Do you, at some point, try to detect onMouseDown or Up?

avatar image Bonobro_ Jan 20 '18 at 03:04 PM

Yes ! I have OnPreviewMouseButtonDown, i'll try to add left click down here

avatar image Everynone Jan 20 '18 at 03:08 PM

edited: Your OnPreviewMouseButtonDown - what does it return?

avatar image Bonobro_ Jan 20 '18 at 03:07 PM

Thanks ! I added left mouse button down here and now it works fine. Thanks you for taking the time to help me ! I didn't know that this function override the OnClicked Event. Yes i want to implement DragAndDrop later, and the function "OnMouseButtonDown" dont work for me with left click..

avatar image Everynone Jan 20 '18 at 03:13 PM

Ah, makes sense now! Epic removed the easily accessed ability to drag buttons around and now OnPreviewMouseButtonDown is needed fro that but it does come at a cost...

One thing to consider before you go too deep into this UI. Try not to get used to dragging buttons, see if you can use borders instead. Will save you lots of headaches.

Good luck!

avatar image Bonobro_ Jan 20 '18 at 03:16 PM

Ok, thanks for the tips =) Thank you again for taking the time to help me !

(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