Author Topic: UIDraggablePanel Scrollbar isVisible  (Read 16801 times)

devomage

  • Sr. Member
  • ****
  • Thank You
  • -Given: 7
  • -Receive: 67
  • Posts: 250
    • View Profile
UIDraggablePanel Scrollbar isVisible
« on: June 10, 2013, 11:19:29 PM »
Where/when is the best place to detect changes in this property?  Fails in both Awake/Start and takes a cycle or two in Update.  Is there possibly an event to subscribe to that i'm overlooking?

Appreciate the best solution.  Thanks!


  1. public UIDraggablePanel mypanel;
  2.  
  3. Debug.Log(mypanel.verticalScrollBar.background.isVisible);
  4. Debug.Log(mypanel.verticalScrollBar.foreground.isVisible);
  5.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDraggablePanel Scrollbar isVisible
« Reply #1 on: June 10, 2013, 11:30:56 PM »
UIWidget.isVisible simply tells you if the widget's alpha is above zero, and the scrollable panel tweens the alpha of the scroll bar to make it fade in -- which is likely why you are seeing a delay.

What are you trying to do?

devomage

  • Sr. Member
  • ****
  • Thank You
  • -Given: 7
  • -Receive: 67
  • Posts: 250
    • View Profile
Re: UIDraggablePanel Scrollbar isVisible
« Reply #2 on: June 10, 2013, 11:49:53 PM »
The size of my highlight sprite and a couple buttons are conditional if the scrollbar is visible.  I am using 2 different prefabs for the grid rows and disabling the 2 up/down scrollbar buttons.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDraggablePanel Scrollbar isVisible
« Reply #3 on: June 11, 2013, 04:04:55 PM »
Why not check UIScrollBar's barSize instead? It will be 1 if the window is able to fit everything, and non-1 if it can't.

devomage

  • Sr. Member
  • ****
  • Thank You
  • -Given: 7
  • -Receive: 67
  • Posts: 250
    • View Profile
Re: UIDraggablePanel Scrollbar isVisible
« Reply #4 on: June 11, 2013, 09:38:04 PM »
The barSize never returns a value of "1".  See attached screenshot.

  1. Debug.Log("Update = " + mypanel.verticalScrollBar.barSize);
  2.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDraggablePanel Scrollbar isVisible
« Reply #5 on: June 12, 2013, 03:50:06 AM »
Well in your case check for < 0.99 then :P