---
name: "wxXmlResource"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:25.2.3+dfsg-1+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/wxXmlResource"
---

# wxXmlResource(3erl)

Functions for wxXmlResource class

## NAME

wxXmlResource - Functions for wxXmlResource class

## DESCRIPTION

This is the main class for interacting with the XML-based resource system.

The class holds XML resources from one or more .xml files, binary files or zip archive files.

Note that this is a singleton class and you'll never allocate/deallocate it. Just use the static *get/0* getter.

See: Overview xrc, Overview xrcformat

wxWidgets docs: wxXmlResource

## DATA TYPES

```
wxXmlResource() = wx:wx_object()
```

## EXPORTS

```
new() -> wxXmlResource()
```

```
new(Options :: [Option]) -> wxXmlResource()
```

Types:

Option = {flags, integer()} \| {domain, unicode:chardata()}\

Constructor.

```
new(Filemask, Options :: [Option]) -> wxXmlResource()
```

Types:

Filemask = unicode:chardata()\
 Option = {flags, integer()} \| {domain, unicode:chardata()}\

Constructor.

```
destroy(This :: wxXmlResource()) -> ok
```

Destructor.

```
attachUnknownControl(This, Name, Control) -> boolean()
```

Types:

This = wxXmlResource()\
 Name = unicode:chardata()\
 Control = wxWindow:wxWindow()\

```
attachUnknownControl(This, Name, Control, Options :: [Option]) ->
                        boolean()
```

Types:

This = wxXmlResource()\
 Name = unicode:chardata()\
 Control = wxWindow:wxWindow()\
 Option = {parent, wxWindow:wxWindow()}\

Attaches an unknown control to the given panel/window/dialog.

Unknown controls are used in conjunction with \<object class="unknown"\>.

```
clearHandlers(This) -> ok
```

Types:

This = wxXmlResource()\

Removes all handlers and deletes them (this means that any handlers added using *AddHandler()* (not implemented in wx) must be allocated on the heap).

```
compareVersion(This, Major, Minor, Release, Revision) -> integer()
```

Types:

This = wxXmlResource()\
 Major = Minor = Release = Revision = integer()\

Compares the XRC version to the argument.

Returns -1 if the XRC version is less than the argument, +1 if greater, and 0 if they are equal.

```
get() -> wxXmlResource()
```

Gets the global resources object or creates one if none exists.

```
getFlags(This) -> integer()
```

Types:

This = wxXmlResource()\

Returns flags, which may be a bitlist of ?wxXmlResourceFlags enumeration values.

```
getVersion(This) -> integer()
```

Types:

This = wxXmlResource()\

Returns version information (a.b.c.d = d + 256\*c + 2562\*b + 2563\*a).

```
getXRCID(Str_id) -> integer()
```

Types:

Str\_id = unicode:chardata()\

```
getXRCID(Str_id, Options :: [Option]) -> integer()
```

Types:

Str\_id = unicode:chardata()\
 Option = {value\_if\_not\_found, integer()}\

Returns a numeric ID that is equivalent to the string ID used in an XML resource.

If an unknown *str\_id* is requested (i.e. other than wxID\_XXX or integer), a new record is created which associates the given string with a number.

If *value\_if\_not\_found* is *wxID\_NONE*, the number is obtained via *wx\_misc:newId/0*. Otherwise *value\_if\_not\_found* is used.

Macro *XRCID(name)* is provided for convenient use in event tables.

Note: IDs returned by XRCID() cannot be used with the *EVT\_\*\_RANGE* macros, because the order in which they are assigned to symbolic *name* values is not guaranteed.

```
initAllHandlers(This) -> ok
```

Types:

This = wxXmlResource()\

Initializes handlers for all supported controls/windows.

This will make the executable quite big because it forces linking against most of the wxWidgets library.

```
load(This, Filemask) -> boolean()
```

Types:

This = wxXmlResource()\
 Filemask = unicode:chardata()\

Loads resources from XML files that match given filemask.

Example:

Note: If wxUSE\_FILESYS is enabled, this method understands *wxFileSystem* (not implemented in wx) URLs (see *wxFileSystem::FindFirst()* (not implemented in wx)).

Note: If you are sure that the argument is name of single XRC file (rather than an URL or a wildcard), use *LoadFile()* (not implemented in wx) instead.

