How to open a browser with fixed size?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
wheelsdong
Posts: 3
Joined: Sun Oct 19, 2008 6:12 pm

How to open a browser with fixed size?

Post by wheelsdong »

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.

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;
}

When desktop.browse is called, the default browser will be opened and the url will be displayed.

Now I want to open a browser with a fixed size, say 600*600 pixels.

If you write the following url in the address bar, a fixed size window will be opened.

javascript:document.mytrial=window.open('http://www.google.com/','mytrial','width=600,height=600');location.href=location.href;document.mytrial.focus();

But if the url is opened by desktop.browse(), a error message box will be pop up from the browser.

Does anybody know how to solve this?

Thank you very much.
OOo 2.4.X on Ms Windows XP + Mac OS
User avatar
TheGurkha
Volunteer
Posts: 6482
Joined: Thu Mar 13, 2008 12:13 pm
Location: North Wales, UK.

Re: How to open a browser with fixed size?

Post by TheGurkha »

You would get more response if you posted in the Macros and UNO forum. The Writer forum is for general Writer usage isuues, not programming.
Ubuntu 14.10 Utopic Unicorn, LibreOffice Version: 4.3.3.2
Gurkha Welfare Trust
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: How to open a browser with fixed size?

Post by acknak »

[Moved topic to Macros and UNO API]
AOO4/LO5 • Linux • Fedora 23
Post Reply