Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


ScriptUI edittext not showing changes

New Here ,
Jul 23, 2021 Jul 23, 2021

Copy link to clipboard

Copied

Hi. I got a problem with one of my scripts. I have created a window with listbox and edittext. When user click on element in listbox it's full content should show in edittext. Under CS6 it works perfectly fine. However under CC the property of edittext did changed (I can later alert that content without issue) but the visual box of that edittext is still blank -  no new text or anything in there.

 

Here is a code for creating this edittext:

 

changesList = panel.add ("listbox", [0, 0, 300, 300], "", {scrolling: true, numberOfColumns: 3, showHeaders: true, columnTitles: ["ID frame", "Type", "New content"], columnWidths: [0, 80,195]});

content_preview = panel.add ("edittext", [0, 0, 300, 300], "", {multiline: true});

content_preview.text = "";

content_preview.active = false;

 

and here is the function that is supposed to make the change (and as I stated, it does change the property):

 

changesList.onChange = function() {

n=0;

for(var key in changesArray)

{

if(changesList.selection == n)

{

content_preview.text = Encoder.htmlDecode(changesArray[key].change)

}

n++;

}

}

 

 

As for Encoder.htmlDecode(), it just changes things like ą into ż .

TOPICS
Scripting

Views

64

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 23, 2021 Jul 23, 2021

Copy link to clipboard

Copied

Hi,

Could you please post complete code for your window?

Best regards

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jul 24, 2021 Jul 24, 2021

Copy link to clipboard

Copied

ScriptUI has had better days, I'm also fighting redraw problems.

I haven't used multiline edittext in a while, so I don't know whether these solve your issue.

 

Eventually it is sufficient to just resize the field by a pixel, forth and back.

 

// force redraw - I still have no reliable way to display list item icons 😉
var drawEvent = ScriptUI.events.createEvent("UIEvent");
drawEvent.initUIEvent("draw");
content_preview.dispatchEvent(drawEvent);

 

// bump the entire panel layout, note the additional bool

panel.layout.layout(true);

 

Sidenote: When you populate your changesList from the changesArray, you can add extra properties to each item, such as the .change .That would eliminate the loop, you just check changesList.selection for null and otherwise use changesList.selection.change . I'm not sure why your comparison of selection==n works at all - is your "ID frame" consecutive? Then you are actually comparing changesList.selection.text against String(n) ...

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 28, 2021 Jul 28, 2021

Copy link to clipboard

Copied

LATEST

I tried the code but it didn't work. So I tried to check if it just from replacing the insides or it happening from the start. If I get only two changes in the code:

 

content_preview = panel.add ("edittext", [0, 0, 300, 300], "Lorem ipsum", {multiline: true});

//content_preview.text = "";

The box is still empty.

 

Also for the whole code here's the file that contain the drawing and handling aforementioned panel (drawing starts from load_changes function).

 

But still it looks likes it does not even enters the initial text.

 

A few details regarding the issue: although doubleclick updates the content of the frame in document, not on every occasion it can be done. So I need a way for the text from list of changes to be copyable, hence the edittext. If there is any other way to copy that text (except alert - it is a bit tiresome after a while) so it can be manually pasted inside a desired frame I would like to know it if the edittext seems to not be repaired.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines