Type function Library native.* Revision Release 2022.3683 Keywords native, showPopup, quick look, preview
Displays the operating system's default popup window for previewing/viewing documents.
native.showPopup( name, options )
String. The string name of the popup to be shown. For the Quick Look plugin, use "quickLook"
.
Table. A table that specifies the properties for the popup — see the next section for details.
Valid properties in the options
table include the following:
Table. A table of sub-tables, each specifying a file to view. Within each filename
indicates the file and baseDir
indicates the system directory constant in which the file resides.
files = { { filename="myFile.txt", baseDir=system.ResourceDirectory }, }
Table. The file index at which the preview will start. For instance, if you have two file files
table and you set this value to 2
, it will preview the second file first, as opposed to starting at the first file. Default is 1
, indicating the first file.
Function. Listener function to be called when the popup is dismissed. This function is passed an event
table which contains the following properties:
local function quickLookListener( event ) print( event.name ) --"popup" print( event.type ) --"quickLook" print( event.action ) --"done" print( event.file ) --file table of last item previewed prior to dismissing, for example: { filename="myFile.txt", baseDir=system.ResourceDirectory } end -- Quick Look options local quickLookOptions = { files = { { filename="myPDF.pdf", baseDir=system.ResourceDirectory }, { filename="myImage.jpg", baseDir=system.ResourceDirectory }, }, startIndex = 1, listener = quickLookListener } native.showPopup( "quickLook", quickLookOptions )