<-- back to the index of Rosetta examples

action: move selected objects

Create a new action mv(dx,dy) that moves selected objects relative by dx and dy mm.

Example implementations

awk | bash | lua | pl | py | rb | scm | stt | tcl

Explanation, step by step

Load packages the script depends on:

Create a function ev_action that will be called when any of the actions registered by the script is executed. The script registers only one action, so it does not need to check which action caused the function to be called.

When the action event is called, first set up:

A loop then iterates over the objects on the list: Finally the search list shall be destroyed to reclaim memory, using layout_search_free .

In the "main" section of the script, bind event ACTE_action to our local function ev_action - this gets ev_action to be called when any of the actions registered by this script is executed.

Finally use action_register to register the action: