Livecode iOS Air Printing

With Livecode for iOS anything possible, even items not seen in the iOS release notes for Livecode thanks to the iOS external SDK. We can code anything that an xcode ios app can do using such. Well the awesome staff of people at Runrev (The makers of Livecode) have also added some great example ios Externals. One of them called rrehardcopy, which is an ios air print command  to print from your own iOS Livecode built app. It really simple to use the rrehardcopy add on to enable printing from your own built app and here an video, I did of making an a very quick iOS app that opens an Photo and prints it using air print from an iPad.

 

Again If you do not have Livecode, check it out. It an real time saver

http://www.runrev.com/products/livecode/introducing-livecode-5-

The newest released version is 5.0.2 and includes Open GLES for iOS, and works with iOS 4.0 - 5.0 and later.

and to get the iOS external sdk for Livecode go here

http://www.runrev.com/developers/documentation/externals-sdk/

The newest version of the sdk is R10 and requires Xcode 4.2 or later. And OSX 10.6.8 and or 10.7 and later.

To Export to PDF with livecode check out the release Notes and the Print Commands for Livecode. There is an number of settings to paper size, scale and margins that need setting, so do not over look them.

Happy coding and have fun.

livecode ios external c++ code for device vibration

This one really simple that it an good one to get your feet wet building your own external Livecode iOS. 

Of coarse if you use livecode for iOS development and do not know what an iOS external is or what the external sdk is, you can visit this web page and get more info:

http://www.runrev.com/developers/documentation/externals-sdk/

The whole external sdk for Livecode iOS make any iOS item that an xcode built app can do, possible from livecode, using c, c++, objective-c, objective -c++ etc.

The device vibration is since iOS sdk 4.0 and is part of the Audio Toolbox Audio Services. And one simple command call will trigger it.

name your command in the lcidl file, we can use the following as an example;

command myDoVibrate

 

we need to import AudioToolbox/AudioServices.h as such;

#import <AudioToolbox/AudioServices.h>

call our command  myDoVibrate with in either the .cpp file (cpp is c++ )or the .mm file (mm is objective c++)as such;

 

void myDoVibrate()

 

then add the code for such (found in apple ios developer documentation) like this;

 

{

  AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);

}

 

So the final c++ code would be;

 

#import <AudioToolbox/AudioServices.h>

void myDoVibrate()

 {

  AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);

}

I got you in the ball park, but there only one way to learn. That by finishing it your self. It not that hard and can be easily done. Just say I know I can.

 

There is of coarse much more harder things that one can do with the external sdk. But If you have not done so yet this is an good one to start you off, and if you have done so then you should have such built in less than 5 minutes.

 

I see the whole Livecode iOS externals as just another way to extend Livecode with reuse code as an type of module, adding more to your ever growing arsenal of tools.

 

Have fun, and happy new year.

 

iOS Livecode Externals Tip.

Have you been down this street, where the external works in the simulator but fails on the device? I have, and trouble shooting why it sometimes fails can drive one crazy. Well I recently notice an major reason why It has failed for us. Looking back, I can not believe we missed this in the first place.

 

The tip very simple is worth adding to your checklist when building or adding iOS externals to Livecode iOS builds.

Make sure that the standalone settings in Livecode for the iOS version is the same as the iOS sdk version, that built the external in xcode. (Aka if you built the external using iOS 4.3.0 then set the livecode minimum OS standalone settings to 4.3.0.) Yep can not believe I missed that either, but I did.

Tablet Pixel Resolutions

Only going to track the two most poplar mobile platforms, iOS and android. The thing is if it was just iOS we would not even need an list because there only one tablet size as of current for the iPad and iPad2.

When we add Android and all the current shipping tablets (will not list announced tablets that have not yet hit the market) the pixel resolutions are all over the place. Many of these devices are not even real tablet sizes. It might be useful to see the sizes of pixels resolutions we have to deal with supporting, if we develop for these devices/ platforms.

iOS:

Apple iPad 1024x768 pixel resolution

Apple iPad2 1024x768 pixel resolution

--

Android:

Motorola XOOM 1280x800 pixel resolution

ViewSonic ViewPad7 800x480 pixel resolution

ViewSonic GTablet 1024x600 pixel resolution

ASUS Eee Pad 1280x800 pixel resolution

Net'sGo Tablet 7 800x480 pixel resolution

Cruz Tablet T301 800x600 pixel resolution

Samsung Galaxy Tab 7.0 1024x600 pixel resolution

