mergPop is an iOS external that adds functions to present an action sheet (popover on iPad) and contextual menu for user interaction.
The example stack used in this lesson creates a text file in the app's Documents folder and uses mergPopActivity to present a modal view showing various options for the file, for example saving to the iOS Files app.
The Activity button code
on mouseUp local tTitle, tContent // Create the file in 'documents' put field "title" into tTitle put field "content" into tContent put tContent into url ("file:" & specialFolderPath("documents") & "/" & tTitle & ".txt") // Show Activity popup mergPopActivity ,,("file:" & specialFolderPath("documents") & "/" & tTitle & ".txt") end mouseUp
- Get the title and content
- Create the file in specialFolderPath("documents")
- Call mergPopActivity passing the file as a parameter. This will show the available options.
This example show options for a file by passing the file URL to the command but other parameters can be passed to mergPopActivity.
mergPopActivity [pText], [pImagePaths], [pURLs], [pRect]
- pText - text to be handled by the activity view (optional with "" default)
- pImagePaths - a full path to an image to be handled by the activity view (optional with "" default)
- pURLs - a url to be handled by the activity view (optional with "" default)
- pRect - a rect on screen which is used as the location the popover is presented from. This defaults to the rect of the target control.(optional with "" default)
The documentation for mergPop can be found in the LiveCode Dictionary in the IDE or online.
In addition to the mergPopActivity command there are the functions:
- mergPopMenu - Presents a popup contextual menu like the Cut|Copy|Paste menu in a text view
- mergPopSheet - Presents an action sheet or popover on iPad