Re: [api-dev] macro doesn't run
How did you prove that the macro didn't run? Because nothing happened. The macro is supposed to change text in the Draw file and display a graphic. Also, the print 'hallo' line doesn't run. The macro is not called. This is a case where running the same code with the same input results in different behavior, which should never happen. Douglas Staas wrote: I'm still not sure if I understood you correctly. Here are the steps to recreate this situation. Let me know if something isn't clear. 1: open some other OO doc 2: open my binder covers template OO doc 3: the macro that runs on the open event (PromptForValues) brings up a dialog. 4: enter values in the dialog and click 'OK' 5: nothing happens 6: try rerunning PromptForValues. nothing happens after the dialog closes 6: open the macro editor 7: run PromptForValues again, enter values in the dialog 8: after the dialog closes, Texts will be updated with the values you entered 9: close all OO docs 10: open my binder covers template OO doc 11: the macro that runs on open (PromptForValues) brings up a dialog 12: enter values in the dialog and click 'OK' 13: after the dialog closes, Texts will be updated with the values you entered Summary: Macros don't run when a 2nd OO file is open unless the macro editor is open. How did you prove that the macro didn't run? Maybe it ran but just didn't work? Place a print hallo into the macro that should be called by pressing OK, save the document with the macros, do the procedure again and see if the macro is called in step 5. Best regards, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] macro doesn't run
Thanks to Paolo and everyone else who's offered ideas. Paolo's fix worked. 11.3.3 appears to be very general. I don't see how it applies to this specific scenario. Then again, perhaps understanding the difference between an OK button and a Default type button would help. If so, where could I find documentation on that? ie: Where can I read about OK buttons causing a dialog to close before associated events are fired? Thanks, again. I'm sure I'll have more questions as I digest this and proceed. doug Hi Douglas, Alle 19:16, giovedì 10 novembre 2005, Douglas Staas ha scritto: My questions keep piling up. If this isn't the right place to ask them, where should I seek answers/useful documentation? If this is the right place to ask them, what do I need to do to engage in a dialog about these issues? * Macros don't run when a 2nd OO file is open unless the macro editor is open. When will this be resolved? I don't want to dig into details but ony let you know that IMHO your macro is not well conceived and perhaps your problem is only a side effect of that. 1) You have manually binded the events keyPressed and MousButton-pressed to the SetAllTexts subroutine 2) You have set the OK Button as Button Type = OK I think that your problem is due to the fact that the 2) causes the dialog to close before the events has been raised. This is the normal behaviour and you can find a detailed explanation of that in the DevGuide at: 11.3.3Special Behavior of OpenOffice.org Basic Rescheduling BTW the DevGuide shows an example that covers exactly your situation. However, my suggestion is to remove the binding of events and modify your PromptForValues as shown below. Sub PromptForValues DialogLibraries.LoadLibrary( SlaySysLibrary ) oDialog = CreateUnoDialog( DialogLibraries.SlaySysLibrary.SlaysysDialog ) If oDialog.Execute() = 1 Then SetAllText() End If end Sub hope that helps PaoloM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] macro doesn't run
Ok, so due to the rescheduling of threads, sometimes an OK button's events get fired as expected and sometimes the dialog is closed before those events get run? Does this mean that binding code to OK button events is generally a bad idea with Open Office? I'm just trying to understand. This subtle quirk appears to be unique to Open Office. Is this something that'll be addressed some day? thanks doug An OK button performs a default action. so, you think that it should only do what you told it to, but in reality, it is ALSO doing the default OK action, which you did not expect because you did not know what an OK button was. Douglas Staas wrote: Thanks to Paolo and everyone else who's offered ideas. Paolo's fix worked. 11.3.3 appears to be very general. I don't see how it applies to this specific scenario. Then again, perhaps understanding the difference between an OK button and a Default type button would help. If so, where could I find documentation on that? ie: Where can I read about OK buttons causing a dialog to close before associated events are fired? Thanks, again. I'm sure I'll have more questions as I digest this and proceed. doug Hi Douglas, Alle 19:16, giovedì 10 novembre 2005, Douglas Staas ha scritto: My questions keep piling up. If this isn't the right place to ask them, where should I seek answers/useful documentation? If this is the right place to ask them, what do I need to do to engage in a dialog about these issues? * Macros don't run when a 2nd OO file is open unless the macro editor is open. When will this be resolved? I don't want to dig into details but ony let you know that IMHO your macro is not well conceived and perhaps your problem is only a side effect of that. 1) You have manually binded the events keyPressed and MousButton-pressed to the SetAllTexts subroutine 2) You have set the OK Button as Button Type = OK I think that your problem is due to the fact that the 2) causes the dialog to close before the events has been raised. This is the normal behaviour and you can find a detailed explanation of that in the DevGuide at: 11.3.3Special Behavior of OpenOffice.org Basic Rescheduling BTW the DevGuide shows an example that covers exactly your situation. However, my suggestion is to remove the binding of events and modify your PromptForValues as shown below. Sub PromptForValues DialogLibraries.LoadLibrary( SlaySysLibrary ) oDialog = CreateUnoDialog( DialogLibraries.SlaySysLibrary.SlaysysDialog ) If oDialog.Execute() = 1 Then SetAllText() End If end Sub hope that helps PaoloM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] macro doesn't run
In my opinion, yes. If you want the default behavior, then do not attache anything else to it, otherwise, do it all in your own code. Douglas Staas wrote: Ok, so due to the rescheduling of threads, sometimes an OK button's events get fired as expected and sometimes the dialog is closed before those events get run? Does this mean that binding code to OK button events is generally a bad idea with Open Office? I'm just trying to understand. This subtle quirk appears to be unique to Open Office. Is this something that'll be addressed some day? thanks doug An OK button performs a default action. so, you think that it should only do what you told it to, but in reality, it is ALSO doing the default OK action, which you did not expect because you did not know what an OK button was. Douglas Staas wrote: Thanks to Paolo and everyone else who's offered ideas. Paolo's fix worked. 11.3.3 appears to be very general. I don't see how it applies to this specific scenario. Then again, perhaps understanding the difference between an OK button and a Default type button would help. If so, where could I find documentation on that? ie: Where can I read about OK buttons causing a dialog to close before associated events are fired? Thanks, again. I'm sure I'll have more questions as I digest this and proceed. doug Hi Douglas, Alle 19:16, giovedì 10 novembre 2005, Douglas Staas ha scritto: My questions keep piling up. If this isn't the right place to ask them, where should I seek answers/useful documentation? If this is the right place to ask them, what do I need to do to engage in a dialog about these issues? * Macros don't run when a 2nd OO file is open unless the macro editor is open. When will this be resolved? I don't want to dig into details but ony let you know that IMHO your macro is not well conceived and perhaps your problem is only a side effect of that. 1) You have manually binded the events keyPressed and MousButton-pressed to the SetAllTexts subroutine 2) You have set the OK Button as Button Type = OK I think that your problem is due to the fact that the 2) causes the dialog to close before the events has been raised. This is the normal behaviour and you can find a detailed explanation of that in the DevGuide at: 11.3.3Special Behavior of OpenOffice.org Basic Rescheduling BTW the DevGuide shows an example that covers exactly your situation. However, my suggestion is to remove the binding of events and modify your PromptForValues as shown below. Sub PromptForValues DialogLibraries.LoadLibrary( SlaySysLibrary ) oDialog = CreateUnoDialog( DialogLibraries.SlaySysLibrary.SlaysysDialog ) If oDialog.Execute() = 1 Then SetAllText() End If end Sub hope that helps PaoloM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- 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]
Re: [api-dev] macro doesn't run
Douglas Staas wrote: My questions keep piling up. If this isn't the right place to ask them, where should I seek answers/useful documentation? If this is the right place to ask them, what do I need to do to engage in a dialog about these issues? It's the right place here, but maybe nobody understands your problem or nobody has an answer or nobody has read your questions. * Macros don't run when a 2nd OO file is open unless the macro editor is open. When will this be resolved? I'm still not sure if I understood you correctly. If you start a dialog that is embedded into a document and that calls a macro that also belongs to this document and if you then close *this* document you can't expect that the macro still is able to run, because the basic library containing it is already removed from memory, the connection is lost. This is not a bug, it's unavoidable. Perhaps an idea could be to warn on closing or even prevent closing the document as long as a macro from it is running, but this was considered to be a bug some time ago (because there are use cases where it should be possible to close a document by its own macro). BTW: you can improve the probability to get answers to your questions if you: - Create one mail thread per question. Otherwise people that aren't interested in your first question skip all mails in the thread and so don't see other questions you append later. - Quote properly when you answer (quote only text you refer to in your answer and write your answer below it, as I did it here). This will make your mails easier to read and easier to understand. If you want to get answers you should make it easy to read your questions. Best regards, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] macro doesn't run
Douglas Staas wrote: I'm still not sure if I understood you correctly. Here are the steps to recreate this situation. Let me know if something isn't clear. 1: open some other OO doc 2: open my binder covers template OO doc 3: the macro that runs on the open event (PromptForValues) brings up a dialog. 4: enter values in the dialog and click 'OK' 5: nothing happens 6: try rerunning PromptForValues. nothing happens after the dialog closes 6: open the macro editor 7: run PromptForValues again, enter values in the dialog 8: after the dialog closes, Texts will be updated with the values you entered 9: close all OO docs 10: open my binder covers template OO doc 11: the macro that runs on open (PromptForValues) brings up a dialog 12: enter values in the dialog and click 'OK' 13: after the dialog closes, Texts will be updated with the values you entered Summary: Macros don't run when a 2nd OO file is open unless the macro editor is open. How did you prove that the macro didn't run? Maybe it ran but just didn't work? Place a print hallo into the macro that should be called by pressing OK, save the document with the macros, do the procedure again and see if the macro is called in step 5. Best regards, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] macro doesn't run
What do you mean by provide for disposal when the document is closed? Where could I find this in the documentation? Le vendredi 04 novembre 2005 à 20:00 +, Douglas Staas a écrit : Hi, I have a Draw file open. Then I open the Draw file that has my macros. The resulting dialog (fired by the on open event) calls the macro just fine. Then I close the file that has my macros and reopen it. Now the macro doesn't fire unless the macro editor is open. This condition will be present until I close all OO docs and reopen the file with my macros. Any insight would be appreciated. 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 ? Alex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] macro doesn't run
Wow. I sent this yesterday morning. It took 24 hours to get out? What do you mean by provide for disposal when the document is closed? Where could I find this in the documentation? Le vendredi 04 novembre 2005 à 20:00 +, Douglas Staas a écrit : Hi, I have a Draw file open. Then I open the Draw file that has my macros. The resulting dialog (fired by the on open event) calls the macro just fine. Then I close the file that has my macros and reopen it. Now the macro doesn't fire unless the macro editor is open. This condition will be present until I close all OO docs and reopen the file with my macros. Any insight would be appreciated. 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 ? Alex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] macro doesn't run
Douglas Staas wrote: 1: One other tidbit just came to mind. I'm not sure if this is relevant, but the 'record macro' off of the menus is always greyed out on my fresh install of OOo2.0 so I'm assuming this is a future feature. Is that an accurate assumption? Recording only works in Calc and Writer. If it's disabled for you even in those apps you have a damaged installation because the macro recorder service can't be instantiated. 2: Anyway, as things stand right now, I remain unable to call a macro from a dialog unless the macro editor is open. In fact, the document's macros are invisible to Open Office when trying to add them, say, to a toolbar... unless, of course, the macro editor is open. The first few moments after installing OOo2.0 things worked wonderfully, but stopped working shortly after that for no obvious reason. How can I resolve this nagging problem? Again I assume that your installation is damaged. Please create a new user profile and report back if the problem persists. The easiest to create a new profile way would be to delete the old profile (of course you must save any important files therein, e.g. any user dictionaries). OOo then will create a new profile on the next start, so then you will see the welcome wizard again. If your problem persists even with a new profile please try reinstalling OOo and make sure that you have deinstalled all old versions (and perhaps even removed all remaining files manually - just in case of). Best regards, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] macro doesn't run
1: One other tidbit just came to mind. I'm not sure if this is relevant, but the 'record macro' off of the menus is always greyed out on my fresh install of OOo2.0 so I'm assuming this is a future feature. Is that an accurate assumption? 2: Anyway, as things stand right now, I remain unable to call a macro from a dialog unless the macro editor is open. In fact, the document's macros are invisible to Open Office when trying to add them, say, to a toolbar... unless, of course, the macro editor is open. The first few moments after installing OOo2.0 things worked wonderfully, but stopped working shortly after that for no obvious reason. How can I resolve this nagging problem? thanks doug It worked for me in OOo 2.0 for a short time as well. After closing and re-opening the file, that 2nd macro no longer gets called until I have opened the macro editor. If nobody else has ever had this problem, what can I do? I'm running Windows XP using VMware. The host operating system is Red Hat Linux. I'm not sure if those details are relevant but it's probably an unusual setup. thanks doug Hi Douglas, I have a macro that calls a dialog. The dialog calls a 2nd macro. The 2nd macro doesn't run unless the macro editor is open. Is this the right place to seek guidance on this issue? If not, where should I look? works for me with OOo 2.0, well I changed your macro slightly, so that no error will appear from oGraph.setposition(oPos) ThisComponent.getDrawpage().add(oGraph) oGraph.GraphicURL = ... to oGraph.setposition(oPos) ThisComponent.Drawpages(0).add(oGraph) oGraph.GraphicURL = ... Hope that helps Regards Stephan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] macro doesn't run
Hi Douglas, I have a macro that calls a dialog. The dialog calls a 2nd macro. The 2nd macro doesn't run unless the macro editor is open. Is this the right place to seek guidance on this issue? If not, where should I look? works for me with OOo 2.0, well I changed your macro slightly, so that no error will appear from oGraph.setposition(oPos) ThisComponent.getDrawpage().add(oGraph) oGraph.GraphicURL = ... to oGraph.setposition(oPos) ThisComponent.Drawpages(0).add(oGraph) oGraph.GraphicURL = ... Hope that helps Regards Stephan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] macro doesn't run
It worked for me in OOo 2.0 for a short time as well. After closing and re-opening the file, that 2nd macro no longer gets called until I have opened the macro editor. If nobody else has ever had this problem, what can I do? I'm running Windows XP using VMware. The host operating system is Red Hat Linux. I'm not sure if those details are relevant but it's probably an unusual setup. thanks doug Hi Douglas, I have a macro that calls a dialog. The dialog calls a 2nd macro. The 2nd macro doesn't run unless the macro editor is open. Is this the right place to seek guidance on this issue? If not, where should I look? works for me with OOo 2.0, well I changed your macro slightly, so that no error will appear from oGraph.setposition(oPos) ThisComponent.getDrawpage().add(oGraph) oGraph.GraphicURL = ... to oGraph.setposition(oPos) ThisComponent.Drawpages(0).add(oGraph) oGraph.GraphicURL = ... Hope that helps Regards Stephan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]