How to enable several users to use the same XUI file concurrently?

Clay Helberg tells how to use createDialogFromFile Last Updated: 2006-10-24

=Question by N.N.=

I've been asked to play the role of a XUI developer in an upcoming reality TV series. While researching for this role, I encountered two problems:


 * 1) Sharing XUI dialogs when multiple users have access to a custom/dialogs folder

Our Editor users are set up to use a shared custom directory over a Windows file system. We use an embedded XUI control (e.g. myDialog.xml). Unfortunately, when another user opens a document, the second user gets a "read only" warning (presumably because myDialog.xml is essentially opened by Editor already).

This issue is not related to embedded dialogs; JavaScript code called to create the dialog will produce the same warning message (here's some initialization code to demonstrate):

var xuiFile = get_custom_directory + "/dialogs/myDialog.xml"; var xuiDoc = Application.openDocument(xuiFile); var xuiwin = Application.createDialogFromFile(xuiFile);

The users would like to avoid this warning message. How do others work around this issue?

(Editor's note by Liz Fraley -- #2 moved to separate topic: How to "connect" a dialog to a document?)

=Clay Helberg answers=

I think you can get around the first problem by just not calling openDocument at all. If you use createDialogFromFile, I don't think you need to open the document separately -- createDialogFromFile handles opening the document for you. We've used this approach in our code for quite a while now, and while I haven't tested it explicitly, we've never had a problem with multiple instances of the dialog colliding in the way you describe. Heck, I can even have two instances of the dialog open on the same machine, associated with different documents, and everything works nice and smoothly.