Select all MText or MLeader Content on Double-Click

Function Syntax mteditreactoron / mteditreactoroff
Current Version 1.1
Download MTEditReactorV1-1.lsp
View HTML Version MTEditReactorV1-1.html
Donate

Program Description

This short code snippet was born from a question I received from a visitor of my site, asking whether it was possible to automatically select all text content when double-clicking on an MText object, as per the result of double-clicking on single-line text object.

As demonstrated by the GIF animation below, this behaviour is already part of the standard AutoCAD DDEDIT command when a single-line text object is edited or selected via a double-click, and so this utility provides a consistent result when double-clicking an MText or MLeader object.

The utility is driven by a Visual LISP Command Reactor which monitors for the use of either the MTEDIT or MLEADERCONTENTEDIT commands (the commands invoked as standard when a user double-clicks on an MText or MLeader object respectively). When such commands are invoked with an MText or MLeader object already selected, the utility will send the keystrokes Ctrl+Home followed by Ctrl+Shift+End to the AutoCAD window, causing the text content to be automatically selected. When developing the code, I initially attempted to issue the Ctrl+A keystroke, however, this was unsuccessful in my tests.

Similar to my Layer Director application, the program is designed to enable the reactor automatically when the program is loaded, and the user may subsequently enable or disable the utility manually using the mteditreactoron and mteditreactoroff commands respectively.

Demonstration

MTEdit Reactor

Instructions for Running

This program will run automatically when loaded and may be subsequently switched on & off using the commands mteditreactoron and mteditreactoroff respectively. Refer to How to Run an AutoLISP Program for instructions on how to load this program.

textsize

increase · reset · decrease

Designed & Created by Lee Mac © 2010