src/swipl-devel/packages/xpce/man/refmanual/md/message.md

class message {#class-message}

A message object is a template for the execution of a send virtual machine operation: messages represent behaviour to be invoked.

Messages are the most commonly used code objects. The code below creates a small dialog window with buttons to quit the window and to start PceDraw (the XPCE drawing demo):

?- new(D, dialog('Start PceDraw')),
   send(D, append,
        button(start_draw,
               message(@prolog, pcedraw))),
   send(D, append,
        button(quit,
               message(D, destroy))),
   send(D, open).

It illustrates how a message can be used to activate a host language function (in this case a Prolog predicate) as well as how a message can be used to start an internal XPCE operation. The following example shows how a message may be used to change the graphical ->pen of all graphical objects on a device object. It exploits `chain ->for_all'.

send(Device?graphicals, for_all,
     message(@arg1, pen, 3)).

Instance variables {#class-message-instvars}

Send methods {#class-message-send}

Get methods {#class-message-get}



Try the rswipl package in your browser

Any scripts or data that you put into this service are public.

rswipl documentation built on June 16, 2026, 5:07 p.m.