X
3151

How do I copy and paste text from a native Mac OS X application to an X11-based IDL widget program?

Question:

How do I copy and paste text from a native Mac OS X application to an X11-based IDL widget program?

Discussion:

IDL widget programs running on Mac OS X use X11-based GUI components. The XQuartz/X11 system maintains its own pasteboard, separate from the Mac OS X pasteboard. As a result, it can sometimes be a challenge to copy and paste text between the two pasteboard systems.

Solution:

To enable the copying and pasting of text from a native Mac program to an IDL widget program do the following.

  1. Quit out of IDL if it is currently running
  2. Start XQuartz/X11 if it is not already running (from the Finder, launch XQuartz.app, located under the /Applications/Utilities folder
  3. In XQuartz, select XQuartz->Preferences
  4. In the XQuartz Preferences dialog, select Input and then check "Emulate three-button mouse".
  5. Under the Pasteboard view, check "Enable syncing" and then check all sub-items.
  6. Close the XQuartz Preferences dialog and then quit XQuartz.

 


 
After making the above changes to your XQuartz preferences, here are instructions to copy and paste text between a native Mac application and an IDL text widget:

Native Mac Application to IDL Widget

After you have configured the XQuartz preference as above, you'll be able to copy and paste text from a native Mac application to an IDL widget program, as follows:

  1. Open your native Mac application.
  2. Select and copy the target text from the application, using the keyboard combination, Command-C (not Control-C).
  3. Launch your IDL widget program.
  4. Hold down the Option key and click your "left" mouse button in the text input field of your IDL widget program. Your text should then appear in the text field.


IDL Widget to Native Mac Application

To copy/paste text from an IDL widget program to a native Mac application, do the following:

  1. Select the target text in your IDL widget program
  2. Just press Command-C to copy the text.
  3. Finally, press Command-V to paste the text into your native Mac application. 

 

Example IDL Code:

Here are some IDL commands you can enter at your IDL> command prompt to create a quick text widget for testing the above:

wb = widget_base(/column)
wt = widget_text(wb, xsize=80, ysize=20, /editable)
widget_control, wb, /realize

(Tested on Mac OS X 10.11.6 with XQuartz 2.7.9.)

 

 

Reviewed by JU (10.14.2016), JB (10/14/2016)