Professional Documents
Culture Documents
Little templates to
add a lot to your
Clarion applications
2009 Carlos Gutirrez - Sistemas de
Computacin Accesibles del Noroeste, SC
Table of Contents
Introduction .............................................................................................................................. 4
Installation................................................................................................................................ 5
Downloading......................................................................................................................... 5
Installing ...............................................................................................................................6
For users of Release 1 ...............................................................................................................7
Browse to Clipboard to Excel..................................................................................................... 8
What it does .........................................................................................................................8
How to add it to your application ........................................................................................ 10
Template Prompts Reference .............................................................................................. 13
Additional information ........................................................................................................ 14
The Invisible Calculator ........................................................................................................... 16
What it does ....................................................................................................................... 16
How to add it to your application ........................................................................................ 16
Template Prompts Reference .............................................................................................. 17
Additional information ........................................................................................................ 18
Entry controls Cleartype fix and settings ................................................................................. 19
What it does ....................................................................................................................... 19
How to add it to your application ........................................................................................ 19
Template Prompts Reference .............................................................................................. 21
Additional information ........................................................................................................ 22
Auto Next-Tab......................................................................................................................... 23
What it does ....................................................................................................................... 23
How to add it to your application ........................................................................................ 23
Template Prompts Reference .............................................................................................. 25
Additional information ........................................................................................................ 26
Browse Header Sort ................................................................................................................ 27
What it does ....................................................................................................................... 27
How to add it to your application ........................................................................................ 28
Template Prompts Reference .............................................................................................. 30
Additional information ........................................................................................................ 31
Browse Reverse key order....................................................................................................... 32
What it does ....................................................................................................................... 32
SCA Micro Templates for Clarion Release 2
Introduction
When we deploy a new application and do the training, we like to observe how people interact
with the application. Sometimes we can identify small modifications to our windows that will
save hours to the user. This also applies to the development process, if we find we are doing
something time after time, we must do something to automate it.
Thats how our Micro Templates were born. Some of them save time to the users, and some
save time to the developer.
Youll find that our templates are very simple to implement and to use. Many are global
templates that are populated only once in each application and they do their job in all the
procedures.
If you have an idea for a new template or a new feature, please contact us at:
http://clarion.sca.mx, by mail to: clarion@sca.mx or post it to: http://clarionsca.uservoice.com
Installation
Downloading
Please visit our site http://clarion.sca.mx and selection the option Downloads Registered
Subscribers. You must be logged in with the user name and password you used when
ordering the subscription, otherwise, the folder will look empty.
Installing
The name of the setup program is SCAMicro2Install.exe; it handles installing and
registering the templates. It detects which Clarion versions you have installed and lets you
choose one. It supports Clarion 5.5, 6.x and the new structure of Clarion 7.x.
The installer can install the templates to Clarion 4 and 5. We havent tested with those version
but they may work. If you find compatibility problems with these versions, please contact us
with the exact problem details and we will try to fix them.
If you have more than one Clarion version installed, just run the setup program again as for
each Clarion installation.
The setup program complies with the Clarion 3rd Party Association standards for Clarion 7 and
Clarion 6 and older.
This table shows the installed files and the actions performed by the setup program (paths
shown are an example; they may be different in your Clarion installation):
Folder\Files
Clarion 7
Template\
sca2.tpl
C:\Clarion6\3rdParty
\Template
Libsrc\
scainvca.clw scabrwxl.inc
scabrwxl.clw scainvca.inc
Examples\
scaexam.app theexe.app
onedll.app basedll.app
cleartype.bmp
scamicro.dct sca32.ico
scaedit.ico scadelete.ico
scaclose.ico scacancel.ico
scaaccept.ico scaadd.ico
Documentation\
SCA Micro Templates Release
2 Manual.pdf
(This file)
C:\Clarion6\3rdParty
\Libsrc
C:\Program Files\Softvelocity
\Clarion 7\Accessory
\Template
C:\Program Files\Softvelocity
\Clarion 7\Accessory
\Libsrc
C:\Documents and Settings
\All Users\Documents
\SoftVelocity
\Clarion7\Accessory
\SCA\MicroTemplates
Images\
iehand.cur scadrop.ico
scamicrologo.bmp
scarefresh.ico
scacopyexcel.ico
scaexcel.ico
Bin\
SetClarion3rdPartyRed.exe
Addins\
AccessoryMenu.addin
MicroTemplates.addin
SCA.Addin
SCA.resources
Extra Actions:
C:\Clarion6\3rdParty
\Images
C:\Clarion6\3rdParty
\Examples\SCA\MicroTemplates
C:\Clarion6\3rdParty
\Docs\SCA\MicroTemplates
C:\Program Files
\Softvelocity
\Clarion 7\Accessory
\Documents
\SCA\MicroTemplates
C:\Program Files
\Softvelocity
\Clarion 7\Accessory
\Images
C:\Clarion6\3rdParty
\bin
C:\Program Files
\Softvelocity
\Clarion 7\Accessory
\Addins
Template registration
Template registration
If the user clicks on No, the data can still be pasted manually in the Excel sheet in any
position:
If you prefer to have the feature more visible to the user, there is a Button Control Template
which can be populated for each browse:
Thats all. The global template detects all browses in the application and adds an option to the
browses popup menu.
If for some reason you need to disable the template for one procedure, open the procedure
Extension, add the extension Browse to Clipboard to Excel and click on the Disable
checkbox:
If you want to have a button visible near the browse, open the window in the Window
Formatter, click on the Control Template button ( ), select Refresh Window Button, and
then place the button where you want it:
If the window has two or more browses, youll be prompted to choose the browse to which
the button will be linked before placing the button in the window:
Disable: Disables all code generation for this template in all procedures.
Add popup menu option to all browses: Enabled (default) adds a menu option to all browses
in the application. Disabled, it only adds the global class to the application. In this case, the
Button Control Template should be populated to each browse where the feature is wanted.
Menu option text: Text for the popup menu option.
Icon: Icon for the popup menu option.
Procedure Extension:
Disable: Disables all code generation for this template in current procedure.
Button Control Template:
Add popup menu option: This option cant be edited if the global Add popup menu option to
all browses is enabled. If you disable the global option, you can choose if the option is added
to the browses popup menu, or only use the button.
Additional information
If you want to change the text or look of the Paste confirmation dialog, go to Global Properties
Embeds, scroll down until you find SCA Browse to Excel Before Parent Call, click on
Insert, select Source and the Select button:
Thats all. The global template will be enabled for all numeric fields (pictures starting with
@n) in all the windows in the application. It will also work for entry fields in Edit-in-place
browses.
SCA Micro Templates for Clarion Release 2
If for some reason you need to disable the template for one procedure, open the procedure
Extension, add the extension Invisible Calculator (procedure) and click on the Disable
checkbox:
Disable: Disables all code generation for this template in all procedures.
Procedure Extension:
Disable: Disables all code generation for this template in current procedure.
Additional information
The text typed by the user is passed to Clarion EVALUATE function, so an invalid expression
may return zero. This also means that mathematical functions are available:
Numeric fields with DECIMAL alignment can cause problems if the user enters amounts with
decimals. Its recommended to change them to RIGHT alignment.
Windows Vista and Windows 7 enable Cleartype by default in PCs with LCD monitors. Clarion 7
fixes this problem, but as it may take a while for Clarion developers to port all applications to
Clarion 7, this template solves the problem:
Thats all. The global template will process al windows in the application. For Edit-in-place
browses it will configure the font of the temporary entry fields created by the ABC classes.
If for some reason you need to disable the template for one procedure, open the procedure
Extension, add the extension Cleartype and Entry controls settings (procedure) and click on
the Disable checkbox:
Disable: Disables all code generation for this template in all procedures.
Fix Cleartype for ENTRY/SPIN/DROP/COMBO: Replaces the font of those controls with a
Bitmap font
Bitmap Font: The font to use. It must be a Bitmap font.
Set Flat ENTRY/SPIN/DROP/COMBO/TEXT/LIST: Changes FLAT property for those controls to
True
Set Boxed TEXT: Set the BOXED property for TEXT controls to true
Set color for REQ ENTRY/SPIN/DROP/COMBO/TEXT: Changes the color of those controls if
they have the REQ property. It helps the users to identify what info must be entered before
pressing Accept (i.e. instead of pressing Accept to find out which fields are required).
Color: The color to use for required field. Default is:
Declare ColorReq() procedure: It declares a procedure to update the color of a control if you
change the REQ property programmatically, for example:
IF PO:IsShipped = True
?PO:Address{PROP:Req} = True
ELSE
?PO:Address{PROP:Req} = False
END
ColorReq(?PO:Address)
Set cursor for BUTTON: Changes the cursor property of all buttons in the application so the
mouse shows a little hand like Internet Explorer:
Cursor: The cursor file to use. IEHAND.CUR is included, but you can choose your own.
Set Icon for WINDOW: Set the icon for all windows in the application:
Icon: The icon file to use. SCA32.ICO is included in the example application, but youll want to
use your own.
Procedure Extension:
Disable: Disables all code generation for this template in current procedure.
Additional information
Code to fix Cleartype is generated but not compiled in Clarion 7
Auto Next-Tab
What it does
(To avoid confusion, in this text TAB is the controls container inside a SHEET, and Tab is the
keyboard key)
If you have a form with many fields and you organize them in TABs, if the user uses the Tab key
to navigate the controls, when the Tab key is pressed in the last filed of the first TAB, the
cursor goes to the next field after the SHEET, when usually the user wants to go to the first
field of the next TAB.
Standard behavior:
Thats all. The global template will check all windows in the application and for windows with
TABs will generate the code.
If for some reason you need to disable the template for one procedure, open the procedure
Extension, add the extension Cleartype and Entry controls settings (procedure) and click on
the Disable checkbox:
Disable: Disables all code generation for this template in all procedures.
Using EnterKey?: If you enabled the option Use ENTER key instead of Tab, you have to
enable this option. With this, the template will detect the Enter key in addition to the Tab key
to select the next TAB.
Using EscKey?: If you are using code or a template to let the user go to the previous field using
the Escape key, you have to enable this option.
Procedure Extension:
Disable: Disables all code generation for this template in current procedure.
Additional information
If a window doesnt have a TAB control, it wont generate any code for that window.
If you are using an Enter=Tab template which uses ALIAS, this template wont work. It works
fine with Clarions Use ENTER key instead of Tab which uses PROP:Alert
Clicking again in the de currently selected column, reverses the sort order:
Clicking in another column, changes the sort order and the displayed locator:
2. From the same window, select the button Extensions, select your browse, press the
button Insert and select Browse Header Sort:
3. In the Default Sort Order box, configure the list box column linked to the browses
default sort order, and if you have a Locator, enable and select it:
4. In the Conditional Sort Order box, press the Insert button and select one of the
keys defined in Conditional Behavior and link it to the respective list box column. You
can also configure a locator for this sort order.
Additional information
Clarion 6 and newer has a similar feature, but it works using the file driver capability to sort
the information. With big tables this can be a slow process. Using this template instead of
Clarions, you can choose the most efficient key to use for each column for better result.
Additional information
Additional information
If you were using the option After successful Insert: Insert Another Record, you need to
change it to Return to caller.
),
Additional information
The template calls ThisWindow.Reset(1), so it refreshes all browses in the window.
),
In the Actions window, select the controls for the date fields:
Additional information
Multi-DLL applications
Adding the templates to solutions using multiple applications as dlls
The short version: Add the global templates to all the APPs and recompile.
A more precise rule is: Add the global templates to the base dll (your data.dll) and to all the
applications with windows.
Browse extensions and Control Templates (with the exception of Browse to Clipboard to
Excel Button ) dont need a global extension, so they can be added to any procedure in any
application and work fine.
The Control Template Browse to Clipboard to Excel Button needs the global template to be
present in the application, but it cant be populated if it isnt.
The templates detects if your application is part of a Mult-Dll solution by checking application
property Destination Type and the value of the global ABC option Generate template
globals and ABCs as EXTERNAL (symbols %ProgramExtension and
%GlobalExternal). Using these values they decide how to declare, link and export the
needed classes.
In the examples directory there are three apps showing how it works:
basedll.app
onedll.app
theexe.app