Page 1 of 1

Resize App

PostPosted: Sun Apr 30, 2017 3:34 am
by StarterPack
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

Re: Resize App

PostPosted: Sun Apr 30, 2017 6:05 am
by HPW
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

Re: Resize App

PostPosted: Sun Apr 30, 2017 11:31 am
by StarterPack
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

Re: Resize App

PostPosted: Sun Apr 30, 2017 12:29 pm
by Gaev
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.

Re: Resize App

PostPosted: Sun Apr 30, 2017 12:46 pm
by StarterPack
Thank You Gaev. I'll Try That