CRecordWebNotifyClick1
The CRecordWebNotifyClick1 message is a notification when an element has been clicked.
To receive this message,
- a listener must be installed for the HTML element: CRecordWebListenOnClick1
- your target address must be linked to the element ID: CRecordWebRegisterWidgetOwner
The message is part of the RemoteSkin Web API.
The API is located in the plugin NY_RemoteSkinWebProtocolAPI.
{
"id": "64e979ff-d44d-4a83-bdf2-286f6b431c43",
"name": "WEB_NOTIFY_CLICK1",
"description": "A widget has been clicked.",
"slots": [
{
"key": "1",
"name": "ID",
"direction": "REQUEST",
"presenceConstraint": "MANDATORY",
"type": "STRING",
"description": "The widget ID."
},
{
"key": "2",
"name": "VALUES",
"direction": "REQUEST",
"presenceConstraint": "MANDATORY",
"type": "STRING_PROPERTIES",
"description": "The widget ids and their values."
}
]
}
Arguments
- ID : The ID of the html element to which the message belongs.
- VALUES : When setting up the listener, you specified an array of element IDs whose values you want to receive upon a click. These values are provided as a property list, with the element ID as the key and the element's value as the corresponding value.
Usage
Register your target address for this ID. You need to have the RemoteSkin address.
final CWebApi webApi = new CWebApi(this, // your target
mRemoteSkinAddress);
webApi.registerWidgets(new String[]{"myElementId"});
Register a listener for an element ID.
webApi.addClickListener1("myElementId",
new String[]{"element1","element2","element3"});
Register a message handler for this message.
// constructor:
addMessageHandler(CRecordWebNotifyClick1.ID,
this::asyncNotifyClick1);
Implement the message handler.
private boolean asyncNotifyClick1(@NotNull final CEnvelope aEnvelope,
@NotNull final CRecord aRecord) throws CException
{
if (aEnvelope.isAnswer())
{
return false;
}
else
{
final String id = CRecordWebNotifyClick1.getId(aRecord,
"");
final CStringProperties sp = CRecordWebNotifyClick1.getValues(aRecord,
null);
// ...
aEnvelope.setResultSuccess();
return true;
}
}