OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

ThisComponent refers to other document

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
c.hoeflake
General User
General User


Joined: 10 Jul 2007
Posts: 5

PostPosted: Thu Nov 29, 2007 8:04 am    Post subject: ThisComponent refers to other document Reply with quote

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
View user's profile Send private message
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1453
Location: France

PostPosted: Thu Nov 29, 2007 10:03 am    Post subject: Re: ThisComponent refers to other document Reply with quote

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
View user's profile Send private message Visit poster's website
c.hoeflake
General User
General User


Joined: 10 Jul 2007
Posts: 5

PostPosted: Fri Nov 30, 2007 1:20 am    Post subject: Reply with quote

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
View user's profile Send private message
c.hoeflake
General User
General User


Joined: 10 Jul 2007
Posts: 5

PostPosted: Fri Nov 30, 2007 3:18 am    Post subject: Reply with quote

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
View user's profile Send private message
c.hoeflake
General User
General User


Joined: 10 Jul 2007
Posts: 5

PostPosted: Mon Dec 03, 2007 4:20 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group