Dragging files from the Finder to a Panorama X form

• Dragging an image file onto a form while in graphics mode will create a StaticImageObject of the image within the file. This works with .jpg, .png, .gif or .tif files. The new StaticImageObject is permanent once saved.

• If you have a WebBrowserObject on the form set to “Literal Text” with nothing in the Formula pane of the Properties panel, you can drag many types of files from the Finder and they will function in the WebBrowserObject. This works in either graphics mode or data mode. If the form is closed and reopened the WebBrowserObject will be blank once again. File types that are acceptable are .jpg, .png, .gif, .tif, .psd, .mov, .aiff, .mp3, .mp4, .txt, .pdf and possibly more I haven’t tried yet. Rich Text Files (.rtf) will not work at all. Dragging a new file into the WebBrowserObject will replace the old file except in the case of a .pdf file which seems can only be replaced by closing and reopening the form. Note that all contents of the WebBrowserObject created this way are only temporary and will disappear once the form is closed. It is questionable what practical use this could be since the file dragged into the WebBrowserObject is strictly temporary – but it is cool.

• Files dragged into an active TextEditingObject will insert the path to the dragged file. This also works with a procedure window or the Formula or Procedure pane of the Properties panel. This is an easy and accurate way to get file paths into your procedure code.

One addition to the above. Drag and Drop works well, using a PDF file type as an example. Three items are necessary:

  1. a database text field to store the file path. That field is named “File_Path” in this example.
  2. a Drag Receiver object
  3. a Web Browser object

In graphics mode, add a Drag Receiver object and a Web Browser object to the form.

Enter the following code into the procedure pane of the the Drag Receiver’s property panel:

local filesDropped
dropfromfinder ".PDF", filesDropped
looparray filesDropped, cr(), theFile
	if File_Path = ""
		File_Path = theFile
		File_Path = theFile

The logic of this procedure (no error checking):

  1. get the file path’s of any PDF files dropped on the Drag Receiver object
  2. check if the current record has a file path already stored
  3. if not, store the file path in this record
  4. otherwise, create a new record and store the file path there

In the formula pane of the Web Browser object’s property panel enter the following:


Where “File_Path” is the name of the field storing the dropped file path (as noted above)

In the options pane of the Web Browser object’s property panel set the “mode” to “Literal Text”.

Jump back to data mode and drag some PDF files from the Finder to the database form’s Drag Receiver, and voilà, the PDF document appears in the web browser. It can be scrolled, magnified, saved to disk and opened in preview. Some links within the document will also work.

Scrolling through the records (from within the form) will load each record’s File_Path into the web browser.