Page 1 of 3

Req: Text Viewer in ruby with scroller

PostPosted: Sun Aug 31, 2014 7:37 pm
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.

Re: Req: Text Viewer in ruby with scroller

PostPosted: Mon Sep 01, 2014 9:14 pm
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

Re: Req: Text Viewer in ruby with scroller

PostPosted: Mon Sep 01, 2014 9:54 pm
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

Re: Req: Text Viewer in ruby with scroller

PostPosted: Mon Sep 01, 2014 10:11 pm
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..

Re: Req: Text Viewer in ruby with scroller

PostPosted: Mon Sep 01, 2014 11:01 pm
by Walter Sommerfeld
Even more awesome :)

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

Keep on doing!

Re: Req: Text Viewer in ruby with scroller

PostPosted: Tue Sep 02, 2014 7:27 am
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...

Re: Req: Text Viewer in ruby with scroller

PostPosted: Tue Sep 02, 2014 8:58 am
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..

Re: Req: Text Viewer in ruby with scroller

PostPosted: Tue Sep 02, 2014 10:26 am
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??

Re: Req: Text Viewer in ruby with scroller

PostPosted: Tue Sep 02, 2014 12:57 pm
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)

Re: Req: Text Viewer in ruby with scroller

PostPosted: Tue Sep 02, 2014 1:13 pm
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...