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

class graphical {#class-graphical}

PCE contains a large number of classes related to creating and manipulating graphical objects. The graphics facilities were designed for interactively manipulating diagrams and graphical representations of information and knowledge. The graphics facilities are not suitable for 2-D or 3-D modeling of real-life objects (such as cars and planes).

The most commonly used subclasses of class graphical are:

class box           Rectangle (filled, rounded)
class ellipse
class line
class path          Multiple segment line (curved)
class bitmap        Image
class text          Short text objects
class device        Compound graphical objects
class dialog_item   Specialised items for dialogue

Example types of diagrams for which PCE has been used are the representation of graphs (hierarchies, lattices, flow-charts), tabular information, iconic representations of computer networks, knowledge bases and various graphical editors.

A graphical describes an image, all of whose affected pixels are within a rectangular area, represented by <-area. The main role of class graphical to facilitate the communication to its <-device. A device object is a collection of graphical objects. Class device is a subclass of class graphical. This allows us to display devices on devices, leading to nested graphicals with local coordinate systems.

Graphics in PCE is more complicated than most of the other facilities, although the maxim ``if your needs are simple, it will be simple in PCE as well'' still applies. Advanced use of graphics, however, requires a good understanding of the basic concepts and how they are applied.

Mouse and keyboard events are made available to a graphical using the method ->event. By default the primitive graphical classes do not respond to this message. There are two ways to make a graphical sensitive to the mouse and/or keyboard. The first is to associate a recogniser object using object ->recogniser. The second is to redefine the ->event method.

Refining graphicals {#class-graphical-refining-graphicals}

A couple of methods are commonly redefined on class graphical for creating customised graphical objects:

@see class gesture @see class handle @see class dialog_item @see class window @see class device @see object->recogniser @see class area

Class variables {#class-graphical-classvars}

Instance variables {#class-graphical-instvars}

Send methods {#class-graphical-send}

Get methods {#class-graphical-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.