How can I code device-specific?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
DevBoyLars
Posts: 216
Joined: Wed Feb 27, 2013 9:04 pm

How can I code device-specific?

Post by DevBoyLars » Wed May 01, 2013 4:42 pm

Hi there,
is it possible to tell the compiler which code is for which device?

Such as to use native-scroller on iOS and Android in one App with one code :)

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

Re: How can I code device-specific?

Post by Dixie » Wed May 01, 2013 5:24 pm

look at 'systemVersion' in the dictionary.. and then act accordingly depending on what result the 'systemVersion' function returns.

Dixie

CoffeeCone
Posts: 64
Joined: Fri Apr 26, 2013 8:38 am

Re: How can I code device-specific?

Post by CoffeeCone » Wed May 01, 2013 5:27 pm

DevBoyLars wrote:Hi there,
is it possible to tell the compiler which code is for which device?
Yes, you can run specific codes for specific devices by using the platform function like so:

Code: Select all

if the platform is "android" then
  // do this
else if the platform is "iphone" then
  // do this
end if
Learning LiveCode, one step at a time.

DevBoyLars
Posts: 216
Joined: Wed Feb 27, 2013 9:04 pm

Re: How can I code device-specific?

Post by DevBoyLars » Wed May 01, 2013 6:16 pm

Nice, so does it mean, I can convert a normal scroller to a native-iOS scroller at runtime or pre-compiled?

CoffeeCone
Posts: 64
Joined: Fri Apr 26, 2013 8:38 am

Re: How can I code device-specific?

Post by CoffeeCone » Wed May 01, 2013 6:25 pm

DevBoyLars wrote:Nice, so does it mean, I can convert a normal scroller to a native-iOS scroller at runtime or pre-compiled?
I haven't developed for mobile yet using LC. Perhaps, other people here can help out. But basically, that's what you use for detecting the platform the app is running on.
Learning LiveCode, one step at a time.

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

Re: How can I code device-specific?

Post by Dixie » Wed May 01, 2013 7:00 pm

Yes, apologies... 'platform' is correct... wasn't thinking, obviously.. :oops:

Post Reply