# How to resend a message between dialog items in XPCE

**URL:** <https://swi-prolog.discourse.group/t/how-to-resend-a-message-between-dialog-items-in-xpce/5433>\
**Category:** Help!\
**Tags:** xpce\
**Created:** [May 26, 2022, 8:16am UTC](https://swi-prolog.discourse.group/t/how-to-resend-a-message-between-dialog-items-in-xpce/5433 "2022-05-26T08:16:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![acmiyaguchi](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/acmiyaguchi/32/3842_2.png) [@acmiyaguchi](https://swi-prolog.discourse.group/u/acmiyaguchi)\
**Post date:** [May 26, 2022, 8:16am UTC](https://swi-prolog.discourse.group/t/how-to-resend-a-message-between-dialog-items-in-xpce/5433/1 "2022-05-26T08:16:07Z")

</div>

I’ve been struggling with some basic XPCE code. I have this small snippet that contains two text boxes. I want to send text from one text item to the other every time it changes.

```prolog
% swipl-win.exe main.pl
:- use_module(library(pce)).
:- initialization main.

main :-
    new(D, dialog),
    send(D, append, new(A, text_item(a, "a"))),
    send(D, append, new(B, text_item(b, "b"))),
    repeat,
    send(A, message, and(
        message(B, selection, A?selection),
        message(D, return, @nil)
    )),
    get(D, confirm, _),
    fail.

```

![image](https://global.discourse-cdn.com/free1/uploads/swiprolog/original/2X/e/ecf58c9145875ff8aa72e348bc3158fee3651142.png)

We send a message when A changes to B, after which we return a message to the top-level dialog and backtrack to a state before we sent the message. Presumably, XPCE will retain the UI state from after the message was sent.

I can type something into text item A and see it reflected in B when I press enter. If I try editing A again, B refuses to change its value. What am I missing in order for B to start receiving messages from A again?
