| DrawHeader | ||
| Contents | ||||||||
|
||||||||
As of Draw 2.63 the DrawHeader template uses a new DrawHeader class. This provides better performance, and has no need of a local procedure.
The Draw Global extension provides the ability to use the old or new DrawHeader, as well as to override the class defaults to creating headings. These settings can also be overridden on the local extension for each DrawHeader control, as needed.
The DrawHeader uses the same coordinate system as the normal Draw control and a Clarion window. The control uses pixels for measurement, not dialog units.

DrawHeader Control can be populated onto your windows to create dynamic headers:

![]() |
Basic DrawHeader settingsUse Old template Override default settings Heading and Icon Note: The two entry fields in this section are the only entry fields which require variable names to be prepended with and exclamation mark (!) and do not require quotation marks around string literals. Font |
![]() |
DrawHeader Shading settingsBackground Color Bar Color Bar Height Background Shading Shade Color To Shading direction Highlight position Highlight Intensity |
![]() |
DrawHeader AdvancedAuto text shadow Horizontal and Vertical offset Shadow size Shadow color Icon x and y Text x Class Name |
The local extension is identical to the Global extension, except that in order to use the local settings you need to tick the "Override Global Settings" checkbox. By default the control will use the Global settings.
The settings are now all accessible via the Global Draw extension, and can also be overridden using the local extension. By default the new template and class will be used, however the old template (which uses the imported headings procedure) can still be used by ticking the box on the global extension (to use the old template and procedure for all headers), or on the local extension (to use the old template and procedure for a specific header).
Some of the new features of the DrawHeader class:
For the class methods and properties please see the Class Reference.
There is an example of the Dynamic header in the Clarion\3rdparty\Example\Draw\Headings directory.
The dynamic header template allows you to easily add a title to a window that dynamically renders a drop shadows title and icon. By default the window title and icon are used, but these can easily be customised in the template settings.

1) Make sure you have added the Draw Global Extension to your application.
2) Add the control template to each window you want to use the header on:
Options for old control template (on the actions tab of the control properties)
All the options can be left as default (blank) and the Window title and icon will be used, or you can customise the look and feel as required.
![]()
The DrawHeader class is new in Draw 2.63 and expands the Draw Header features as well as providing an object that allows the header to be easily controlled and modified.
DrawHeader inherits from Draw, and contains all of the properties and methods of the Draw object. This document covers those methods that override the behaviour of the Draw methods (although all call the parent method).
| DrawHeader Methods | |||
| Display |
Renders the header and displays it
|
||
| Init |
Initialise the class and settings.
|
||
| Resize |
Resizes the header and displays it
|
||
| Kill |
Deallocates memory and cleans up
|
||
Displays the header using the current settings. Called automatically when the control is resized, so after calling Resize() it is not necessary to call Display().
Resizes the control - if the control height has manually been changed or the window is wider than the control's width, then the control is resized and redrawn. By default the control is set to resize horizontally, but not vertically. The control will automatically be set to twice the window width on resize, which minimises the number of times that the control needs to be redrawn to improve performance. The control will not be resized if the window size is reduced.
Initialises the control with the default settings and stores the image control handle that will be used to display the header. This calls the parent Draw Init(0 method.
Cleans up the control and all allocated resources.
![]()
These properties are used to determine how the heading will be drawn. They can be overridden manually, or by using the template. The values must be set before the call to Display in order to effect the header. The properties can also be changed in the fly and Display() called in order to dynamically update the header.
| DrawHeader Properties | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
The actual text to display. By default the Init methods sets this to the Window title. This can be set at any point before a call to Display().
Position to display the heading at. The Init() method sets this to a default value.
The position to display the heading text at. The Init method sets this based on the height of the control, the size of the font and the size of the bottom bar (of any) to ensure that the text is always centred in the control. This position is in pixels from the top of the control, and represents the baseline (not the top) of the text. The baseline is the line that each letter is placed onto, letter such as p and g drop below the baseline.
The size of the "blur" for the drop shadow or glow around the text. If the autoShadow property is set then the Display() method calculates this based on the font size.
If set the shadow size and offsets are done automatically.
The number of pixels to offset the shadow horizontally. If the autoShadow property is set then the Display() method calculates this based on the font size.
The number of pixels to offset the shadow vertically. If the autoShadow property is set then the Display() method calculates this based on the font size.
The color for the drop shadow.
The name of the icon to use, can be a resource, or blank.
The background color.
A second background color for gradients.
The type of shading. Can be set to 0 for a solid color, or one of the following equates:
Draw:LinearShade equate(1)
- Shades from bgColor to bgColorEnd.
Draw:SingleShade equate(2) - Shades from
bgColor to bgColorEnd with a highlight as specified by the .highlightPos
property.
Draw:DoubleShade equate(4) - Similar to
SingleShade but the color gradient is perpendicular to the shading
direction.
The shading is determined by the shadeType and shadeDirection parameters.
Sets the shading to vertical or horizontal can be set to one of:
Draw:Horizontal equate(0)
Draw:Vertical equate(1)
The position of a highlight for shading types that use one.
The intensity of the highlight if one is used.
The handle of the icon to draw. The DrawHeader class will automatically fetch he icon from a resource and allocate this handle. It can be allocate manually by calling the Draw.GetIconHandle() directly to load a particular icon either from disk or from a resource.
The position to display the icon at horizontally, from the left hand side of the control.
The position to display the icon at vertically, from the top of the control
The default size for the icon, defaults to 48x48 pixels if the control is large enough, otherwise a smaller icon is selected by the Display() method.
Color used for the bar along the bottom of the control.
End color (for shading) of the bar drawn along the bottom.
The height (in pixels) of the bar across the bottom. The Init() method sets this to 5 pixels by default.
![]()
Copyright © 2008 CapeSoft Software (Pty) Ltd