iOS scrolling text field. How?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: iOS scrolling text field. How?

Post by FireWorx » Fri May 11, 2012 8:10 pm

You know this seems so much easier for situations where you have static text to display! I do this on all my Information screens of my apps.
I use the iphoneControlCreate "multiline" command.

I don't even need to put the name of the control in a local variable and it works like a charm. Just grab an image and set it to the location you would like your scrolling text to show up at, name it "InfoRect" and make it invisible. Have your field "info" contain the text content to scroll and make it invisible too. Then the script is short and sweet.

on opencard
if the environment is "mobile" then
if "testinput" is among the lines of iphoneControls() then
inputDelete
end if
iphoneControlCreate "multiline", "testinput"
iphoneControlSet "testinput", "rect", the rect of image "InfoRect"
iphoneControlSet "testinput", "visible", true
iphoneControlSet "testinput", "fontsize", "15"
 iphoneControlSet "testinput", "text", field "info"
   iphoneControlSet "testinput","editable","false"
end if
end opencard

on closeCard
if the environment is "mobile" then iphoneControlDelete "testinput"
end closeCard

rrBUSS9EE
Posts: 98
Joined: Wed May 02, 2012 3:46 pm

Re: iOS scrolling text field. How?

Post by rrBUSS9EE » Fri May 11, 2012 10:01 pm

That is simple. 3 questions though:

1.) What is inputDelete?

2.) Is there a property to eliminate the opaque white background? I need to have this text over my own BG image.

3.) Is there a property to set the lineHeight?

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: iOS scrolling text field. How?

Post by FireWorx » Sat May 12, 2012 12:11 am

Those are good questions. I only have an answer for #1. The inputdelete was a handler where I had:

on inputdelete
iphoneControlDelete "testinput"
end input delete

Kind of a waste of code I know.

This is a good short script for a down and dirty scroller for text info. You can change the font and the scroller sets the scroll of the content on its own even after altering the font size however as far as line size? not sure. as far as background? not sure either.

Dave

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: iOS scrolling text field. How?

Post by teacherguy » Tue Jul 10, 2012 4:20 pm

A reminder to those working on retina version apps...make sure to cut your rect items in half :D

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: iOS scrolling text field. How?

Post by quailcreek » Thu Jul 03, 2014 5:23 pm

I have copied the script above from rrBUSS9EE into a button and I want to set the behavior of the scrolling field to it. I set the behavior of the field group using the script below. The behavior gets set to the button but the field doesn't scroll when tested in the sim. Everything works fine if the script executes from the card script. Is there anything in the script that would need to change for it to work in a behavior button or am I doing something wrong?

Code: Select all

on mouseUp
   set the behavior of grp "scrollGroup" of cd "Home" of this stack to the long id of \
         button "Scrolling Fld Behavior" of card "WHA Assets" of stack "WHA Assets"
end mouseUp
Thanks,
Tom
Tom
MacBook Pro OS Mojave 10.14

Post Reply