Javascript

can i create a window/popup window in javascript and use it in notes client .

Subject: javascript

Yes, but you lose the functionality provided by the LotusScript workspace.DialogBox method or the @DialogBox function – either is preferable to window.open() in the Notes client. Remember – the Notes client is not the same as a web browser. JavaScript is great for some things, but a poor third choice for even more.

Subject: javascript

You sure can:

Here is the code of a Scriptlibrary called: dialog.java

import lotus.domino.*;

import java.io.*;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class ThreadedDialog {

private JFrame parentFrame;              



public void ThreadedDialog(String title, String msg) { 

	parentFrame = new JFrame(title); 

	parentFrame.setSize(500, 150);

	parentFrame.setLocation(200, 200); 

	String[] poList = msg.split("\r\n|\r|\n");

	JPanel labelPane = new JPanel(new GridLayout(0, 1));

	for (int i = 0; i < poList.length; i++) {

		JLabel label = new JLabel("     " + poList[i]);

		labelPane.add(label);

	}

	parentFrame.getContentPane().add(labelPane, BorderLayout.CENTER);

}



public void Layout(int top, int left, int width, int height) {

	parentFrame.setLocation(top, left);

	parentFrame.setSize(width, height);

}

	

public void Show() {

	parentFrame.setVisible(true);

}



public void Dispose() {

	parentFrame.hide();

	parentFrame.dispose();

}

}

Here is the code of a Scriptlibrary called: Dialog

[Options]

Option Public

Option Explicit

Uselsx “*javacon”

Use “Dialog.java”

[Declarations]

Class DialogClass

jobject As JAVAOBJECT



Sub New(title As String, msg As String)

	Dim jsession As JAVASESSION

	Dim jclass As JAVACLASS

	

	Set jsession = New JAVASESSION()

	Set jclass = jsession.GetClass("ThreadedDialog")

	Set jobject = jclass.CreateObject

	Call jobject.ThreadedDialog(title, msg)

End Sub



Sub Layout(t As Integer, l As Integer, w As Integer, h As Integer)

’ Call jobject.Layout(t, l, w, h)

End Sub



Sub Show

	Call jobject.Show()

End Sub



Sub Delete

	Call jobject.Dispose()

End Sub

End Class

And here a sample of the usage:

Set dlg = New DialogClass("Hell World")

Call dlg.Layout(300, 400, 500, 100)

Call dlg.Show()

… 'do something useful here

Delete dlg