Thank you for your reply.

If the contract for such events is that the code is called at least once,
but may be called more often.
Maybe I need to set a flag to remember whether the code has been called.

I tested on different computers(Windows XP, OOo2.4.1), it works fine for one
computer, but open many web pages on the other two. I don't know why. I will
try to test more to find some reasons.

For the second problem, the situation is similar. Fine on one computer,
Failed on other two.


Steffen Grund wrote:
> 
> Hi there,
> 
> if I remember correctly, the contract for such events is that the code 
> is called at least once, but may be called more often.
> 
> I cannot reproduce your second problem. What platform are you on and 
> what version of Openoffice.org do you use? With me, OpenOffice.org 3 on 
> Solaris-sparc works as expected, the browser has the focus.
> 
> Regards, Steffen
> 
> wheelsdong wrote:
>> I am working on a OpenOffice Add-on to open a browser when mouse is
>> clicked
>> and Alt key is pressed at the same time, as follows.
>> 
>> public boolean mousePressed(MouseEvent mouseEvent) {
>>        
>>         if ((mouseEvent.Buttons == MouseButton.LEFT) &&
>> (mouseEvent.ClickCount == 1) && (mouseEvent.Modifiers ==
>> com.sun.star.awt.KeyModifier.MOD2)) {
>>             System.out.println("mousePressed, User pressed Alt key and
>> clicked mouse!");   
>>          desktop.browse(new URI("www.google.com"));
>>         }
>>                 
>>         return false;
>>     }
>> 
>> 
>> There are two problems:
>> 1, Sometimes only one browser is opened, but sometimes more than one
>> browsers are opened.
>> Why is desktop.browse() called many times to open many browsers?
>> 
>> 2, If only one browser is opened, the focus is not on the browser but
>> still
>> on the OpenOffice application.
>> How can we make the focus on the browser?
>> 
>> Can anybody give some solutions for the two problems?
>> 
>> Thank you very much!
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Too-many-browsers-are-opened-when-mouse-pressed-tp20044374p20083454.html
Sent from the openoffice - api dev mailing list archive at Nabble.com.


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

Reply via email to