Can you dynamically bind the height of a text box inside a scroll collection?

Hi all!

I’m making a wayfinder and I have description text of different POIs (i.e.- “The Rock Museum was built in 1978 and features displays of different rocks…”), however some of the descriptions are rather long. I’d like to have the text block inside a scroll collection be dynamically bound (by height) so that if there is more text for a certain POI, it will all be available to scroll through. However, if the description is shorter, I want the text block to be shorter, so the user doesn’t have the ability to keep scrolling through “dead space” at the end… which would be what happens if I were to just make a text box be a specific height so that it fits the longest description.

Does this make sense? If not, I can do a screen capture of what I would like.

I see that there was a wish list poll for a feature like this to be natively put into IF, but it doesn’t look like anything has happened with it, so I’d like to know if there is a way that I can do this myself somehow.

Thanks in advance!

Megan

Hi Megan,

There are a few workarounds.

The first one, the “lazy” one if you have an Excel as Data Feed, would be to add a column “Height” and put inside, by hand, the height you want for your text box according to your content size. Then use a binding between this new column and your Asset’s height.

The second one, the “half-lazy”, would be to add the same column in Excel but instead of putting an “hard value” for height by hand, would be to use a formula in order to have an height relative to the number of lines.

I used a very simple formula but you can tweak it:
=(LEN(A2)-LEN(SUBSTITUTE(A2;CHAR(10);"")))*40+40

Some explanations:

  • CHAR(10) is a special character, the carriage return, or line break
  • (LEN(A2)-LEN(SUBSTITUTE(A2;CHAR(10);""))) is basically the formula that will return the number of lines
  • numbers at end: *40+40 will provide an height based on the number of lines

If you use the formula in an Excel worksheet, it will look like that.

Now you can use bindings to these “dynamic” heights :tada:

The last version, the “brave” one (I won’t detail it) would be to use this type of formula … not in Excel but directly in Intuiface with a Custom Script Converter and Javascript (might be a bit tedious). :grin:

Side-note: I’ve used a formula that calculates the Height based on number of line breaks, another way would be to compute it based on the number of characters, but this formula would be a little less obvious to find.

Kind regards,

Alex.

5 Likes

HOORAY! Thanks as always, @Alex! You’re a lifesaver. Or rather… sanity saver, ha! :wink: That was just what I needed.

Megan

1 Like

Just a thought @megan, why not consider a HTML Frame, and simply apply overflow to the CSS Portion.
The content can still come from your CMS or Excel.

In the CSS simply define your content styles, and most importantly the overflow-y attribute.

body {font-family: Segoe UI;text-align: left;margin-top:60px; overflow-y: auto;}
h1{font-size: 45px}
p { font-size: 24px}

@Ryan- Thank you for the suggestion! Unfortunately, I’m still trying to learn CSS (I’m a video editor by trade… all of this IF and HTML and CSS is new to me within the past year or so!), so I’m going to use Alex’s “lazy” method. Hopefully I’ll get better in the future enough that I can try out yours, though. :slight_smile:

1 Like

@megan

Haha no worries at all… in any case I’ve attached a simple example to show you the simplicity of using the HTML Frame. Just unzip and check it out.

Happy to help with any web queries if you need, I’m predominantly web/multimedia based (doing some Drone & film too =) so i understand where you’re coming from.

AdaptableScroll.zip (7.5 MB)

2 Likes

@Ryan

AH! Thanks! I’m definitely going to check it out.

Also, tell the Kitteh that I say Meow back. :wink: