Any better way to show the text information than NewScriptWindow command

45 views Asked by At

I'd like to show tens of lines of text information. The output window is not a good idea since it can only show ~10 lines. Now I open a script window by using NewScriptWindow command, and then add text into the window by using EditorWindowAddText command. It works pretty well. But the problem is when I close it, it will ask me whether to save the file. Since it's just temporary display, I'd like close it directly, instead of seeing the annoying prompt. Hope there is some solution. Other solutions than NewScriptWindow are also welcome.

DocumentWindow text_win
text_win = NewScriptWindow("Mag Table", 100, 100, 800, 900)
text_win.EditorWindowAddText("Mag 1000x" + "\n")
text_win.EditorWindowAddText("Mag 2000x" + "\n")
2

There are 2 answers

0
BmyGuest On BEST ANSWER

Why can the output window only show ten lines? It can show as many as fit in the window, which you can resize... But using the EditorWindow is of course also fine.

You can close it (without prompt) from script:

documentwindow myWin = NewScriptWindow("My Text",100,100,600,800)
myWin.EditorWindowAddText("My text")

sleep(1)
myWin.WindowClose(0)

Alternatively, you can ensure to mark any "changed" window text as "clean", i.e. as "does not need to be saved" using

documentwindow myWin = NewScriptWindow("My Text",100,100,600,800)
myWin.EditorWindowAddText("My text")

myWin.WindowClean()

Now closing it with X will not ask for saving. But you need to do this, whenever the window context is changed.

0
Mike Kundmann On

If your only problem with the script window approach is the verification on close, then the simplest solution is to make sure to hold down the alt key while closing the window. This is generally the way to close any window in DM without getting a confirmation prompt.

Please note that there is an analogous facility when closing the window with a script via the CloseWindow function. If you call text_win.CloseWindow(0), then it will close the window without confirmation.