Name
SelectPalette -- set active palette object (V9.0)
Synopsis
SelectPalette(type, id)
Function
This function can be used to set the palette object that should be used by functions like SetPen(), GetPen() and SetPalette() by default. The palette that is used by those functions by default is also called the active palette.

You have to pass the type and identifier of the object whose palette should be made the active one. The following object types can be passed to the type argument:

 
#ANIM
#BGPIC
#BRUSH
#DISPLAY
#LAYER
#PALETTE
#SPRITE

Note that SelectPalette() will neither check if the object passed to it exists nor if it has a palette. For performance reasons, all this won't be verified until you call a function which actually tries to access the currently active palette. Thus, it is also possible to make a palette active which doesn't exist yet.

By default, the current display's palette is the active one. If the current display doesn't have a palette and you call a function that tries to access it, an error will occur. See Palette mode displays for details.

Note that EndSelect() must never be called for SelectPalette(). Do not confuse SelectPalette() with functions like SelectBrush() or SelectAlphaChannel() which require you to call EndSelect() when you're done with them. This must not be done for SelectPalette() as it just sets the default palette for functions like SetPen() so you must never call EndSelect() for SelectPalette().

Inputs
type
type of object whose palette should be made active
id
identifier of object whose palette should be made active
Example
SelectPalette(#BRUSH, 1)
The code above makes the palette of brush 1 the active one.

Show TOC