[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 Widget Writer's Guide



Transferring Multiple Targets

The data transfers we have looked at so far have all assumed that the destination widget wanted only one conversion from the source widget. For example, the destination might ask for the selection to be converted to TEXT or to _MOTIF_COMPOUND_STRING but not to both. However, there are some cases where the destination widget might want the selection converted to several different targets and then transferred. If the user tries to transfer a pixmap, the destination might want the source to transfer both a PIXMAP and a COLORMAP. For such cases, the destination could call XmTransferValue several times, each time asking for a new conversion. However, UTM does provide the following routines to implement a faster multiple transfer:

  1. XmTransferStartRequest

  2. XmTransferSetParameters

  3. XmTransferSendRequest

    The calling sequence to transfer multiple values is as follows:

    1. Call XmTransferStartRequest once to initiate the multiple transfer.

    2. Call XmTransferSetParameters if a subsequent call to XmTransferValue will transfer a value containing a parameter.

    3. Call XmTransferValue every time you need to transfer a value. For example, call XmTransferValue twice to transfer two values.

    4. Call XmTransferSendRequest once to mark the end of the multiple transfer.

      The following code fragment demonstrates how a transfer procedure might request both a PIXMAP and a COLORMAP:

      XmSelectionCallbackStruct  *scs;
      XmTransferStartRequest(scs->transfer_id);
      XmTransferValue(scs->transfer_id, PIXMAP,   TransferProc,
                           NULL, XtLastTimestampProcessed);
      XmTransferValue(scs->transfer_id, COLORMAP, TransferProc,
                           NULL, XtLastTimestampProcessed);
      XmTransferSendRequest(scs->transfer_id, XtLastTimestampProcessed);

    5. [ Previous | Next | Contents | Glossary | Home | Search ]