Contents Previous Next

Tree editing

When you create a new interface element it is attached at some point to the existing XML tree. The root node of the tree is created automatically and has only one attribute - the encoding. Root is not shown in the tree control (to save space), so its attributes are visible when no other elements are selected.

As explained in the previous section, the new elements can be put in different locations relative to the parent element. What to do if the initial location is not correct, or should be changed in the development process? There two ways to re-arrange elements:

  1. Cut some element, then select the new parent or sibling and paste at the new location. Modifier keys can be used in the same way as for creating to alter the default paste behaviour when using the pull-down command or the tool button (pasting by using the keyboard shortcut is always using the default way).
  2. Use one of the "Move'' menu or toolbar commands to swap elements or change their parent/child configuration. If a move tool button is disabled, this means that it does not make sense to do that kind of move due to incompatible parent/child configuration.
When you cut a subtree, all elements are cut to the clipboard and will be pasted to the new location in the same configuration. On some platforms the clipboard is shared among different processes, so it is possible to start a second copy of XRCed and copy parts of one tree into another.

Hidden nodes
Cut/Copy/Paste


Hidden nodes

Normally one tree element corresponds to a single <object> tag. Sometimes it makes sense to associate contents of some <object> tags to element attributes related to the parent. A common example is a sizer object, which uses sizeritem objects, which have a single child (a control or another sizer). For such simple objects an attribute page is added to the child element attributes. The side-effect of this when copying a child from one parent's subtree into a subtree of a parent of a different class, is that the hidden node attributes must be discarded. This is done automatically.


Cut/Copy/Paste

To accelerate your workflow it may be very useful to use keyboard shortcuts. XRCed supports standard editing shortcuts for cut/copy/paste commands. Pasting operation depends on the state of additional modifier keys to select the desired pasting location relative to the active tree selection, in a way similar to creating new nodes. Shift modifier can be used with the toolbar Paste button or tree pulldown menu to activate "insert'' mode. To activate sibling mode on wxGTK/wxMSW, Ctrl or Alt modifier is used depending on the platform and the way of introducing Paste command:

Tool button Pulldown menu Ctrl+V or Control+V shortcut
wxGTK and wxMSW wxMac
Ctrl Alt
Ctrl Alt
Alt Alt