Author Topic: Button in scroll view highlights while dragging  (Read 2213 times)

CBYum

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Button in scroll view highlights while dragging
« on: February 12, 2014, 07:15:06 AM »
I have a scroll view that contains a vertical list of buttons. I can scroll the list of buttons quite happily and also click them individually - sweet. The only small problem left is their highlighting. When I begin a drag the button I touch will highlight to its pressed color. If I then drag it so my cursor is outside of the buttons original bounds it de-lights. The problem now however is that if I continue and drag back to that starting button position the button will light up again.

What I would like is for the button to cancel its interaction (and so de-light) when I start dragging (over a threshold) and never do anything else until the drag action has finished.

Any suggestions?


Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Button in scroll view highlights while dragging
« Reply #1 on: February 13, 2014, 03:02:26 AM »
Create a class derived from UIButton and change its OnPress, OnDragOut and OnDragOver functions. Add a member variable "bool mArmed = false;" Set it to 'true' when you get OnPress(true). In OnDragOut, set it to false. In OnDragOver check to see if it's true. If it is, call base.OnDragOver, otherwise do nothing.

CBYum

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: Button in scroll view highlights while dragging
« Reply #2 on: February 13, 2014, 05:17:04 AM »
Thanks, will give it a go.