Hello Guest

Author Topic: tk2dUIItem "HeldDown" message?  (Read 4203 times)

oxyscythe

  • Newbie
  • *
  • Posts: 4
    • View Profile
tk2dUIItem "HeldDown" message?
« on: August 07, 2013, 12:59:28 pm »
Is this possible? I noticed there's an Autofire event for tk2dButtons but that component seems to be depricated now in favour of the newer tk2dUIItem. This class exposes OnDown, OnUp, OnClick and OnRelease which are great but what do you do if you need an OnHeld?

I basically need to increase a counter continuously while a button is being held down. Suggestions much appreciated!

Thanks!

profanicus

  • 2D Toolkit
  • Full Member
  • *
  • Posts: 167
    • View Profile
Re: tk2dUIItem "HeldDown" message?
« Reply #1 on: August 07, 2013, 01:43:25 pm »
The general approach for held is to do the logic yourself - start increasing the counter when you get the OnDown event, and stop increasing it when you get OnUp.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dUIItem "HeldDown" message?
« Reply #2 on: August 07, 2013, 01:47:13 pm »
As profanicus says, this is the recommended approach. You can check tk2dUIDragItem for a example of how you can hook things up.

oxyscythe

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: tk2dUIItem "HeldDown" message?
« Reply #3 on: August 07, 2013, 02:11:09 pm »
Great, thanks profanicus and admin!