Acer Iconia Tab A500 1280x800 pixel resolution

Advert Vega 1024x600 pixel resolution

AOC Breeze 800x600 pixel resolution

Archos 5 800x480 pixel resolution

Archos 7 Home Tablet 800x480 pixel resolution

Archos 7c Home Tablet 800x480 pixel resolution

Archos 8 800x600 pixel resolution

Archos 28 320x240 pixel resolution

Archos 32 400x240 pixel resolution

Archos 43 854x480 pixel resolution

Archos 70 internet tablet 800x480 pixel resolution

Archos 101 internet tablet 1024x600 pixel resolution

Augen Gentouch78 800x480 pixel resolution

Cherry Mobile Superion 800x480 pixel resolution

Coby Kyros 800x480 pixel resolution

Creative ZiiO 7 800x480 pixel resolution

Creative ZiiO 10 1024x600 pixel resolution

Dell Streak 800x480 pixel resolution

Entourage eDGe 1024x600 pixel resolution

Entourage Pocket eDGe 800x480 pixel resolution

Hardkernel ODROID-T 1366x768 pixel resolution

Notion Inc Adam 1280x800 pixel resolution

Pandigital Nevel 800x600 pixel resolution

Tegatech Australia Tega v2 800x600 pixel resolution

Toshiba Folio 1024x600 pixel resolution

ZTE Light 800x400 pixel resolution

Barnes and Noble NookColor 1024x600 pixel resolution

 

Livecode 101 tip, finding info on syntax.

Learning Livecode is pretty simple, and is one of the better documented language sets. Finding out about all these when you first get started is not always easy, as your faced with where to start. Well here an very simple tip that will help asap. It an setting in the preferences.

Open the preferences window/ list general and pick the Name of LiveCode property radio button.

of the Property labels are: (As pictured below)

Propsinfo
What this allows is the following, The Inspector will use the actual property name of item, witch is the syntax that an item can be scripted with. That property item is also searchable in the Dictionary to gain more info about that item (property) See in the next image

We may want to find out what is an systemWindow as displayed on the inspector pane for Basic Properties. Just open the LiveCode Dictionary , select all from the lefthand menu and search for systemWindow will reveal the syntax documentation about that property. 

Propinfo2

I been using Livecode runrev since 2005 and I recall back in 2005 I went though the same learning curve new comers today face. These are just some tips and things someone else show me. The thing is not all these tips are documented or if they are there vague. Maybe by adding some of these tips here someone will find them helpful after an google search or something.

 

 

 

Viewing Local File in UIWebView in iOS with Livecode

Using UIWebView to display documents other than HTML is possible with the UIWebView.

The such files types are as follow: Excel (.xls), Keynote(.key.zip), numbers (.numbers.zip), pages (.pages.zip), PDF(.pdf), Powerpoint (.ppt), Word (.doc)Rich text format (.rtf), Rich text format Directory (.rtf.zip), Keynote '09(.key), numbers '09 (.numbers) and pages '09(.pages)

While there an ton of examples how to do this in objective-c, how can we get an local file to display in the UIWebView with Livecode? 

Localfilelc
(Image: Example of an pdf booklet stored as an local file. on iPad iOS 4.3)

We should be able to use file:// path2File / filename.Extension 

And this works but what does not work is the urlEncode() function, why? not sure. What does work is the following instead.

replace space with "%20"

To make this an lot easier we can make an custom function to format our local file string for use with iOS UIWebView control in Livecode iOS.

# format local file for viewing in UIWebView for iOS

function rpFormatLocalFileWebView pFolderType, pFileName

    put "file://" & specialFolderPath(pFolderType) & slash & pFileName\

into tLocalFileGet

    replace space with "%20" in tLocalFileGet

    return tLocalFileGet

end rpFormatLocalFileWebView

 

The parameters are:

pFolderType is one of: documents, cache, temporary or engine

 

pFileName is as such MyDocumentName.pdf, MyDocumentName.html, MyDocumentName.doc etc, etc.

 

Example of Use of create browser with local file in Livecode.

 

command createMyBrowser

put rpFormatLocalFileWebView("documents","Cool.pdf") into\

tMyLocalContent

iphoneControlCreate "browser"

put the result into sBrowserId

iphoneControlSet sBrowserId, "rect", the rect of graphic "BrowserLoc"

iphoneControlSet sBrowserId, "visible", "true"

iphoneControlSet sBrowserId, "autoFit", "true"

-- here where we set our content returned by the format local file for\