See: *LoadFile()* (not implemented in wx), *LoadAllFiles()* (not implemented in wx)

```
loadBitmap(This, Name) -> wxBitmap:wxBitmap()
```

Types:

This = wxXmlResource()\
 Name = unicode:chardata()\

Loads a bitmap resource from a file.

```
loadDialog(This, Parent, Name) -> wxDialog:wxDialog()
```

Types:

This = wxXmlResource()\
 Parent = wxWindow:wxWindow()\
 Name = unicode:chardata()\

Loads a dialog.

*parent* points to parent window (if any).

```
loadDialog(This, Dlg, Parent, Name) -> boolean()
```

Types:

This = wxXmlResource()\
 Dlg = wxDialog:wxDialog()\
 Parent = wxWindow:wxWindow()\
 Name = unicode:chardata()\

Loads a dialog.

*parent* points to parent window (if any).

This form is used to finish creation of an already existing instance (the main reason for this is that you may want to use derived class with a new event table). Example:

```
loadFrame(This, Parent, Name) -> wxFrame:wxFrame()
```

Types:

This = wxXmlResource()\
 Parent = wxWindow:wxWindow()\
 Name = unicode:chardata()\

Loads a frame from the resource.

*parent* points to parent window (if any).

```
loadFrame(This, Frame, Parent, Name) -> boolean()
```

Types:

This = wxXmlResource()\
 Frame = wxFrame:wxFrame()\
 Parent = wxWindow:wxWindow()\
 Name = unicode:chardata()\

Loads the contents of a frame onto an existing *wxFrame*.

This form is used to finish creation of an already existing instance (the main reason for this is that you may want to use derived class with a new event table).

```
loadIcon(This, Name) -> wxIcon:wxIcon()
```

Types:

This = wxXmlResource()\
 Name = unicode:chardata()\

Loads an icon resource from a file.

```
loadMenu(This, Name) -> wxMenu:wxMenu()
```

Types:

This = wxXmlResource()\
 Name = unicode:chardata()\

Loads menu from resource.

Returns NULL on failure.

```
loadMenuBar(This, Name) -> wxMenuBar:wxMenuBar()
```

Types:

This = wxXmlResource()\
 Name = unicode:chardata()\

```
loadMenuBar(This, Parent, Name) -> wxMenuBar:wxMenuBar()
```

Types:

This = wxXmlResource()\
 Parent = wxWindow:wxWindow()\
 Name = unicode:chardata()\

Loads a menubar from resource.

Returns NULL on failure.

```
loadPanel(This, Parent, Name) -> wxPanel:wxPanel()
```

Types:

This = wxXmlResource()\
 Parent = wxWindow:wxWindow()\
 Name = unicode:chardata()\

Loads a panel.

*parent* points to the parent window.

```
loadPanel(This, Panel, Parent, Name) -> boolean()
```

Types:

This = wxXmlResource()\
 Panel = wxPanel:wxPanel()\
 Parent = wxWindow:wxWindow()\
 Name = unicode:chardata()\

Loads a panel.

*parent* points to the parent window. This form is used to finish creation of an already existing instance.

```
loadToolBar(This, Parent, Name) -> wxToolBar:wxToolBar()
```

Types:

This = wxXmlResource()\
 Parent = wxWindow:wxWindow()\
 Name = unicode:chardata()\

Loads a toolbar.

```
set(Res) -> wxXmlResource()
```

Types:

Res = wxXmlResource()\

Sets the global resources object and returns a pointer to the previous one (may be NULL).

```
setFlags(This, Flags) -> ok
```

Types:

This = wxXmlResource()\
 Flags = integer()\

Sets flags (bitlist of ?wxXmlResourceFlags enumeration values).

```
unload(This, Filename) -> boolean()
```

Types:

This = wxXmlResource()\
 Filename = unicode:chardata()\

This function unloads a resource previously loaded by *load/2*.

Returns true if the resource was successfully unloaded and false if it hasn't been found in the list of loaded resources.

```
xrcctrl(Window, Name, Type) -> wx:wx_object()
```

Types:

Window = wxWindow:wxWindow()\
 Name = string()\
 Type = atom()\

Looks up a control.

Get a control with *Name* in a window created with XML resources. You can use it to set/get values from controls. The object is type casted to *Type*. Example:
