Client widget
PtWidget → PtBasic → PtContainer → PtClient
Immediate subclasses:
For more information, see the diagram of the widget hierarchy.
None — not normally instantiated.
<photon/PtClient.h>
PtClient and PtServer let one process (the “server”) display widgets in a window that belongs to another process (the “client”).
PtClient and PtServer use a Photon connection to communicate (see “Connections” in the Interprocess Communications chapter of the Photon Programmer's Guide), but they have a few resources that in most cases let applications avoid dealing with connection objects directly.
A PtClient widget creates a parent region for a PtServer widget and handles the process of connecting to a PtServer. Then, the client controls the server's size and notifies it of certain events in order to make the server look and feel as if it were just another container in the client's window. Additionally, PtClient lets your application send arbitrary messages to the server process.
Resource | C type | Pt type | Default |
---|---|---|---|
Pt_ARG_CLIENT_FLAGS | unsigned | Flags | 0 |
Pt_ARG_CLIENT_NAME | char * | String | NULL |
Pt_ARG_CLIENT_REPLY_LEN | unsigned | Scalar | 0 |
Pt_ARG_CLIENT_SEND | char, unsigned | Array | NULL, 0 |
Pt_ARG_CLIENT_SERVER | PtConnectionClient_t * | Pointer | NULL |
Pt_CB_CLIENT_CONNECTED | PtCallback_t * | Link | NULL |
Pt_CB_CLIENT_ERROR | PtCallback_t * | Link | NULL |
Pt_CB_CLIENT_EVENT | PtCallback_t * | Link | NULL |
Pt_CB_CLIENT_NOT_FOUND | PtCallback_t * | Link | NULL |
C type | Pt type | Default |
---|---|---|
unsigned | Flags | 0 |
Flags that control the behavior of the widget:
If the flag is set, setting the Pt_ARG_CLIENT_NAME is nonblocking, and the connecting is performed in background, after PtSetResources() has returned.
C type | Pt type | Default |
---|---|---|
char * | String | NULL |
The connector name to which to connect. Setting this resource initiates the process of connecting to a server.
If the connection isn't successful, the widget's Pt_CB_CLIENT_NOT_FOUND callbacks are invoked.
C type | Pt type | Default |
---|---|---|
unsigned | Scalar | 0 |
The maximum length of a reply from the server, in bytes. See Pt_ARG_CLIENT_SEND.
C type | Pt type | Default |
---|---|---|
char, unsigned | Array | NULL, 0 |
When you set this resource, the widget sends a message to its PtServer. The message invokes a Pt_CB_SERVER_RECEIVE callback in the server that lets the server specify a reply. The reply is then available in the client by getting the Pt_ARG_CLIENT_SEND resource (the length gives you the actual length of the reply, not the size of the buffer).
C type | Pt type | Default |
---|---|---|
PtConnectionClient_t * | Pointer | NULL |
A pointer to the connection object used for communicating to the PtServer. Don't use this pointer for anything other than checking to see if it's NULL.
C type | Pt type | Default |
---|---|---|
PtCallback_t * | Link | NULL |
A list of PtCallback_t structures that define the callbacks that are invoked when the client connects to the server. Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:
These callbacks should return Pt_CONTINUE.
C type | Pt type | Default |
---|---|---|
PtCallback_t * | Link | NULL |
A list of PtCallback_t structures that define the callbacks that are invoked when an error occurs.
Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:
Not all operations are retried if an error handler returns Pt_CONTINUE. For example, a MsgReply() is never retried. |
If this value is Pt_CONNECTION_CLIENT_BROKEN, the widget disconnected from the server and its Pt_ARG_CLIENT_NAME resource has been reset to NULL. |
These callbacks should return Pt_CONTINUE.
C type | Pt type | Default |
---|---|---|
PtCallback_t * | Link | NULL |
A list of PtCallback_t structures that define the callbacks that are invoked for each message sent by the server's Pt_ARG_SERVER_SEND resource.
Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:
These callbacks should return Pt_CONTINUE.
C type | Pt type | Default |
---|---|---|
PtCallback_t * | Link | NULL |
A list of PtCallback_t structures that define the callbacks that are invoked if the widget fails to find the server specified when you set Pt_ARG_CLIENT_NAME.
Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:
These callbacks should return Pt_CONTINUE.
If the widget modifies an inherited resource, the “Default override” column indicates the new value. This modification affects any subclasses of the widget.