-- viewing in UIWebView for iOS function

iphoneControlSet sBrowserId, "url", tMyLocalContent

 end createMyBrowser

 

hope this helps working with and viewing files in UIWebView an little more less confusing.

 

More info on Livecode for iOS development, with the Livecode v4.6 @ Link

Getting files from iOS Device to Mac & PC with Livecode iOS

There many ways to save files so your end user can get it off an iphone, ipad or ipod touch with Livecode iOS built app. One of the most simple ways of doing this is by enabling File Sharing. Open the Standalone settings and click the checkbox enable file sharing.

 

Enablefilesharing

What this does is enable iTunes on Mac and PCs to show the File Sharing UI under apps tab, when the device is in sync. All files within the documents folder will be visible for exporting to an mac or PC. Files can even be imported, so you can program your livecode app to look for new files that the end user added to the document folder.

Fs1
What about saving app data that you do not want the end user to see? There an full pdf document on this at apples developer site, log in and read up on what they suggest. (search for: file sharing) As you can see from our screen , an number of our own alpha apps are listed along side apps such as Apple own GarageBand and even SketchBook. It an very common way to transfer files to and from the iPad, iPhone and iPod Touch to the mac and PC.

Best of all you can add this to an Livecode iOS built app with an simple checkbox.

iOS Icon tool

I found an cool little tool called Icon Robot, that generates iOS icons from one file.

It will output the follow

512x512px itunes connect store icon

iphone Retina 144x144px

iphone 3G/3GS 57x57px

and iPad 72x72px

Screen_shot_2011-02-18_at_1
Icon Robot an free download tool, made by Fu-design

It an cool little tool, to save an little time, from opening pixelmator or some other image editor. Check it out, cool stuff!

more info and download can be found here @ link 

Custom Scroller for LiveCode iOS with Animation Engine

How to make an custom scrollbar for iOS with Livecode. The default controls in livecode are set to motif (for mobile apps) which is not very appealing what so ever for iOS. So using Livecode we can make custom control to do almost anything. But it ever more simple to use animation engine by Malte Derbrill to make such an control come to life in even less lines of code. (9 lines of code, including the start using line)

 

Here an simple video walking over how to do it. And this simple method can be customized to any kind of graphic to make it look like ios native or to something very funky. It also should be noted this custom scrollbar can also be used on the desktop with mac, windows and Linux.  

 

Custom Scrollbar with Livecode & Animation Engine from Obleo Beck on Vimeo.

 

Download the source code @ http://revonline2.runrev.com/stack/558/Mobile-slider-example

Livecode product page @ http://www.runrev.com/

Animation Engine v4 more info @ http://www.runrev.com/store/product/animation-engine-4-0-0/

UPDATE: July 12th:

iOS native type slider example added

UPATE: July 22

Improved performance, code change 

Get newer version at : http://revonline2.runrev.com/stack/558/Mobile-slider-example

iOS Fonts, quick reference.

Before Designing a project, it good to know what resources are available on the device to use.

The following are an list on fontTypes available on iOS v 4.0 and 4.2

Tested list, on iPad, iPhone and iPod Touch. ( Note; The simulator does not return same list as it not an actual device, the simulator returns your computers fonts not the actual installed device fonts) 

This data can be queried by Livecode fontNames Function. I posting this list as an quick reference.

 

Thonburi

Snell Roundhand

Academy Engraved LET

Marker Felt

Geeza Pro

Arial Rounded MT Bold

Trebuchet MS

Arial

Gurmukhi MN

Malayalam Sangam MN

Bradley Hand

Kannada Sangam MN

Bodoni 72 Oldstyle

Cochin

Sinhala Sangam MN

Hiragino Kaku Gothic ProN

Papyrus

Verdana

Zapf Dingbats

Courier

Hoefler Text

Helvetica

Hiragino Mincho ProN

Bodoni Ornaments

Apple Color Emoji

Optima

Gujarati Sangam MN

Devanagari Sangam MN

Times New Roman

Kailasa

Telugu Sangam MN

Heiti SC

Futura

Bodoni 72

Baskerville

Chalkboard SE

Heiti TC

Copperplate

Party LET

American Typewriter

AppleGothic

Bangla Sangam MN

Zapfino

Tamil Sangam MN

DB LCD Temp

Arial Hebrew

Heiti K

Georgia

Heiti J

Helvetica Neue

Gill Sans

Chalkduster

Palatino

Courier New

Oriya Sangam MN

Didot

Bodoni 72 Smallcaps