Author Topic: How to center on an item in a scroll list  (Read 5579 times)

primus88

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 50
    • View Profile
How to center on an item in a scroll list
« on: June 10, 2014, 02:48:58 PM »
Hello,

I have something like a journal implemented in my game.
This journal is in fact a list of topics on one side included in a scrolling list. It works ok as if i click a topic, on the right side the respective detailed journal entry appears.
What I need extra is that if for example I unlock a new journal entry (topic), when I open the list of topics, on the right side I already have the latest unlocked journal entry.

Right now, no matter how many topics I unlock, when I open the scrolling list, only the first one is opened by default.

Thanks

primus88

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 50
    • View Profile
Re: How to center on an item in a scroll list
« Reply #1 on: July 08, 2014, 04:28:03 AM »
Anyone, please?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to center on an item in a scroll list
« Reply #2 on: July 08, 2014, 12:20:51 PM »
Have you looked at UICenterOnClick script? It does just that.

primus88

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 50
    • View Profile
Re: How to center on an item in a scroll list
« Reply #3 on: July 08, 2014, 01:37:54 PM »
No, it's not that. I already have this script attached.

Ok, let me put it another way. You know the UIToggledObjects ? Well i use that in order to have a label shown when i click on the tab.
It works very nice, but what I want is that when I open this dragable list, to have already the latest label shown, instead of always having the first one, no matter how many newer labels I have.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to center on an item in a scroll list
« Reply #4 on: July 09, 2014, 02:44:44 PM »
Right, I mean the code to do what you want is in UICenterOnClick. If you want it to navigate to a specific label, just look at the code used in that script and do the same thing.