Is the Text Field good enough for this ?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Is the Text Field good enough for this ?
Hi ppl,
I'm willing to use a simple text fld to display an article content on both, Desktop and Mobile App...
Facts : due to the monitor size, on the desktop a content could be displayed as a 10 lines article.
(with X numbers of characters per line - *I do not define myself that number, LC probably does it somehow)
...on the Mobile though, I suspect it would use more lines due to readable font size...and smaller field size...
Question : if I was to count the number of lines at saving time : would the LC count function register a number of 10 lines for the Desktop versions, while it could register a number of more than 10 lines on the Mobile version ?
I would like to keep track of that number of lines, but with "equal results", whereas its beeing displayed and saved from a larger or smaller screen user, is that even possible ?
How would you treat that otherwise ?
PS: I've seen there is a formated text function, hence the question about the "field text" use instead...
*I already have records on the total number of characters for the content... but I'm now looking for "some" number of lines if doable...
graciasss !
I'm willing to use a simple text fld to display an article content on both, Desktop and Mobile App...
Facts : due to the monitor size, on the desktop a content could be displayed as a 10 lines article.
(with X numbers of characters per line - *I do not define myself that number, LC probably does it somehow)
...on the Mobile though, I suspect it would use more lines due to readable font size...and smaller field size...
Question : if I was to count the number of lines at saving time : would the LC count function register a number of 10 lines for the Desktop versions, while it could register a number of more than 10 lines on the Mobile version ?
I would like to keep track of that number of lines, but with "equal results", whereas its beeing displayed and saved from a larger or smaller screen user, is that even possible ?
How would you treat that otherwise ?
PS: I've seen there is a formated text function, hence the question about the "field text" use instead...
*I already have records on the total number of characters for the content... but I'm now looking for "some" number of lines if doable...
graciasss !
-
- VIP Livecode Opensource Backer
- Posts: 9660
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Is the Text Field good enough for this ?
Hi.
I do not develop for mobile.
But if you ask LC for the number of lines in a field, you will get one answer, regardless of which platform you build for.
So your question, I think, is all about displaying data, not getting field properties. Formatting for different screen sizes is its own task, and others will chime in on the special things required to do that for mobile devices.
I am not sure this is helpful.
Craig
I do not develop for mobile.
But if you ask LC for the number of lines in a field, you will get one answer, regardless of which platform you build for.
So your question, I think, is all about displaying data, not getting field properties. Formatting for different screen sizes is its own task, and others will chime in on the special things required to do that for mobile devices.
I am not sure this is helpful.
Craig
Re: Is the Text Field good enough for this ?
I have not built the app to test it on mobile yet.
but let's take this example, if I would ask some kids to writte a line poems, some using PC, tablets or a mobile to do so,
I would need to find a way to count those 5 lines. In a console/terminal window - if I remember - a line is aprox. 80 char.
Its fine for me if LC does count 80 chars or so per lines, as long as it does it whatever screen's size it (wrapping text as it has to be depending the device) it will display the content on...
So I guess a better question would be :
- Does LC uses a predifined numbers of char per line, no matter whatever screen size the content displays on ?
but let's take this example, if I would ask some kids to writte a line poems, some using PC, tablets or a mobile to do so,
I would need to find a way to count those 5 lines. In a console/terminal window - if I remember - a line is aprox. 80 char.
Its fine for me if LC does count 80 chars or so per lines, as long as it does it whatever screen's size it (wrapping text as it has to be depending the device) it will display the content on...
So I guess a better question would be :
- Does LC uses a predifined numbers of char per line, no matter whatever screen size the content displays on ?
Re: Is the Text Field good enough for this ?
Hi,
- either not wrap at all (means part of the text may "vanish" at the right),
- or wrap at the edge of the field, keeping words together.
Text width can differ a lot on different platforms, even if the same font is available.
A way to get some numbers:
No. Depending on the property "dontWrap" it will:
- either not wrap at all (means part of the text may "vanish" at the right),
- or wrap at the edge of the field, keeping words together.
Text width can differ a lot on different platforms, even if the same font is available.
A way to get some numbers:
Code: Select all
on mouseUp
lock screen
put the text of fld "1_fld" into mySave
put "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ_1234567890 " & CR into fld "1_fld"
get the formattedwidth of line 1 of fld "1_fld"
put mySave into fld "1_fld"
unlock screen
-- now we have the measure:
answer "Field width: " & the width of fld "1_fld" & CR & \
"Text width: " & it
end mouseUp
- Make a field "1_fld", and a button. Copy the button script, and klick. Adjust field width to match text width.
- Now attach mobile, use "Development/Test".
- Click button on mobile, and use the resulting values to calculate & adjust "textSize" for mobile.
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
Re: Is the Text Field good enough for this ?
Uiihhh ...okay, thks I 'll test that next...
not a straghtforward sol to this it seems....hmm...I'll see.maybe I can make my own - theorical equivalent line counts,
counting char/80char per line instead. As if the input fld was a paper page with a fix number of char..and all lines content being added in sequence....
Or maybe auto-split a content at input time... some average system anyway.
Tks for the lights !
not a straghtforward sol to this it seems....hmm...I'll see.maybe I can make my own - theorical equivalent line counts,
counting char/80char per line instead. As if the input fld was a paper page with a fix number of char..and all lines content being added in sequence....
Or maybe auto-split a content at input time... some average system anyway.
Tks for the lights !
-
- VIP Livecode Opensource Backer
- Posts: 4001
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Is the Text Field good enough for this ?
If I understand correctly you want to make sure there are 5 lines, regardless of wrapping due to different width of fields.
I that case the "number of lines of field x" will always be the same because for LC a line is terminated by a return.
If you want to know the _apparent_ number of lines of a text field that has wrapped lines you can use the formattedText and ask for the number of lines of the formatted text. You can do this in a variable.
Code: Select all
put the formattedText of field 1 into tVar
put the number of lines of tVar
Kind regards
Bernd
Re: Is the Text Field good enough for this ?
Thanks Bernd, yes thats exactly what I was hopping to do...
I dont know yet what would the implication be with this extra "return symbol" on each lines...
might be problematic later down the road...I will think about it more...
tks a lot
I dont know yet what would the implication be with this extra "return symbol" on each lines...
might be problematic later down the road...I will think about it more...
tks a lot
-
- VIP Livecode Opensource Backer
- Posts: 9660
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Is the Text Field good enough for this ?
Hi.
Be aware that when clearing the "dontWrap" property, LC will only break lines where spaces (ASCII 32) are embedded. Otherwise, a long run-on string of chars will still continue out of the right side of the field. You might play with this for a minute; it takes a little practice...
Craig
Be aware that when clearing the "dontWrap" property, LC will only break lines where spaces (ASCII 32) are embedded. Otherwise, a long run-on string of chars will still continue out of the right side of the field. You might play with this for a minute; it takes a little practice...
Craig
Re: Is the Text Field good enough for this ?
Hi, try to use segment and / or paragraph instead of counting the lines.
If you can ask the children to write their poems and count the segments. In this way, you will not have to take into account the number of lines that each poem has, or on which platform it was written.
dontWrap to true
If you can ask the children to write their poems and count the segments. In this way, you will not have to take into account the number of lines that each poem has, or on which platform it was written.
dontWrap to true
Re: Is the Text Field good enough for this ?
thks Guys, lots of unexplored ways for that still in LC !