Change Font Color In Textbox Problem

This is the place to discuss anything relating to MobGUI

Moderators: heatherlaine, kevinmiller, robinmiller, malte, splash21

Post Reply
Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Change Font Color In Textbox Problem

Post by Mikey » Thu Mar 08, 2012 2:32 pm

I wanted to implement one of the textboxes as follows:
When the box is empty, I display some default help text in a light grey color - for example, for a phone number it might say "7 digits, no area code"
When the user taps the box to edit it, the text disappears, the text color changes to black, and thus anything the user types on the keyboard shows in black.

The only part of this that does not work is switching the text color. I have tried putting a script in the field, and I have tried using a button to manually change the color of the text in the field, but no dice.

The magic code is
set the uuiTextField["textColor"] of group "test1" to 0,0,0

And to prove that it works,
answer the uuiTextField["textColor"] of group "test1"


I get the 0,0,0 reply but the text color is not different.

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm
Location: Switzerland

Re: Change Font Color In Textbox Problem

Post by gpb01 » Thu Mar 08, 2012 5:51 pm

Code: Select all

set the uuiTextField["textColor"] of group "test1" to 0,0,0
Never done, but ... are you sure about the syntax ? Have you see here : http://mobgui.com/doc.php?docId=26 ?

For 'text native controls' I think that you have to use or the "iphoneControlSet" syntax or the "mobFieldSet" ...

Guglielmo

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Change Font Color In Textbox Problem

Post by Mikey » Thu Mar 08, 2012 6:20 pm

Aha! That works. Apparently the documentation needs to be updated -- the documentation for the native text field at http://mobgui.com/doc.php?docId=11 was what I was using. Thanks!

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm
Location: Switzerland

Re: Change Font Color In Textbox Problem

Post by gpb01 » Thu Mar 08, 2012 6:37 pm

Happy to have helped :)

Guglielmo

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Change Font Color In Textbox Problem

Post by Mikey » Thu Mar 08, 2012 9:47 pm

Nope. I spoke too soon. A field does not appear to be able to set its own textColor. Back to square 1.

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Change Font Color In Textbox Problem

Post by Mikey » Thu Mar 08, 2012 9:50 pm

Spoke too soon again - you CAN use this technique BUT you cannot use ME as the target. You have to spell the name out

Post Reply

Return to “MobGUI”