Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Req: Text Viewer in ruby with scroller

Post any examples or modules that you want to share here

Req: Text Viewer in ruby with scroller

Postby Walter Sommerfeld » Sun Aug 31, 2014 7:37 pm

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
Walter Sommerfeld
 
Posts: 249
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany

Re: Req: Text Viewer in ruby with scroller

Postby Nubeat7 » Mon Sep 01, 2014 9:14 pm

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 1159 times
Last edited by Nubeat7 on Mon Sep 01, 2014 10:05 pm, edited 1 time in total.
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: Req: Text Viewer in ruby with scroller

Postby Walter Sommerfeld » Mon Sep 01, 2014 9:54 pm

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
Walter Sommerfeld
 
Posts: 249
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany

Re: Req: Text Viewer in ruby with scroller

Postby Nubeat7 » Mon Sep 01, 2014 10:11 pm

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
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: Req: Text Viewer in ruby with scroller

Postby Walter Sommerfeld » Mon Sep 01, 2014 11:01 pm

Even more awesome :)

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

Keep on doing!
User avatar
Walter Sommerfeld
 
Posts: 249
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany

Re: Req: Text Viewer in ruby with scroller

Postby billv » Tue Sep 02, 2014 7:27 am

@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...
billv
 
Posts: 1141
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: Req: Text Viewer in ruby with scroller

Postby Nubeat7 » Tue Sep 02, 2014 8:58 am

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..
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: Req: Text Viewer in ruby with scroller

Postby billv » Tue Sep 02, 2014 10:26 am

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??
billv
 
Posts: 1141
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: Req: Text Viewer in ruby with scroller

Postby Nubeat7 » Tue Sep 02, 2014 12:57 pm

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

Re: Req: Text Viewer in ruby with scroller

Postby Nubeat7 » Tue Sep 02, 2014 1:13 pm

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 1189 times
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Next

Return to User Examples

Who is online

Users browsing this forum: No registered users and 33 guests