Author Topic: ScrollBar only when dragging  (Read 4556 times)

Game Whiz

  • Guest
ScrollBar only when dragging
« on: August 16, 2012, 03:57:14 AM »
Hi,

I've set a scroll bar only to appear when dragging, but if I tap the draggable panel it flickers (it shouldn't appear). Is there an easy way to make the scroll bar only appear when actually dragging?

Alex

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ScrollBar only when dragging
« Reply #1 on: August 16, 2012, 10:16:31 AM »
Set the drag threshold on the UICamera. OnDrag events are only sent after this movement threshold is exceeded.

Game Whiz

  • Guest
Re: ScrollBar only when dragging
« Reply #2 on: August 16, 2012, 10:34:41 AM »
It's set, but the scroll bar appears even though no drag events were sent. I also tested this in Example 7 (set ShowScrollBars to WhenDragging and set UICamera's mouse drag threshold to 400), and clicking and holding without dragging made the scroll bar appear.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ScrollBar only when dragging
« Reply #3 on: August 16, 2012, 10:44:53 AM »
Oh, that scroll bar... sorry mind was on something else. Right, that's how it works. It will always appear when you press the mouse button.

Game Whiz

  • Guest
Re: ScrollBar only when dragging
« Reply #4 on: August 16, 2012, 10:49:45 AM »
:)

Ok, then back to the original question, how can I make it only appear when dragging?

My problem with the way it currently is, is that I've setup a draggable panel of buttons and merely tapping on a button makes the scroll bar appear. This doesn't look good, particularly in iOS devices, since it won't behave the same as other iOS apps (e.g. tapping or pressing without dragging on a web page in Safari doesn't make the scroll bar appear).

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ScrollBar only when dragging
« Reply #5 on: August 16, 2012, 12:44:18 PM »
Line 612 of UIDraggablePanel -- the mTouches > 0 check.

Game Whiz

  • Guest
Re: ScrollBar only when dragging
« Reply #6 on: August 16, 2012, 02:35:45 PM »
Thanks. I got it to work by creating a new var do track whether the panel is being dragged (true in Drag(), false in Press() if the user stopped pressing) and substituted the mTouches check by a mDragging check. I have no idea about what side effects that'll have on panels of a different type...

Could you please incorporate this feature into one of the next releases? It seems like a good behaviour for scroll bars that only appear when dragging.

BR,
Alex

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ScrollBar only when dragging
« Reply #7 on: August 16, 2012, 05:24:46 PM »
Yup, I have.

Game Whiz

  • Guest
Re: ScrollBar only when dragging
« Reply #8 on: August 16, 2012, 06:16:10 PM »
Thanks!