File: GuiUpdate.xml

package info (click to toggle)
openclonk 8.1-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 169,520 kB
  • sloc: cpp: 180,479; ansic: 108,988; xml: 31,371; python: 1,223; php: 767; makefile: 145; sh: 101; javascript: 34
file content (109 lines) | stat: -rw-r--r-- 3,601 bytes parent folder | download | duplicates (6)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
	<func>
		<title>GuiUpdate</title>
		<category>GUI</category>
		<version>7.0 OC</version>
		<syntax>
			<rtype>bool</rtype>
			<params>
				<param>
					<type>proplist</type>
					<name>update</name>
					<desc>The proplist containing the parts of the GUI window definition that need to be updated. The proplist is of the same format as the original menu definition that was used for <funclink>GuiOpen</funclink>(). </desc>
				</param>
				<param>
					<type>int</type>
					<name>gui_id</name>
					<desc>The ID of the gui window that was returned by <funclink>GuiOpen</funclink>().</desc>
				</param>
				<param>
					<type>int</type>
					<name>child_id</name>
					<desc>Optional. If given, the sub-window of the gui_id window with the matching child_id will be updated. Should be used together with the parameter target.</desc>
				</param>
				<param>
					<type>object</type>
					<name>target</name>
					<desc>Optional. Should be used together with child_id. The target of the sub-window that will be updated.</desc>
				</param>
			</params>
		</syntax>
		<desc>
		<text>Updates an existing GUI window, that has previously been opened with <funclink>GuiOpen</funclink>(). It is possible to update only one certain sub-window by passing child_id and target. The update definition looks similar to the original proplist that defined the GUI window for <funclink>GuiOpen</funclink>(). However, this function can not update certain properties such as the ID and the target. When the name of a sub-proplist matches the original name of a GUI window, the window is updated. If no existing window was found, a new window is added. Returns true if a window was found.</text>
		<text>Because names starting with an underscore (e.g. <em>_child</em>) are anonymous, they will always lead to a new window being added when used in <funclink>GuiUpdate</funclink>.</text>
		</desc>
		<remark>See the <emlink href="script/GUI.html">GUI documentation</emlink> for further explanations. </remark>
		<examples>
			<example>
<code>
var menu =
{
	left_part = 
	{
		Right = "50%",
		BackgroundColor = <funclink>RGB</funclink>(255, 0, 0),
		icon =
		{
			Left = "50%-2em", Right="50%+2em", Bottom="4em",
			Symbol = Clonk
		}
	},
	right_part = 
	{
		Left = "50%",
		BackgroundColor = <funclink>RGB</funclink>(0, 255, 0),
		Text = "On the left site, you can see a Clonk"
	}
};
var menuID = <funclink>GuiOpen</funclink>(menu);

var update = 
{
	left_part =
	{
		icon =
		{
			Symbol = Rock
		}
	},
	right_part = 
	{
		Text = "The Clonk is now a rock. :("
	}
}
GuiUpdate(update, menuID)
</code>
				<text>Opens a menu window and then updates certain parts of it.</text>
			</example>
			
			<example>
<code>
var menu =
{
	BackgroundColor = RGB(200, 100, 100)
};
var menuID = <funclink>GuiOpen</funclink>(menu);

var update = 
{
	BackgroundColor = RGB(0, 255, 0)
}
for (var i = 0; i &lt; 5; i += 2)
{
	update.Left  = Format("%dem", i);
	update.Right = Format("%dem", i + 1);
	GuiUpdate({_child = update}, menuID);
}
</code>
				<text>Opens a menu window and then adds three new children to that window.</text>
			</example>
			
		</examples>
		<related><emlink href="script/GUI.html">GUI Documentation</emlink><funclink>GuiAction_Call</funclink><funclink>GuiAction_SetTag</funclink><funclink>GuiClose</funclink><funclink>GuiOpen</funclink><funclink>GuiUpdateTag</funclink></related>
	</func>
	<author>Zapper</author><date>2014-10</date>
</funcs>