PhotonUI logo

PhotonUI

A javascript framework to create user interfaces

Window

Class Reference

More examples

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Get the position of the #demo area to display windows
// in the right place
var pos = photonui.Helpers.getAbsolutePosition("demo");

// Create a window with a button to center it (x axis) on the page
var win1 = new photonui.Window({
title: "Window 1",
visible: true,
padding: 10,
x: pos.x + 20, y: pos.y + 50,
child: new photonui.Button({
text: "Center Me",
callbacks: {
click: function(widget, event) {
win1.center();
win1.y = pos.y;
}
}
}),
callbacks: {
"close-button-clicked": function(widget) {
widget.destroy();
}
}
});

// Create a second window without "close" button
var win2 = new photonui.Window({
title: "Window 2",
visible: true,
height: 100,
closeButtonVisible: false,
x: pos.x, y: pos.y
});

// Focus the first window
win1.show();