How speak directly text of native multiline ?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

How speak directly text of native multiline ?

Post by jmburnod » Sun Feb 22, 2015 7:42 pm

Hi All,
I know how speak a text of a native multiline control (Thanks again Dixie) and select chunk (with selectedrange)
The next step would be speak directly the selected text
Is there a way to do that ?
Best regards
Jean-Marc
https://alternatic.ch

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: How speak directly text of native multiline ?

Post by jmburnod » Tue Mar 10, 2015 8:58 am

Scott,
Here is the script you asked, an adaptation of a Dixie's script.
it works fine,except you have to double click on a word to open native control cut,copy,paste,replace,define and speak and click on speak.
The next step called "doSpeakByMyexternal" is not available but you can click on the speak btn.
I hope someone can find a way to do directly
Best regards
Jean-Marc

Code: Select all

local inputID

on openCard
   if environment() <> "mobile" then exit openCard
   iphoneControlCreate "multiline"
   put the result into inputID
   iphoneControlSet inputID, "rect", the rect of grc 2
   iphoneControlSet inputID, "visible", "true"
   iphoneControlSet inputID, "opaque", "false"
   iphoneControlSet inputID, "fontName", "Helvetica"
   iphoneControlSet inputID, "fontSize", 24
   iphoneControlSet inputID, "textColor", "0,0,0"
   iphoneControlSet inputID, "borderStyle", "none"
   --iphoneControlSet inputID, "clearButtonMode", "unless editing"
   iphoneControlSet inputID, "autoCapitalizationType", "sentences"
   iphoneControlSet inputID, "autoCorrectionType", "Yes"
   iphoneControlSet inputID, "autoClear", "true"
   iphoneControlSet inputID, "text", "bonjour"
end openCard

on doSetTextInNatFld
   get fld "fText"
   put 1 & "," & the num of chars of it into tSelect
   iphoneControlSet inputID, "text", it
   iphoneControlDo inputID, "focus"
   iphoneControlSet inputID, "selectedRange", tSelect
   --•• ToDo
   -- send doSpeakByMyexternal-- not available
   --•••
end doSetTextInNatFld

on closeCard
   iphoneControlDelete inputID
end closeCard

on inputBeginEditing
--put iphonecontrolGet(inputID, "text") into fld "fDev"
--iphoneControlSet inputID, "textColor", "0,0,0"
end inputBeginEditing

on inputTextChanged
--iphoneControlSet inputID, "textColor", "0,0,0"
--put iphonecontrolGet(inputID, "text") into fld "fDev"
end inputTextChanged

on inputEndEditing
   put iphonecontrolGet(inputID, "text") into fld "fDev"
   iphoneControlSet inputID, "textColor", "0,0,0"
   --answer iphonecontrolGet(inputID, "text")
end inputEndEditing
https://alternatic.ch

scotttyang
Posts: 125
Joined: Sat Jan 31, 2009 12:01 am

Re: How speak directly text of native multiline ?

Post by scotttyang » Sun Mar 15, 2015 9:04 pm

Jean marc,

I noted below inphonecontrolset.....does it allow selection of languages, eg. Spanish. Or just the preselected language already present in iphone's preferences?

Iphonecontrolset inputid, "text","bonjour"


Scott

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: How speak directly text of native multiline ?

Post by jmburnod » Sun Mar 15, 2015 11:13 pm

Scott,
I tried change langage on my iPad prefs and it also works in english, italian, spanish. 8)
I didn't try Korean langage.
I didn't see a way to choose langage by script in LC dictionary. Is there one ?
Jean-Marc
https://alternatic.ch

Post Reply

Return to “iOS Deployment”