Douglas Staas wrote:

The button also has some events tied to things such as key press and mouse click.
I have since changed this. I removed the event bindings and simply call the 
code like so:

   If oDialog.Execute() = 1 Then
       SetAllText()
   End If

Also, you hit the nail on the head. My macro uses a GLOBAL variable to hold a 
reference to the dialog. What should I do to clean up when closing the 
document? Or is this situation to be avoided altogether?

thanks
doug
It looks like you are well on your way! There is a difference between GLOBAL, PRIVATE, and PUBLIC when they are placed at the module level.

If you ONLY need the variable to be visible in one module, then use PRIVATE. If you require it outside of the current module, then use PUBLIC. In general, you should only use GLOBAL if you want the variable to live for a long long long long time (I outline the differences in my book, but lack the desire to fully explain it here and now); an example would be for an event listener, which needs to hold its value between runs. Think of Global as similar to static.

I must be careful on my wording here...

You could perhaps explicitly set variables declared outside of a sub or function to be NULL after you use them.


Douglas Staas wrote:

i'm reposting this question:

What is meant by "provide for disposal when the document is closed"? Where could I find this in the documentation?


Well, where did you read this? It is not possible to answer without context. No wait, I just ran a GOOGLE search on the exact phrase and found this:

http://www.mail-archive.com/dev@api.openoffice.org/msg01793.html

Next time, quote enough of the message to provide context.

Here is the entire quote:

Sounds like everything is being loaded into memory and not being released when you close your original document. Does your on Open Event macro provide for disposal when the document is closed ?


One possible reading of this is that the open document has resources, such as graphics, or pointers, or some kind of internal structures. When the document is closed, Alex is wondering if all of the document's resources are released, deleted, freed, (no longer used). Kind of like what might happen if a program opened a file and then left the file opened. You could not create and use the file again, because it would already be listed as open.

I have no idea where this would be in the documentation, because it would depens on the type of resourced that might be causing the problem. One possibility might be that your macro uses a GLOBAL variable to hold a reference to a dialog. The document closes, but eh global variable still exists and can therefore not be referenced again. If this were the case, then loading the Basic IDE might cause these resources to be released.

This is, of course, all speculation on my part, espcially since I have not seen your macro.

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index


--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to