Source language: Translate to:

Resize App

General questions about NeoBook

Moderator: Neosoft Support

Resize App

Postby StarterPack » Sun Apr 30, 2017 3:34 am

Hi guys
I want to add text in variable (MultiLineSelected). I need script to read which line is the longest and then resize my app width to that size

Example

We'll do it all, Everything, On our own
We don't need, Anything, Or anyone
If I lay here, If I just lay here
Would you lie with me, And just forget the world

So the 4th Line is the longest
I need my app to change to that size so the 4th line will just fit in

and the same for the height

If it's possible. Thank You
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: Resize App

Postby HPW » Sun Apr 30, 2017 6:05 am

Hello,

Quite unclear what you want.
Do you like to check the number of characters in each line?
Then StrParse the Content and messure each line with StrLen.

When you want to know the graphical size of the text then it is more complicated.
Which textfont and is it has it proportional spacing?

Do you want to resize the app-window or an text-object?

Regards
Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Re: Resize App

Postby StarterPack » Sun Apr 30, 2017 11:31 am

Hi HPW

What I want to do is to Print [PrintPage] the lyrics. But the problem is that when the lyrics are greater in length than the page in my app then PrintPage does not Print the lyrics that are greater then the screen. It only prints what's on screen. So I must fit everything in the page so it can Print it. Also if "Window Style - Sizeable" is enable and I drag my windows app close to the longest line of lyrics. Then It will print the Lyrics full page.

So I need script to see which line of lyrics is the longest, and then tell my app to size the length (Width) of the longest line.

Line 1: We'll do it all, Everything, On our own
Line 2: We don't need, Anything, Or anyone
Line 3: If I lay here, If I just lay here
Line 4: Would you lie with me, And just forget the world

Line 4 is the longest

Hope i explain it right

Thank You
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: Resize App

Postby Gaev » Sun Apr 30, 2017 12:29 pm

StarterPack:

a) You must use fixed width Fonts for this ... that means that the width of fat letters (like M and W) occupy same width as skinny letters (like i and l) ... the way output from typewriters looked.

Here is an example with fixed width font ...
Code: Select all
QWERTY
iiiiii


Here is the same text using variable width font ...
QWERTY
iiiiii


b) then, you have to figure out how many pixels per character ... easiest way would be to calibrate it by using a very long sentence.

c) Finally, as HPW suggested, you find out the number of characters in the longest line ... and do the Math to obtain the width of the object/app/screen.
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Resize App

Postby StarterPack » Sun Apr 30, 2017 12:46 pm

Thank You Gaev. I'll Try That
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 2 guests