Author Topic: Multiple fonts and Scrollview  (Read 3465 times)

cayou

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 3
  • Posts: 90
    • View Profile
Multiple fonts and Scrollview
« on: January 08, 2013, 03:30:37 PM »
Hi everybody,
I know that a package with dynamic font could resolve this, but until that I would like to change the font of a UILabel into a scrollview.
What I need is to refresh the Scrollview when I change the UILabel size, right now I have to click into the UIScrollbar or into the text to move it.
How can I do by scripting?

Thanks !

cayou

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 3
  • Posts: 90
    • View Profile
Re: Multiple fonts and Scrollview
« Reply #1 on: January 08, 2013, 03:33:22 PM »
Ho, and this "issue" appears only when the text is scrolled down and you try to change the font by using a smaller one and then call MakePixelPerfect.

Ferazel

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 150
    • View Profile
Re: Multiple fonts and Scrollview
« Reply #2 on: January 08, 2013, 03:41:10 PM »
Just a thought, but have you tried to refresh the panel? I think it recalculates the bounds of the view when it does so. So on a DraggablePanel.panel.Refresh()?

cayou

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 3
  • Posts: 90
    • View Profile
Re: Multiple fonts and Scrollview
« Reply #3 on: January 08, 2013, 04:00:34 PM »
Thanks for you answer, but it doesn't work.
Everything is fine if when you scale down the UILabel, it still fits into the scrollview, but if not, you have to click and drag to refresh it.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Multiple fonts and Scrollview
« Reply #4 on: January 08, 2013, 08:35:38 PM »
Seeing as the scroll view has nothing to do with object positioning, I am going to assume you're adding labels to a table. You need to tell the table when it should recalculate its bounds. Check to see what TweenScale does, for example.

cayou

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 3
  • Posts: 90
    • View Profile
Re: Multiple fonts and Scrollview
« Reply #5 on: January 09, 2013, 12:05:46 PM »
I'm not using a table, or grid.
You can easily try it by adding a UILabel to a UIDraggablePanel, and while playing the scene try to scale down the UILabel when is totally on bottom (the UILabel is Top-Left anchored).
When the UILabel disappears from UIPanel clipping view the scrollbar disappears also, and you'll need to click into the scrollbar field, or into the UIPanel field to "refresh" it and see the UILabel again.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Multiple fonts and Scrollview
« Reply #6 on: January 09, 2013, 03:20:35 PM »
Right, because you need to inform the draggable panel that the dimensions of the contents have changed.

cayou

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 3
  • Posts: 90
    • View Profile
Re: Multiple fonts and Scrollview
« Reply #7 on: January 10, 2013, 01:58:06 PM »
And how can I inform by scripting this information?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Multiple fonts and Scrollview
« Reply #8 on: January 10, 2013, 05:30:07 PM »
In the UITable, when you call Reposition(), it does this:
  1.                         if (mDrag != null)
  2.                         {
  3.                                 mDrag.UpdateScrollbars(true);
  4.                                 mDrag.RestrictWithinBounds(true);
  5.                         }
  6.                         else if (mPanel != null)
  7.                         {
  8.                                 mPanel.ConstrainTargetToBounds(myTrans, true);
  9.                         }
"mDrag" being a UIDraggablePanel, and "mPanel" being just a UIPanel. As I mentioned, try to follow the chain of events from TweenScale. It goes through all of this.

cayou

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 3
  • Posts: 90
    • View Profile
Re: Multiple fonts and Scrollview
« Reply #9 on: January 11, 2013, 02:22:29 PM »
I'll try it, thank you !

cayou

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 3
  • Posts: 90
    • View Profile
Re: Multiple fonts and Scrollview
« Reply #10 on: January 18, 2013, 01:44:21 PM »
Okay, this is working except when if I scale down the item into the panel when the scroll position is at the bottom the item is not replaced correctly.
On other cases it's okay.

This issue is not critical, but if I can get a way to resolve this, it could be great :)
BTW I'll keep searching some useful functions to call to resolve this in my side.