| Draw Tutorials and Examples | ||
| Contents | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
This section of the Draw documentation covers the examples that ship with Draw, along with tutorials and "JumpStart" guides, which are aimed at getting you started as quickly and simply as possible.
Unlike the Clarion drawing functions, the Draw control does not display the result as each function is called, you need to call the Draw.Display() method to update the Draw control. Before drawing, you can call the Blank method to erase everything on the Draw control, or simply draw over the existing image. This allows you to do real-time animation, simply by calling all the drawing commands before calling Display to update the control, and Blank between each frame of the animation. Note that Blank does not take effect until Display is called.
Like the Clarion image control, the origin of the Draw control
is the top left corner and is (1,1). See the image below.

A typical usage of the Draw methods would be:
!--- Call draw methods and call Display() to display the result
Drawer.Blank() ! Blanks image control
Drawer.SetPenColor(COLOR:Red)
Drawer.Ellipse(1, 1, Drawer.width, Drawer.height,
COLOR:Green)
Drawer.Display() ! Redraws image control with new contents
This would display an ellipse with red line and a green fill that is the width and height of the Draw control.
You can draw to any image control on a window or a report, however when drawing to a report, you need to call the Clarion SetTarget(Report) function before calling any Draw methods. You can call SetTarget() with no parameters to make the current topmost window the current target. See the section on Using Draw on a Report
There are a number of examples in your \Clarion\3rdParty\Examples\Draw directory. The examples are a great way to get started and see a few of the ways you can use CapeSoft Draw. Draw ships with the following examples:
![]()
![]()
![]() |
Keen to get started? Or just don't like wading through all the documentation? This section is just for you - the basics on how to get Draw working as quickly and simply as possible. This jump start will show you how to place a Draw control on a window and draw a red rectangle into the control. The completed app is in the /3rdparty/examples/Draw/JumpStart/ directory in you Clarion directory (QuickDraw.app is the ABC version and QuickLegacy is the Legacy version). |
||||||||||||||||
|
|
|
Create a new application (or open an existing one). The app must be compiled as 32-bit, as Draw does not support 16-bit programs. |
|||||||||||||||
|
|
Select a procedure with a window that you would like to place the Draw control on (create one if necessary), right click the procedure name and choose "window" to open the window formatter. | ||||||||||||||||
|
|
Place an image control on the window. You will be prompted to select the control template to use, choose "Draw - CapeSoft Draw control". Resize the Draw control - you can make it any size you like. |
||||||||||||||||
|
|
Right click on the Draw control and choose "Actions".
Change the name of the object to "drawer". Click OK |
||||||||||||||||
|
|||||||||||||||||