Make a native iOS control text transparent

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Make a native iOS control text transparent

Post by Mag » Thu Jun 27, 2013 3:00 pm

Hi all,

I'm creating a native control to display credits in iOS. As bg of the stack I have black and there is a button with an image as icon below. On top of this there is a graphic I use to specify the rect of the native control. I done some tests but it seemst to me that I can have the native filed transparent in the way you see the button below. iOS seems to ignore this statement: mobileControlSet "myControl", "opaque", "false"

Any idea?

Code: Select all

      mobileControlCreate "multiline", "myControl" 
      mobileControlSet "myControl", "rect", the rect of graphic "creditsTextDisplay"
      mobileControlSet "myControl", "text", field "creditsTextFiled" of cd "localizations" of stack "SV-Resources"
      mobileControlSet "myControl", "visible", "true"
      mobileControlSet "myControl", "editable", "false"
      
      mobileControlSet "myControl", "textColor", "200,200,200"
      mobileControlSet "myControl", "dataDetectorTypes", "link"
      mobileControlSet "myControl", "textAlign", "center"
      
      mobileControlSet "myControl", "autoCorrectionType", "false"
      mobileControlSet "myControl", "scrollingEnabled", "true"
      
      mobileControlSet "myControl", "opaque", "false"

      if the platform is "iphone" then -- iOS
         mobileControlSet "myControl", "borderStyle", "none"
         mobileControlSet "myControl", "fontSize", "16"
      else if the platform is "android" then -- ANDROID
         mobileControlSet "myControl", "multiline", "true"
         mobileControlSet "myControl", "fontSize", "5"
      end if

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Make a native iOS control text transparent

Post by Dixie » Thu Jun 27, 2013 4:41 pm

There is no 'opaque' property available for iOSNative fields...

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Make a native iOS control text transparent

Post by Mag » Thu Jun 27, 2013 5:26 pm

Thank you Dixie.

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

Re: Make a native iOS control text transparent

Post by gpb01 » Thu Jun 27, 2013 7:58 pm

From the iOS release notes :
All controls (UIView):
...
backgroundColor read/write Set to 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.
...

So, try to set the background color using the alpha channel ...

Code: Select all

mobileControlSet "myControl", "backgroundColor", "R_value,G_value,B_value,Alpha_Value"
... probably works ;)

Guglielmo

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Make a native iOS control text transparent

Post by Mag » Thu Jun 27, 2013 8:20 pm

Works great. Thank you!

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Make a native iOS control text transparent

Post by Dixie » Thu Jun 27, 2013 9:29 pm

Guglielmo...

I stand corrected and have learnt something today... I completely missed that in the release notes.. nice one !

Dixie

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

Re: Make a native iOS control text transparent

Post by gpb01 » Fri Jun 28, 2013 2:17 pm

Dixie wrote: ... I completely missed that in the release notes ...
... it happens to me many many times :D :D :D

Guglielmo

Post Reply