Req: Text Viewer in ruby with scroller

Post any examples or modules that you want to share here
User avatar
Walter Sommerfeld
Posts: 250
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany
Contact:

Req: Text Viewer in ruby with scroller

Post by Walter Sommerfeld »

I'm a little lost in the text scroller thingy

I have some knowledge of String (array), file & bitmap handling in ruby...

but this scroller isn't easy for me...
especially maybe with a redraw limiter inside?!

Any help is greatly appreciated.
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

Re: Req: Text Viewer in ruby with scroller

Post by Nubeat7 »

you can use the measureString methode for this, you can get the bounds of the area which the text would need with this (user guide page 164 for more detailed info)

while it looks like that it doesnt measure the width 100% right!?
you can see this if you change the fontsize from 2 to 2.2 it gets the right width with 2.2 but it cuts a little bit from the last t with a fontsize of 2.0
Attachments
measure text ruby.fsm
(3.03 KiB) Downloaded 1325 times
Last edited by Nubeat7 on Mon Sep 01, 2014 10:05 pm, edited 1 time in total.
User avatar
Walter Sommerfeld
Posts: 250
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany
Contact:

Re: Req: Text Viewer in ruby with scroller

Post by Walter Sommerfeld »

Hi nubeat,

thanks for ur fine source... like the scroll sliders!
I really simply overlooked the Measuring Text part in the manual (just looked 2 pages further ;-)

cheers,
Danke,
Walter
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

Re: Req: Text Viewer in ruby with scroller

Post by Nubeat7 »

you are welcome Walter, i wouldn't have looked for it without your question, luckely there is this new setViewSize methode in 3.05 what i wanted to try but couldn't find some useful stuff for it, till now! :)

i reuploaded the schematic with variable slider size, so that the slider size is in relation to the shown window and the content size window, so the slider size gets smaller the more way to scroll..
User avatar
Walter Sommerfeld
Posts: 250
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany
Contact:

Re: Req: Text Viewer in ruby with scroller

Post by Walter Sommerfeld »

Even more awesome :)

setViewSize is really a tricky thing - i like it very much - good work!

Keep on doing!
billv
Posts: 1165
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia
Contact:

Re: Req: Text Viewer in ruby with scroller

Post by billv »

@nubeat7
re:measuretextruby-2.fsm

Tried dragging it into my toolbox...instant crash
saved file/reopened...tried again....instant crash

XP/3.05 Amber

Havn't looked through file yet...
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

Re: Req: Text Viewer in ruby with scroller

Post by Nubeat7 »

it looks like the toolbox doesn't like it when view is maximized, so just minimize theview on the top level and it should work..
billv
Posts: 1165
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia
Contact:

Re: Req: Text Viewer in ruby with scroller

Post by billv »

Thanks mate,
Yeh, that works, I got some results also disconnecting some yellow stuff, while trying to work
it out. Still can't work it out though...and the need for minimizing gui??
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

Re: Req: Text Viewer in ruby with scroller

Post by Nubeat7 »

its the setViewSize methode, i think its because the dynamic resizing of the view, but you can get rid of it too, then you just need to take care that the containing window is greater or equal to the max text area (which is defined in the measureString methode)
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

Re: Req: Text Viewer in ruby with scroller

Post by Nubeat7 »

here is an updated version, which doesn't use the setViewSize methode (so it should work with fs 3.04 too), the maximum text area is the size of the text window, i think this is a better solution for it anyway because like this you don't need to change the max text area at the stringMeasure methode,

i also integrated a properties panel where you can set textsize, font, margins and colors...
Attachments
measure text ruby1.fsm
(5.25 KiB) Downloaded 1356 times
Post Reply