[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Graphics' (#lcl)

# TCanvas.RequiredState

Ensures that all handles needed for the canvas are valid.

## Declaration

Source position: graphics.pp line 1084

`protected procedure TCanvas.RequiredState(`
`ReqState: TCanvasState`
`); virtual;`

## Arguments

`ReqState` |  | Required state flags.

## Description

RequiredState is a procedure used to ensure that the canvas state flags include the values specified in the ReqState parameter. The TCanvasStates values represent handles that must be allocated for the canvas.

When a state value is not present in the flags, the corresponding routine used to create the required handle is called.

csHandleValid
  Calls CreateHandle, and raises an EInvalidOperation if the handle could not be allocated. Sets the AntialiasingMode for the canvas. Includes csHandleValid in the canvas state flags on success.
csFontValid
  Calls CreateFont, and includes csFontValid in the canvas state flags on success.
csPenValid
  Calls CreatePen. Includes csBrushValid in the canvas state flags when the Pen style is a Brush pattern (psDash, psDot, psDashDot, psDashDotDot). Includes csPenValid in the canvas state flags on success.
csBrushValid
  Calls CreateBrush. Includes csBrushValid in the canvas state flags on success.

RequiredState is called from method implementations prior to performing an operation which requires a specific canvas state (or handles).