| View previous topic :: View next topic |
| Author |
Message |
c.hoeflake General User

Joined: 10 Jul 2007 Posts: 5
|
Posted: Thu Nov 29, 2007 8:04 am Post subject: ThisComponent refers to other document |
|
|
The ThisComponent scope of a method call, which is fired from the 'onnew' event when opening a template, is not the new document, but a previous opened/created document.
So, this occurs only when you have already a document opened/created and then you opens the template (for example from the file > open).
How can I refer to the newly created document?
The ThisComponent will refer to the newly created document when the new document is activated. But activating happens AFTER the onnew event. |
|
| Back to top |
|
 |
B Marcelly Super User

Joined: 12 May 2004 Posts: 1414 Location: France
|
Posted: Thu Nov 29, 2007 10:03 am Post subject: Re: ThisComponent refers to other document |
|
|
| c.hoeflake wrote: | The ThisComponent scope of a method call, which is fired from the 'onnew' event when opening a template, is not the new document, but a previous opened/created document.
So, this occurs only when you have already a document opened/created and then you opens the template (for example from the file > open). |
I could not reproduce this.
I open an existing document, and use the template to create a new document. The event "Create document" of the template gives me the new document, using thisComponent or StarDesktop.CurrentComponent.
Tested with OOo 2.2.1 on Windows XP.
What is your version and OS? Beware of OpenOffice versions provided by Linux distributions. |
|
| Back to top |
|
 |
c.hoeflake General User

Joined: 10 Jul 2007 Posts: 5
|
Posted: Fri Nov 30, 2007 1:20 am Post subject: |
|
|
I've removed the OpenOffice.org2 directory in the users profile. Now it seems te be fixed. I will spend more time on what causes this problem.
It's OpenOffice 2.2.1 on Windows 2000. Which is deployed via Novell NAL or something like that. |
|
| Back to top |
|
 |
c.hoeflake General User

Joined: 10 Jul 2007 Posts: 5
|
Posted: Fri Nov 30, 2007 3:18 am Post subject: |
|
|
Hmm the problem is not solved. The first time when oo starts (with the wizard), it works. But the second time not (closing the quickstarter too).
To reproduce, ensure that the 'Allow Macro Execution' dialog isn't shown (add the location of the template to the trusted locations ie).
And the template may not be opened IN the current window, but as a new window.
Or is it something like a timing issue which happens only on some slow or fast pc's? |
|
| Back to top |
|
 |
c.hoeflake General User

Joined: 10 Jul 2007 Posts: 5
|
Posted: Mon Dec 03, 2007 4:20 am Post subject: |
|
|
Ok, I found the cause of the problem. The script which is called by the onnew event fired a Java AWT window. When this window returns, another oo window is focussed.
So I focus now the document directly after the window closes. |
|
| Back to top |
|
 |
|