0
|
1 |
\raw HTML
|
|
2 |
//! [0]
|
|
3 |
<script language="javascript">
|
|
4 |
function createSubWidget( form )
|
|
5 |
{
|
|
6 |
ParentWidget.createSubWidget( form.nameEdit.value );
|
|
7 |
}
|
|
8 |
|
|
9 |
function renameSubWidget( form )
|
|
10 |
{
|
|
11 |
var SubWidget = ParentWidget.subWidget( form.nameEdit.value );
|
|
12 |
if ( !SubWidget ) {
|
|
13 |
alert( "No such widget " + form.nameEdit.value + "!" );
|
|
14 |
return;
|
|
15 |
}
|
|
16 |
SubWidget.label = form.labelEdit.value;
|
|
17 |
form.nameEdit.value = SubWidget.label;
|
|
18 |
}
|
|
19 |
|
|
20 |
function setFont( form )
|
|
21 |
{
|
|
22 |
ParentWidget.font = form.fontEdit.value;
|
|
23 |
}
|
|
24 |
</script>
|
|
25 |
|
|
26 |
<p>
|
|
27 |
This widget can have many children!
|
|
28 |
</p>
|
|
29 |
<object ID="ParentWidget" CLASSID="CLSID:d574a747-8016-46db-a07c-b2b4854ee75c"
|
|
30 |
CODEBASE="http://qt.nokia.com/demos/hierarchy.cab">
|
|
31 |
[Object not available! Did you forget to build and register the server?]
|
|
32 |
</object><br />
|
|
33 |
<form>
|
|
34 |
<input type="edit" ID="nameEdit" value="<enter object name>" />
|
|
35 |
<input type="button" value="Create" onClick="createSubWidget(this.form)" />
|
|
36 |
<input type="edit" ID="labelEdit" />
|
|
37 |
<input type="button" value="Rename" onClick="renameSubWidget(this.form)" />
|
|
38 |
<br />
|
|
39 |
<input type="edit" ID="fontEdit" value="MS Sans Serif" />
|
|
40 |
<input type="button" value = "Set Font" onClick="setFont(this.form)" />
|
|
41 |
</form>
|
|
42 |
//! [0]
|
|
43 |
\endraw
|