PDA

View Full Version : Simple example of wrapping text label with scroll bar?



zuilin
October 13th, 2020, 08:24
I have a window that can display some text. The text can be any size and so may require multiple lines to display. I'd like to be able to display all the text, and if it doesn't fit in the windows current size, have the field show a scroll bar on the right. This is exactly the way a Story or Note text field works. However, both of those seem to be built on frames and I can't figure out how to duplicate the functionality on my simple text label field. (I'm calling it a label because you can't edit the text--it's for display only, but that may not be the right term in FG terms.)

Can anyone point me to a good XML example in CoreRPG or 5E or an extension or anything that I can look at to see how this is done? I've searched and searched.

Thanks.

SilentRuin
October 13th, 2020, 17:01
I have a window that can display some text. The text can be any size and so may require multiple lines to display. I'd like to be able to display all the text, and if it doesn't fit in the windows current size, have the field show a scroll bar on the right. This is exactly the way a Story or Note text field works. However, both of those seem to be built on frames and I can't figure out how to duplicate the functionality on my simple text label field. (I'm calling it a label because you can't edit the text--it's for display only, but that may not be the right term in FG terms.)

Can anyone point me to a good XML example in CoreRPG or 5E or an extension or anything that I can look at to see how this is done? I've searched and searched.

Thanks.

If you do a search on "scroll" you can see some examples of scroll fields like this... but I believe all are frame based.



<scrollbar_record>
<target>text</target>
</scrollbar_record>


Maybe if you delve into the templates they are using you can find some core code - but that's the only suggestion on how to find that I can think of.

zuilin
October 13th, 2020, 17:09
Thanks. I'll muck around and see what I can make work.

Trenloe
October 13th, 2020, 19:13
Here's information on the scrollbar control: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGU/pages/4162295/scrollbarcontrol

You set the target control that this will be attached to.

In CoreRPG (and rulesets layered on top) there's a template called scrollbar that has the code to set it to the right of the control it's anchored to. It's used with the control name to anchor to and the (same) control name as the target. For example, to add a scrollbarcontrol to the right side of a control called mytextlabel, use:


<scrollbar>
<anchored to="mytextlabel" />
<target>mytextlabel</target>
</scrollbar>

zuilin
October 13th, 2020, 19:15
Simple enough. Thanks!