Skip to main content
Known Participant
October 20, 2020

P: Multi-line text cannot be pasted into EditText (Windows, JavaScript)

  • October 20, 2020
  • 3 replies
  • 307 views

A script is working properly on Mac, but not Windows. Users are expected to paste multi-line text into a text field. The Windows version is clipping that text to the first line, where as the Mac version allows the whole block to be pasted in.

 

Example input:

Some text

that spans

multiple lines

 

On paste, windows clips to:

Some text

 

 

The 'multiline' property has no noticeable effects.

 

function addLongTextField(panel) {
 
    panel.filenamesText = panel.add("EditText",undefined,"")
    panel.filenamesText.minimumSize = [400,200];
    panel.filenamesText.multiline = true;
    return panel
}
This topic has been closed for replies.

3 replies

Legend
October 20, 2020

From the Object Model Viewer:

"EditText.properties   
Data Type: Object 
ScriptUI Classes 
An object that contains one or more creation properties of the container (properties used only when the element is created).
Creation properties of an EditText object can include: 
multiline : When false (the default), the control displays a single line of text. When true, the control displays multiple lines, in which case the text wraps within the width of the control. 
readonly : When false (the default), the control accepts text input. When true, the control does not accept input but only displays the contents of the text property. 
noecho : When false (the default), the control displays input text. When true, the control does not display input text (used for password input fields). 
enterKeySignalsOnChange : When false (the default), the control signals an 
onChange event when the editable text is changed and the control loses the keyboard focus (that is, the user tabs to another control, clicks outside the control, or types Enter). When true, the control only signals an  onChange()  event when the editable text is changed and the user types Enter; other changes to the keyboard focus do not signal the event. 
wantReturn : Only applies to multiple line edit controls in ScriptUI Version 6.0 or later. When true the RETURN/ENTER keystroke is considered as text-input advancing the cursor to the next line. The default value is false."

Legend
October 20, 2020

Thanks. I've asked engineering to take a look.

Zollie135Author
Known Participant
October 20, 2020

Some more API property declaration inconsistency, but this works if you declare the 'multiline' property on instantiation.

function addLongTextField(panel) {
 
    panel.filenamesText = panel.add("EditText",undefined,"",{multiline: true})
    panel.filenamesText.minimumSize = [400,200];
    return panel
}