ios text objects

Moderators: LCNeil, heatherlaine, kevinmiller, elanorb

Post Reply
peramangk
Posts: 22
Joined: Wed Jul 04, 2007 11:45 am
Location: South Australia

ios text objects

Post by peramangk » Thu Mar 20, 2014 2:45 am

I have used a basic livecode field in an app designed for ios.
It has the following capabilities -
- can be locked - allows users to scroll and select a line which then changes the contents of another text field
- can be unlocked - users can then enter text as required
- its contents can be set by scripts on other objects, e.g. inserting text from the custom properties of a field on another card
- its contents can be referenced by line, word, item etc to manipulate the contents in a variety of ways.


It works perfectly but doesn't look 'native' on an ipad.

I've tried using a multiline object from mobgui (ver 0.29) but can not get it to function as above.
e.g. I spent ages on 'mgtext' before finding out that 'utext' works better.
LockText is particularly useful for standard fields but doesn't apply to multiline objects.

What type of object should I be using?
What commands and properties would I use to control it?

Regards,
Byte

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: ios text objects

Post by LCNeil » Thu Mar 20, 2014 11:47 am

Hi Byte,

LiveCode fields can be visually changed to replicate the look and feel of Native mobile fields. There are various properties of a LiveCode field that you can disable to achieve this and these can be easily accessed via an objects property inspector. These are-

-Focus Border
-Three Dimensional
-Show Border

You can also turn opaque off and use a graphic object as a background to your field. This could give a more visually appealing mobile look (e.g.rounded rectangle graphic)

In regards to using a native mobile text input field, the following are the available options that you can set for these type of fields.

Code: Select all

Text Input Specific Properties
•	text - The content of the control (maps to the native text property). This is a string value.
•	unicodeText - The content of control encoded as UTF-16 (maps to the native text property). This is a binary value.
•	textColor - The color to use for the text in control (maps to the native textColor property). This is either a standard color name, or a string of the form red,green,blue or red,green,blue,alpha. Where the components are integers in the range 0 to 255.
•	fontName (iOS only) - The name of the font to use for text in the control. This is a string value.
•	fontSize - The size of the font to use for text in the control. This is an integer value.
•	textAlign - The alignment to use for text in the control (maps to the native textAlignment property). One of:
	◦	left   
	◦	center   
	◦	right   
•	autoFit (iOS only) - Determines whether the size of the text is scaled so that it fits within the width of the control down to the size specified by the minimumFontSize property (maps to the native adjustsFontSizeToFitWidth property). This is a boolean value.
•	minimumFontSize (iOS only) - The minimum size text should be shrunk to satisfy autoFit requirements (maps to the native minimumFontSize property). This is an integer value.
•	autoClear (iOS only) - Determines whether the control is emptied automatically when editing begins (maps to the native clearsOnBeginEditing property). This is a boolean.
•	clearButtonMode (iOS only) - The display mode of the standard 'clear' button overlay (maps to the native clearButtonMode property). This is one of the following:
	◦	never - never display the clear button   
	◦	while editing - only display the clear button while editing   
	◦	unless editing - only display the clear button when not editing   
	◦	always - always display the clear button   
•	borderStyle (iOS only) - The type of border to draw around the control (maps to the native borderStyle property). This is one of the following:
	◦	none - do not draw a border   
	◦	line - draw a thin line around the control   
	◦	bezel - draw a bezel-style border around the control   
	◦	rounded - draw a rounded rectangle style border around the control   
•	autoCapitalizationType - Determines when the shift-key is automatically enabled (maps to the native autocapitalizationType property). This is one of the following:
	◦	none - the shift-key is never automatically enabled   
	◦	words - the shift-key is enabled at the start of words   
	◦	sentences - the shift-key is enabled at the start of sentences   
	◦	all characters - the shift-key is enabled at the start of each character   
•	autoCorrectionType - Determines whether auto-correct behavior should be enabled (maps to the native autocorrectionType property). This is one of the following:
	◦	default - use the appropriate auto-correct behavior for the current script system   
	◦	no - disable auto-correct behavior   
	◦	yes - enable auto-correct behavior   
•	manageReturnKey (iOS only) - Determines whether the return key should be automatically enabled or disabled based on whether the control has content or not (maps to the native enablesReturnKeyAutomatically property). This is a boolean value.
•	keyboardStyle (iOS only) - Determines what kind of appearance the keyboard has (maps to the native keyboardAppearance property). This is one of the following:
	◦	default - the standard keyboard appearance   
	◦	alert - the keyboard that is suitable for an alert panel (iPhone/iPod only)   
•	keyboardType - Determines what kind of keyboard should be displayed (maps to the native keyboardType property). This is one of the following:
	◦	default - the normal keyboard   
	◦	alphabet - the alphabetic keyboard   
	◦	numeric - the numeric keyboard with punctuation   
	◦	URL - the URL entry keyboard   
	◦	number - the number pad keyboard   
	◦	phone - the phone number pad keyboard   
	◦	contact - the phone contact pad keyboard   
	◦	email - the email keyboard   
	◦	decimal - the decimal numeric pad keyboard (iOS 4.1+)   
•	returnKeyType - Determines what kind of return-key the keyboard should have (maps to the native returnKeyType property). This is one of the following:
	◦	default - the normal return key   
	◦	go - the 'Go' return key   
	◦	google - the 'Google' return key   
	◦	join - the 'Join' return key   
	◦	next - the 'Next' return key   
	◦	route - the 'Route' return key   
	◦	search - the 'Search' return key   
	◦	send - the 'Send' return key   
	◦	yahoo - the 'Yahoo' return key   
	◦	done - the 'Done' return key   
	◦	emergency call - the 'emergency call' return key   
•	contentType - Determines what kind of content the control contains. This is one of the following:
	◦	plain - plain, unstyled text   
	◦	password - plain text displayed in the standard iOS password style   
•	enabled - Determines whether the control is enabled or not. This is a boolean value.
•	multiline (Android only) - A boolean value which determines whether the control can contain multiple lines of text, wraps text to fit horizontally, and scrolls vertically. If false, the field contains a single line of text which can scroll horizontally.
 
Additional commands/functions can be found in the LiveCode dictionary under mobileControlDo, mobileControlSet and mobileControlGet

Kind Regards,


Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——

Post Reply

Return to “idea2app and Coding School”