summaryrefslogtreecommitdiffstats
path: root/doc/scriptexamples/label1.kvs
blob: d66cf154cbb9c4927fe2e1b358943717602d30c3 (plain)
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
38
39
# A little label test.

class(myLabel, label)
{
	constructor
	{
		$$->$setBackgroundColor(dcdc00);
		$$->$setAutoResize(0);
		$$->$setGeometry(10, 10, 500, 150);
		$$->$setAlignment(Center);
		$$->$setText("Come here !");
	}

	mouseEnterEvent
	{
		$$->$setMargin(10);
		$$->$setAlignment(Right, Top);
		%al = "My alignment is $$->$alignment(), and I have margin $$->$margin() pixels wide !";
		$$->$setText(%al);
		$$->$setFrameStyle(Panel, Raised);
		echo "Label frame style: $$->$frameStyle()";
	}

	mouseLeaveEvent
	{
		$$->$setMargin(0);
		$$->$setAlignment(Left, Bottom);
		%al = "My alignment is $$->$alignment(), and I have margin $$->$margin() pixels wide !";
		$$->$setText(%al);
		$$->$setFrameStyle(Panel, Sunken);
		echo "Label frame style: $$->$frameStyle()";
	}
}

%w = $new(widget, 0);
%w->$resize(520, 170);
%w->$move(50, 50);
%l = $new(myLabel, %w);
%w->$show();