Author Topic: hide the menu when clicked outside of it  (Read 2107 times)

Demigoth

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 18
    • View Profile
hide the menu when clicked outside of it
« on: March 26, 2014, 08:07:47 PM »
Hey guys, so I am working on my game and got this menu show up when I click an in-game object, now the menu wont dissapear until I actually use the stuff its inside, but I wanted to know if there is any way to trigger it to hide when I click outside of it.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: hide the menu when clicked outside of it
« Reply #1 on: March 26, 2014, 08:23:54 PM »
If you give your menu focus via UICamera.selectedObject = yourMenuObject, you can then detect when it loses focus as it will receive OnSelect(false), letting you close it. That's what the popup list does as well.

Demigoth

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 18
    • View Profile
Re: hide the menu when clicked outside of it
« Reply #2 on: March 29, 2014, 11:39:31 AM »
Hey Aren,

but where do I put this script on, to set up the focus.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: hide the menu when clicked outside of it
« Reply #3 on: March 30, 2014, 07:04:23 AM »
On whatever object you want to hold focus while the menu is visible -- likely the menu itself.