The NotificationBubble is a Windows CE control that lets you send notifications to a user.
You can add a NotificationBubble object to a window or user object by using the Insert>Object>NotificationBubble menu item or creating the object in a script. For example, you might add the following PowerScript code in the Script view of a command button Clicked event:
String ls_body
NotificationBubble myBubble
Integer li_return
ls_body = "<html><body><form method=~"POST~" action=>"& +"<p>This is an <font color=~"#0000FF~">"& +"<b>HTML</b></font> notification coming from "
ls_body += "<font color=~"#FF0000~"><i>Pocket</i>"& +"PowerBuilder</font></p><p align=right>"& +"<input type=button name='cmd:10' value="& +"'My Ok'> <input type=button name='cmd:2'"& +"value='Cancel'></p></body></html>"
myBubble = CREATE NotificationBubble
myBubble.caption = "My Title"
myBubble.notificationID = 123
myBubble.body = ls_body
myBubble.duration = 10 // seconds
li_return = myBubble.SetMessageSink( parent )
li_return =myBubble.icon( "foo.ico" )
li_return =myBubble.Update()
You could code another control to update the message body of the notification bubble with a different message, making sure to create a NotificationBubble with the same NotificationID and to call the Update function again.
Since there is no guarantee that a user will acknowledge a notification and thereby remove it, an application must provide a separate means to remove the notification. Typically you would code the NotificationBubble Remove function in the Close or Destructor event of the visual object that you assigned to receive the notification. The following code would ensure the removal of the NotificationBubble with the NotificationID 123:
NotificationBubble myBubble
Integer li_return
myBubble = CREATE NotificationBubble
myBubble.notificationID = 123
li_return = myBubble.Remove()
You can add a user event to capture a user response to the notification bubble. The user event must implement the pbm_command event ID. The pbm_command arguments hwndChild and childID are useful for capturing the NotificationID of the NotificationBubble control and the command ID of the HTML input element that acknowledges the notification. You could write these values to a ListBox control, as in the following example:
if( hwndChild = 123 ) then
// display only the messages from the Notification
lb_result.addItem("NotificationID="+string(hwndChild))
lb_result.addItem("cmd:###= " + string(childID))
end if
In this example, hwndChild adds the value 123 to the lb_result ListBox. If the notification is acknowledged from an HTML input element with the attribute name = “cmd:10”, as in the example at the beginning of this section, childID would add the value 10 to the ListBox control.
Properties and functions of a NotificationBubble control are described in the PowerScript Reference and in the online Help.