mergPop

mergPop is an iOS external that adds functions to present an action sheet (popover on iPad) and contextual menu for user interaction. For iOS 6 if adds the new activity view controller to provide a one line command to many system services and social networks.

Documentation

function mergPopSheet [pTitle],[pCancel],[pDestructive],[pOther],[pStyle],[pPopoverRect]

Presents an action sheet or popover on iPad.

Parameters:

  • pTitle - (optional with "" default) the title to display.
  • pCancel - (optional with "" default) the cancel button label if required. This button is displayed in grey at the bottom of the action sheet. Popovers don't display a cancel button as the user cancels by touching away from the popover.
  • pDestructive - (optional with "" default) this button is displayed in red at the top of the action sheet or popover.
  • pOther - (optional with "" default) comma delimited list of button labels.
  • pStyle - (optional with "default" default) one of:
    • default
    • black opaque
    • black translucent
  • pPopoverRect - (optional with "" default) a rect on screen which is used as the location the popover is presented from. This defaults to the rect of the target control.

Returns one of:

  • One of the button labels (they should be unique).
  • On iPad if the user cancels by touching elsewhere the external will return Cancel. To handle localising the cancel button label in an action sheet you should test the result for Cancel or the value of your cancel button title.

Code sample

switch mergPopSheet("","Cancel","Delete","Save","black translucent")
  case "Delete"
    deleteRecord
    break
  case "Save"
    updateRecord
    break
end switch

function mergPopMenu pButtons,[pRect]

Presents a popup contextual menu like the Cut|Copy|Paste menu in a text view.

Parameters:

  • pButtons - a comma delimited list of button labels.
  • pRect - (optional with "" default) a rect on screen which is used as the location the popover is presented from. This defaults to the rect of the target control.

Returns one of:

  • One of the button labels (they should be unique).
  • mergPopMenu: cancel

Code sample

switch mergPopMenu("Duplicate,Delete")
  case "Duplicate"
    clone the target
    break
  case "Delete"
    delete the target
    break
end switch

command mergPopActivity [pText],[pImagePaths],[pURLs],[pRect]

Presents a modal view that you can use to offer various services from your application. The system provides several standard services, such as copying items to the pasteboard, posting content to social media sites, sending items via email or SMS, and more. This feature is available on iOS 6 only and will throw an error on other platforms. To use this feature your app must be comipled against the iOS 6 SDK or higher which means using LiveCode 5.5.3+ and Xcode 4.5 or higher.

Parameters:

  • pText - (optional with "" default) text to be handled by the activity view
  • pImagePaths - (optional with "" default) a full path to an image to be handled by the activity view
  • pURLs - (optional with "" default) a url to be handled by the activity view
  • pRect - (optional with "" default) a rect on screen which is used as the location the popover is presented from. This defaults to the rect of the target control.

Sets the result to one of:

  • mergPopActivity: cancel
  • the activity type that was completed by the user. For example, if the user sent an SMS the activity type would be: com.apple.UIKit.activity.Message