How do I change the textcolor of the selected text in a native iOS field?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
williamdesmet
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 67
Joined: Tue Jun 26, 2012 7:07 pm

How do I change the textcolor of the selected text in a native iOS field?

Post by williamdesmet » Tue Apr 13, 2021 12:24 pm

Hi there,

How do I get the selectedText of a native iOS field?
I want to change the color of the text selection in the field.

How do I adapt this code I made? (this obviously only returns the first char of the text in red)

Code: Select all

on changeColor
mobileControlDo "field1", "focus", true
put mobileControlGet ("field1", "text") into tText
put char 1 of tText into tColor 
mobileControlSet "field1" , "text", "" & tColor
mobileControlSet "field1", "textcolor", "255,0,0"
on changeColor
greetings,

William

rcmills
Posts: 43
Joined: Wed Nov 21, 2018 8:27 pm

Re: How do I change the textcolor of the selected text in a native iOS field?

Post by rcmills » Mon Apr 25, 2022 3:17 pm

I have this same problem. I would love to hear if anyone has been able to find a solution:)

Klaus
Posts: 13982
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How do I change the textcolor of the selected text in a native iOS field?

Post by Klaus » Mon Apr 25, 2022 3:24 pm

If this:

Code: Select all

mobileControlSet "nameofnativefield", "textcolor", "255,0,0"
as shown in the dictionary, does not work, then I would consider this a bug!

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9960
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: How do I change the textcolor of the selected text in a native iOS field?

Post by FourthWorld » Mon Apr 25, 2022 4:21 pm

Klaus wrote:
Mon Apr 25, 2022 3:24 pm
If this:

Code: Select all

mobileControlSet "nameofnativefield", "textcolor", "255,0,0"
as shown in the dictionary, does not work, then I would consider this a bug!
That sets the textColor for all text in the field. I am not aware of any text styling capabilities in LC for specific runs of text.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Klaus
Posts: 13982
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How do I change the textcolor of the selected text in a native iOS field?

Post by Klaus » Mon Apr 25, 2022 4:44 pm

Oh, sorry, then I misunderstood the question.

Post Reply

Return to “iOS Deployment”