author | Eugene Ostroukhov <eugeneo@symbian.org> |
Wed, 16 Jun 2010 16:41:16 -0700 | |
changeset 382 | 0a04e9d28d78 |
parent 230 | 7848c135d915 |
permissions | -rw-r--r-- |
230
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
1 |
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
2 |
<html lang="en" xml:lang="en"> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
3 |
<head> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
4 |
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
5 |
<meta name="copyright" content="(C) Copyright 2005" /> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
6 |
<meta name="DC.rights.owner" content="(C) Copyright 2005" /> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
7 |
<meta content="concept" name="DC.Type" /> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
8 |
<meta name="DC.Title" content="Using buttons" /> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
9 |
<meta scheme="URI" name="DC.Relation" content="WRTKit_Common_WRTKit_tasks-GUID-24870895-4449-4307-9a54-7c90f7b3905e.html" /> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
10 |
<meta content="XHTML" name="DC.Format" /> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
11 |
<meta content="GUID-8B14CEC9-92CC-4BDE-83C2-AD0A30A84942" name="DC.Identifier" /> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
12 |
<meta content="en" name="DC.Language" /> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
13 |
<link href="commonltr.css" type="text/css" rel="stylesheet" /> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
14 |
<title> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
15 |
Using buttons</title> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
16 |
</head> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
17 |
<body id="GUID-8B14CEC9-92CC-4BDE-83C2-AD0A30A84942"><a name="GUID-8B14CEC9-92CC-4BDE-83C2-AD0A30A84942"><!-- --></a> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
18 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
19 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
20 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
21 |
<h1 class="topictitle1"> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
22 |
Using buttons</h1> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
23 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
24 |
<div> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
25 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
26 |
<p> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
27 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
28 |
You can let users trigger actions by placing a FormButton or |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
29 |
NavigationButton control in a view. Use FormButtons for actions that |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
30 |
start some process and NavigationButton controls for situations |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
31 |
where pressing the button should take the viewer to another view. |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
32 |
</p> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
33 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
34 |
<div class="fignone" id="GUID-8B14CEC9-92CC-4BDE-83C2-AD0A30A84942__GUID-B008BB2B-C5B2-446D-BCED-2824528CF7CC"><a name="GUID-8B14CEC9-92CC-4BDE-83C2-AD0A30A84942__GUID-B008BB2B-C5B2-446D-BCED-2824528CF7CC"><!-- --></a><span class="figcap">Figure 1. |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
35 |
FormButton controls</span> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
36 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
37 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
38 |
<br /><img src="FormButton_Controls_Screenshot_1.png" /><br /> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
39 |
</div> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
40 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
41 |
<p> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
42 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
43 |
You can find out when a button has been pressed by registering a |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
44 |
callback function as an event listener to the button. The event type |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
45 |
for button presses is "ActionPerformed". You can use whatever name |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
46 |
you like for the callback function. The function is passed the event |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
47 |
object as an argument. A typical callback function looks like this: |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
48 |
</p> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
49 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
50 |
<pre> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
51 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
52 |
// Callback function for button presses. |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
53 |
function buttonPressed(event) { |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
54 |
// implement what happens when the button is pressed here |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
55 |
} |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
56 |
</pre> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
57 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
58 |
<p> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
59 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
60 |
Creating a button, registering the event listener and adding the |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
61 |
button to a view is demonstrated below. The example creates a |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
62 |
FormButton: |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
63 |
</p> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
64 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
65 |
<pre> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
66 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
67 |
// create button |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
68 |
var button = new FormButton("button1", "Press me!"); |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
69 |
button.addEventListener("ActionPerformed", buttonPressed); |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
70 |
exampleView.addControl(button); |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
71 |
</pre> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
72 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
73 |
<p> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
74 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
75 |
Note that the example assumes that a view has already been created |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
76 |
and that the "exampleView" variable refers to that view. "button1" |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
77 |
is a unique identifier for the button that allows it to be identified |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
78 |
for example if several different controls are using a shared event |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
79 |
listener function. The event listener function could examine the event |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
80 |
object and check the identifier of the source control for the event. |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
81 |
</p> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
82 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
83 |
</div> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
84 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
85 |
<div> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
86 |
<div class="familylinks"> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
87 |
<div class="parentlink"><strong>Parent topic:</strong> <a href="WRTKit_Common_WRTKit_tasks-GUID-24870895-4449-4307-9a54-7c90f7b3905e.html">Common WRTKit tasks</a></div> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
88 |
</div> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
89 |
</div> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
90 |
|
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
91 |
</body> |
7848c135d915
Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff
changeset
|
92 |
</html> |