|
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"> |
|
2 <html lang="en" xml:lang="en"> |
|
3 <head> |
|
4 <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> |
|
5 <meta name="copyright" content="(C) Copyright 2005" /> |
|
6 <meta name="DC.rights.owner" content="(C) Copyright 2005" /> |
|
7 <meta content="concept" name="DC.Type" /> |
|
8 <meta name="DC.Title" content="Using notification popups" /> |
|
9 <meta scheme="URI" name="DC.Relation" content="WRTKit_Common_WRTKit_tasks-GUID-24870895-4449-4307-9a54-7c90f7b3905e.html" /> |
|
10 <meta content="XHTML" name="DC.Format" /> |
|
11 <meta content="GUID-39C7A69A-9334-45D1-92F6-8C239831A0A2" name="DC.Identifier" /> |
|
12 <meta content="en" name="DC.Language" /> |
|
13 <link href="commonltr.css" type="text/css" rel="stylesheet" /> |
|
14 <title> |
|
15 Using notification popups</title> |
|
16 </head> |
|
17 <body id="GUID-39C7A69A-9334-45D1-92F6-8C239831A0A2"><a name="GUID-39C7A69A-9334-45D1-92F6-8C239831A0A2"><!-- --></a> |
|
18 |
|
19 |
|
20 |
|
21 <h1 class="topictitle1"> |
|
22 Using notification popups</h1> |
|
23 |
|
24 <div> |
|
25 |
|
26 <p> |
|
27 |
|
28 Notification popup dialogs are an easy way to show information to |
|
29 users. In the WRTKit notification popups are used using two methods |
|
30 in the UIManager class: showNotification() and hideNotification(). |
|
31 If a notification is already showing when another is commanded to be |
|
32 shown then the current notification is replaced with the new one. |
|
33 Notifications can be either auto-hiding after a specified time or |
|
34 manually hidden by calling hideNotification(). Auto-hiding is an |
|
35 easy way in situations where a message just needs to be shown but |
|
36 doesn't require user acknowledgement, e.g. to let the user know that |
|
37 new content has loaded or similar. |
|
38 </p> |
|
39 |
|
40 <div class="fignone" id="GUID-39C7A69A-9334-45D1-92F6-8C239831A0A2__GUID-05D19BA1-DC3E-40EE-B587-387039A547C2"><a name="GUID-39C7A69A-9334-45D1-92F6-8C239831A0A2__GUID-05D19BA1-DC3E-40EE-B587-387039A547C2"><!-- --></a><span class="figcap">Figure 1. |
|
41 Wait notification with unknown progress</span> |
|
42 |
|
43 |
|
44 <br /><img src="RSS_Reader_Main_Screenshot_3.png" /><br /> |
|
45 </div> |
|
46 |
|
47 <p> |
|
48 |
|
49 The API for showNotification() takes four arguments: displayTime, |
|
50 type, text and progress. The "displayTime" argument is an integer |
|
51 that specifies how long the notification popup dialog should be |
|
52 shown for before automatically hiding. The value is given in |
|
53 milliseconds (1000ms = 1s) and negative values can be used to |
|
54 specify that the dialog should not automatically hide. The second |
|
55 argument "type" is used to specify a visual style for the popup. |
|
56 There are three types of notifications: "info", "warning" and |
|
57 "wait". Info is intended for informative messages, warning for |
|
58 errors or other similar negative messages and finally wait is |
|
59 intended for dialogs that are letting the user know that some |
|
60 process (e.g. loading data from the Internet) is taking a long time. |
|
61 The fourth argument "progress" is a decimal number that should be |
|
62 omitted or null in all other cases except when the dialog should be |
|
63 a progress dialog (typically notifications of type "wait"). For |
|
64 progress dialogs the value should be between 0.0 and 1.0 to specify |
|
65 how far along the process is (0.0 for "0% done" and 1.0 for "100% |
|
66 done"). A negative value can be specified if the progress is |
|
67 unknown, resulting in an animated progress bar that indicates that |
|
68 the wait time and progress is not known. |
|
69 </p> |
|
70 |
|
71 <p> |
|
72 |
|
73 The code below show various examples of how to show notification |
|
74 popup dialogs. The examples assume that the UIManager has been |
|
75 instantiated and that a variable called uiManager refers to that |
|
76 instance. |
|
77 </p> |
|
78 |
|
79 <pre> |
|
80 |
|
81 // show an info notification - auto-hide in 3 seconds |
|
82 uiManager.showNotification(3000, "info", "Informative message here"); |
|
83 |
|
84 // show a warning notification - no auto-hide |
|
85 uiManager.showNotification(-1, "warning", "Warning message here"); |
|
86 |
|
87 // show a progress notification - no auto-hide, 40% progress |
|
88 uiManager.showNotification(-1, "wait", "Loading...", 0.4); |
|
89 |
|
90 // show a progress notification - no auto-hide, unknown progress |
|
91 uiManager.showNotification(-1, "wait", "Loading...", -1.0); |
|
92 </pre> |
|
93 |
|
94 <p> |
|
95 |
|
96 The example below shows how to hide a notification. If no |
|
97 notification is showing when the method is called then the |
|
98 call is ignored. |
|
99 </p> |
|
100 |
|
101 <pre> |
|
102 |
|
103 // hide the current notification (if any) |
|
104 uiManager.hideNotification(); |
|
105 </pre> |
|
106 |
|
107 </div> |
|
108 |
|
109 <div> |
|
110 <div class="familylinks"> |
|
111 <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> |
|
112 </div> |
|
113 </div> |
|
114 |
|
115 </body> |
|
116 </html> |