Req: Text Viewer in ruby with scroller

Post any examples or modules that you want to share here
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 »

Ok, I Havn't used setviewSize yet....
Thanks Nubeat7...nice work..straight in the toolbox...all good. :)
Perfect Human Interface
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Re: Req: Text Viewer in ruby with scroller

Post by Perfect Human Interface »

Oh this is cool. Nice work Nubeat.
I tried changing window sizes and it didn't go very well though (using version 3.0.4). Also it would be nice if the scrollbar mouse interaction could be based on exact mouse position so it doesn't scroll slower or faster than the cursor.
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 »

Perfect Human Interface wrote:I tried changing window sizes and it didn't go very well though (using version 3.0.4).

what do you mean with that?
just unlock the parent window and set the size you need for text window and sliders..

Perfect Human Interface wrote:Also it would be nice if the scrollbar mouse interaction could be based on exact mouse position so it doesn't scroll slower or faster than the cursor.


you can change the sensitivity in the properties panel... 5 is the value you would need for that
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 »

Nubeat7 wrote:
Perfect Human Interface wrote:I tried changing window sizes and it didn't go very well though (using version 3.0.4).

what do you mean with that?
just unlock the parent window and set the size you need for text window and sliders..


if you dont want to change this by hand all the time you can also include the sliders into the scroll area like i did here in the older scroll and zoom version - if you click and drag in the lower right corner you can scroll x&y at the same time with this ;)
Attachments
scroll and zoom.fsm
(153.52 KiB) Downloaded 1279 times
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 »

perfect nubeat! :o

btw: any chance to check in ruby that a Bitmap is done loading?
I tried this with a bitmap array but got to much (wrong) triggers... :(

U know: Give somebody an inch, and he will take a mile. ;)
Perfect Human Interface
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Re: Req: Text Viewer in ruby with scroller

Post by Perfect Human Interface »

Ah I see now. Yeah it might be nice if the bars just scaled with the view size (complicated as that may be) but this works just fine! Maybe you could add an option to remove the X slider in the properties, since you'd probably rather set the text area to width and use word-wrap. Although I did notice that the word wrap didn't work quite right in some cases and would cut off some letters.
TheOm
Posts: 103
Joined: Tue Jan 28, 2014 7:35 pm
Location: Germany

Re: Req: Text Viewer in ruby with scroller

Post by TheOm »

I also made a simple one. It's just like the "green" version.
Attachments
text view.fsm
(1.4 KiB) Downloaded 1345 times
Last edited by TheOm on Wed Sep 03, 2014 6:26 pm, edited 1 time in total.
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 »

thanks Om, thats nice, whats that methode for ? setTextRenderingHint "clearTypeGridFit" and where did you know about it?
TheOm
Posts: 103
Joined: Tue Jan 28, 2014 7:35 pm
Location: Germany

Re: Req: Text Viewer in ruby with scroller

Post by TheOm »

I read about it in the User Guide. I think it sets what method is used for Text smoothing and hinting.
I played around with it and found that at least on my PC the modes "off" and "clearTypeGridFit" look much clearer and less blurry than the antiAlias modes, which are the default.
User avatar
DaveyBoy
Posts: 131
Joined: Wed May 11, 2016 9:18 pm
Location: Leeds UK

Re: Req: Text Viewer in ruby with scroller

Post by DaveyBoy »

I know this is a really old post but I came across this phenomenon in one of my current projects.

From Nubeat7's original reply:
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


Page 165 of the user manual solves this:
Flag = 2048
Specifies that the space at the end of each line is included in a string measurement. By default, the
boundary rectangle returned by the Graphics::MeasureString method excludes the space at the end of
each line. Set this flag to include that space in the measurement.


Thought I'd mention this as it may help someone else :)
Post Reply