Tailor Template 6.1

Introduction
Tailor Template  for Clarion 5~5.5~6.3 ABC/Legacy. Template to
extend Clarion Window Editor functionality and let you tailor arbitrary 
non-rectangular windows right in Clarion IDE. Besides it can make 
them to behave like MS Media Player. Download Demo.
Move cursor on top of the picture!
Standard way of making non-rectangular windows these days is to design Window
shape outside of IDE as a BMP image and then import it into application.
As it is external image, it can take a lot of time to alight it with other window controls.
And even after this, if you decide to change window font, for instance, you have 
to start those alignments all over again.
That is why Tailor template implements different approach.
With this tool you just draw your non-rectangular window on top of
ordinary one with standard Clarion controls - Ellipse, Rectangle, Round rectangle 
and Line. All that right in Clarion Window Editor.
So you can use all power of Clarion to alight those, center them, distribute them and so on.
Besides you can exploit another Windows APIs feature - different merging modes for
those controls. So in a matter of minutes you can develop absolutely amazing
windows like that one pictured above. You can find few other examples in template demo.
As soon as you finished with this non-rectangular window, Clarion IDE
will take care of those controls. So if you change window font, Clarion will automatically
resize both window and all controls including those used by tailor template.
So there is no extra work to be done - all your window controls
will always fit perfectly the window shape you have once designed.
Main advantages of using template:
  • Allows you to use Clarion IDE to design non-rectangular
    windows instead of developing them outside of Clarion
  • Dead easy to use - all you need to do is to draw your window  
    with few standard Clarion controls and template will do the rest
  • Let you exploit very powerful feature of Windows APIs -
    different merging modes (AND, XOR etc.) for those controls.
    (The image above is an example of using XOR to get target shape.
    Put cursor on top of it to see how this window looks in IDE).
  • Provides all routines required to explode/implode the window to
    make it to behave like MS Media Player 
  • Template does not need or do any changes to either Clarion native
    or 3d party templates. It's a rule of thumb for us!
  • Compatible with Clarion 5~5.5~6 ABC/Legacy
Installation
 
Run the installation wizard. It will guide you through a few simple steps. That is it.
IMPORTANT: If you are using Clarion 5 or 5.5, after selecting Clarion5 or C55 
directory wizard will offer you to install it into C:\Clarion5\Clarion6 or C:\C55\Clarion6 directory 
respectively. So do not forget to get rid of last \Clarion6. But even if you do - it is not a problem.
Just uninstall template and run installation once again.
To start using template you have to manually register it.
Open Clarion (no application must be opened). 
Go to menu Setup -> Template Registry ->Register. Select new template
tailor.tpl and then hit Open button
View animated reminder on how to do that - Registering Template
(built with our JAVA Animated Help Builder).
Using Template
Global Extension Template
You have to insert Global Tailor extension into your application first and then repeat this
routine for each window to be tailored and insert respective local extension. 
To quicker find them in the list of templates locate them by word "tailor".
Unhide All Tailor Controls checkbox is just a development tool.
By default template hides all of them, but you might want to disable it
to make sure that what you have designed does match the final window shape.
Template employs a number of API functions so it defines all prototyped for you.
If you hit respective button you can see full list of them.
You will hardly need to touch this area at all. But sometimes you will not be able to
compile your application if some other 3d party template provides one of those 
prototypes. You will see compile error: "Indistinguishable new prototype: APIname()".
So in this case and in this case only you should un-tick respective checkbox.
So Tailor template will use that another prototype. If that another 3d party template
provides similar functionality, you can do everything other way around.
Local Extension Template
As soon as you insert Local Tailor extension into your Window you can go directly 
to Window Editor and tailor your window. You will see a number of tailor controls
when you hit Populate -> Control template... menu item or use respective button on 
the Tool box. Again it is easy to locate them in control list by word "tailor".
There are no restrictions on number of those controls so use as many as you wish.
Template takes care of almost all position alignments so you will need those 2 Shift
prompts only in some exceptional situations. For instance, when you have an ordinary
window with menu or toolbar. In this case you can either put some numbers there
(negative or positive) or define some numeric variables and use them (no exclamation 
mark is needed in front of it!). It will shift final window shape by this value.
All those controls are just ordinary Clarion controls. So only few comments are needed.
There is absolutely no difference between Ellipse and EllipseBorder and between 
Box and BoxBorder or between BoxRound and BoxRoundBorder in terms of functionality.
So it more depends on your preferences. If you use default merging mode (OR)
that is you want to combine all those controls in one shape, you will probably be happy
with those controls having no borders. If you use any other mode, bordered versions of the
same controls will suit you better. But if you have already placed some control
you can change its property, colour, borders etc. So you can make bordered version of
any control to look like non-bordered and contra versa. 
See example application for details (C:/Clarion*/Examples/Tailor/Demo/).
Tailor template has 2 types of lines. LineRound is just an ordinary Clarion line. So you can
use it as normal Clarion line, change thickness, rotate it etc. Control Template Line is some
sort of abstraction (it is slightly darker, so you can tell it from Rounded line). 
When template uses that, it gets rid of round ends. Unfortunately, it
is the only way we could find to draw falling rectangles in Clarion Window editor.
It is important to stress that the Line control is the only exception! All other tailor 
controls look exactly the same in Window editor as they do in final window.
The picture below demonstrates how the Line template works:
In each window procedure template generates a number of useful routines to
manipulate those non-rectangular windows. So you can easily implement windows 
similar to MS Media Player as well as many others.
So here is a short reference of what each of them does:

DO ExplodeWindow !  will make window to return to its original [rectangular] shape.

DO ImplodeWindow !  will convert rectangular window into non-rectangular one.

SleepFor = 100 !  timer units (hundredths of a second)
DO Sleeping !  will make this thread to sleep for 1 second.       

DO IfCursorInside
IF locCursorInside
 
!  do whatever you like when users have their cursor inside
  !  of non-rectangular window.

ELSE
 
!  do something else when cursor is outside.
END  

See template example for more details. You can find it in 
C:/Clarion*/Examples/Tailor/Demo/ directory.
Some Tips
Showing window caption bar
Sometimes you will want to show window caption bar (part or whole). 
You may need it to provide your users with some of it's functionality.
For instance, this Globe window pictured above shows part of it to allow
users to drag and drop this window just as an ordinary one.
Clarion window editor will not allow you to drag any control on top of it.
So you can use 3 techniques. First, you select this control and use keyboard
arrows to move part of it outside of the window. Second, you go to tailor control 
property/position and set the latter to move control where you want it. You will 
see only part of this control, but Tailor Template still can "see" whole control.
Alternatively, you can use local control prompts Shift All Right and Shift All Up
to archive the same result.
Working with Frames
The only place where you can put controls in application frame template is
Toolbar. So it is what you should do to tailor this window. You might want
to make this toolbar big first to allow more room for your drawing.
Then, when you have finished design, you can set it back to original size.
And if you want to show either window caption or status bar you can employ
any of 3 techniques described in the tip above.
Handling Windows XP Themes
Then those are enabled, you will notice that tailored window gets shifted down.
To cure this problem (works in C6 only), you should put this code anywhere
in the beginning of your window being tailored:

IF SYSTEM{PROP:ThemeActive} = TRUE
    LOC:ShifAllUp = 5
END

Copyright (C) 2002 Vivid Help Systems Pty Ltd