Specifying the path of bitmaps
Prev | Chapter 2. Exploring wxGlade | Next

## Specifying the path of bitmaps

In wxGlade some widgets need to specify a bitmap path. You can use any graphic format supported by wxWidgets.

The bitmap can be specified in several ways:

Usually you can type an absolute path in a text box or browse for a bitmap with a file dialog. This will produce a `wxBitmap` object with the typed string as bitmap path (e.g. wxBitmap("/usr/share/icons/application.png", wxBITMAP_TYPE_ANY))

You can enter a variable name using the var: tag in the text box. This will produce a `wxBitmap` object with the variable name as bitmap path (e.g. var:my_bitmap_path produces wxBitmap(my_bitmap_path, wxBITMAP_TYPE_ANY)). In Perl code generation a “$” sign is added if you omit it.

You can enter a code chunk returning a `wxBitmap`, by using the code: tag. This inserts verbatim the code you enter in brackets and nothing more (e.g.: if `wxSomeWidget` needs a `wxBitmap` as an argument, the string code:if (x == 0) get_bitmap1() else get_bitmap2(); produces wxSomeWidget((if (x == 0) get_bitmap1() else get_bitmap2();), option1, option2)).

wxGlade never declares or assigns variable or function names, so after code generation, you have to provide extra code to declare your variables or functions.

If you use var: or code: tags the preview window shows an empty bitmap of fixed size.

Prev | Up | Next
Handling XRC files | Home | Chapter 3. wxGlade User Interface