Set the path of the document in the window title bar after "save as"

Submitted by: Brian Jensen Last Updated: 2006-06-18

You want to be able to set the path of the document in the window title bar when the document is saved using 'save as'.

You will want to set an event listener on the document for DocumentSaving, as you said in your mail. Your event listener's handleEvent method should look something like this (untested):

public void handleEvent(Event evt) { ADocumentEvent dEvent = (ADocumentEvent)evt; // Check to make sure it is a 'save as' if(dEvent.getDetail == 1) { ADocument aDoc = (ADocument)dEvent.getTarget; // Get the path to save to & write the document String path = Acl.eval("file_selector('/path/to/dir', 'xml', 'All Files|*.*', 'Save as', 6)"); Acl.execute("write -encoding Shift_JIS " + path); // Get the window associated with the document DocumentView dView = (DocumentView)aDoc; View view = (View)dView.getDefaultView; Window window = view.getWindow; // Set the windows title text window.setOption("title", path); // Prevent the save as from happening dEvent.preventDefault; } }

You will need to fill in some of the parameters, of course.