Welcome

This is the ABC Free Templates and Tools set reference guide.

You’ve probably heard the phrase “work in progress”.  That’s this set of templates, and that’s this reference guide.

The ABC Free Templates and Tools set was created primarily due to my pack-rat-like nature.  Whenever I see an interesting piece of code or logic, I’d like to ensure that I’m able to find it when and if I need it.  Well, it’s never been quite as simple as that.  I mean, that’s what a knowledgebase is for, right?  This is more of an attempt to make those pieces of code useful as quickly as possible, and an attempt to learn something along the way.  Not all of these templates work perfectly, and not all of these templates have even been tried by yours truly more than once.  Nonetheless, I’m sure you’ll find something useful here, even if it’s only a starting point for your own adventure in Clarion.

Why is it free?  Well, there are several reasons.  First, it’s a “work in progress”. Second, a lot of the code is based on what is already in the public domain, or has been donated by other authors specifically for free distribution.  Third, I have hopes.  Hopes that someone somewhere will find this stuff useful, and maybe even let me know what problems, if any, they find and/or solve.  (That’s right – for some of these templates you’re my beta tester - thanks!).

So, without further ado, please proceed to any section that interests you, and don’t be afraid to let me hear your feedback!

And please, if you would like to contribute anything – templates, tools, reference material, or additions/corrections, feel free to email me.

Vince Sorensen
sorev@dlcwest.com
http://www.dlcwest.com/~sorev
http://www.dlcwest.com/~sorev/topspeed


apiEnumChildWinRefresh

TYPE: Code
PROPERTIES:
API: Enumerate Windows - Refresh Child Queue

Refreshes the queue of child window titles for the current record from the top-level window title queue.  See also apiEnumWin and apiEnumWinRefresh.


apiEnumWinRefresh

TYPE: Code
PROPERTIES:
API: Enumerate Windows - Refresh Queue

Refreshes the queue of top-level window titles. See also apiEnumWin.


EmbedInformation

TYPE: Code
PROPERTIES:
Embed: Display EMBED() information

This template is useful for determining what parameters you would need to create an #EMBED() statement that would locate code in the current position.


LookupAndCopyFields

TYPE: Code
PROPERTIES:
Lookup: Fetch a related record, copy fields

This Code Template will fetch a related record, then fill similarly named fields.


MiscCheckUnkeyedLinkedFieldDeletion

TYPE: Code
PROPERTIES:
Misc: Check for unkeyed link fields

When a parent record is to be deleted, you may first wish to cycle through child files (where referential integrity constraints may or may not have been set up) and ensure that none exist.  This template may also be used to simply find the first child record.


MiscFilePopup

TYPE: Code
PROPERTIES: PROCEDURE, MULTI
Misc: File-based popup selection

Create a file-loaded pop-up. Untested.


MiscListControlsWithTemplates

TYPE: Code
PROPERTIES:
Misc: List controls that were populated using a template

This is a template debugging tool.


ProcedureCallExt

TYPE: Code
PROPERTIES:
Procedure: Call a procedure with parameters (extended)

Based on code by Arnor Baldvinsson.  Call a procedure with parameters, with the option to assign a return value or start a thread.


ProcedureCallWithParameters

TYPE: Code
PROPERTIES:
Procedure: Call with parameters

Simply call a procedure with parameters.


ReportChildLoop

TYPE: Code
PROPERTIES: MULTI,)
Report: Print (loop) child file details

Loop through a child file, and optionally print a header, detail, and footer section.


ValuesAssignTemplateVariables

TYPE: Code
PROPERTIES: PROCEDURE
Values: Assign program variables to template values

You can assign the application name, procedure name, application creation/modification date/time, and compile-as-32-bit flag to variables.


ValuesGetComputerName

TYPE: Code
PROPERTIES:
Values: Get Computer Name (32 Bit Only)

Template supplied by Jeff Berlinghoff, email BERLINGHOF_J@epic6.dep.state.fl.us


ValuesGetWindowsUserName32

TYPE: Code
PROPERTIES:
Values: Get Windows User Name (32-bit only)

A CSTRING is required in order to call the API function. You may have a hardcoded value you wish to use if a user is not retrieved. Example: **Invalid**


ValuesLoadQwithFileList

TYPE: Code
PROPERTIES:
Values: Load queue with list of files used in this application

This template will load a simple queue with the list of files used in this application. Alternately, a procedure can be called using two parameters: a reference to the file, and the file "name". ...and/or...


BrowseCopyButtonABC

TYPE: Control
PROPERTIES:
Browse: Copy record from a Browse Box (ABC)

Copy a record from Browse Box and call the update procedure in Insert mode.


BrowseFilterCombo

TYPE: Control
PROPERTIES: REQ(BROWSEBOX(ABC)),MULTI
Browse: Filter based on Combo contents (ABC)

 This template is incomplete. You may want to use it as a guideline only. Steps to filter a browse: 1. Add this template. 2. Add "reset" fields to the browse if the Xplore template is used. To use this template as a guideline, search the source code for "BFC:". This inserts code to load a queue from a file. You will have to manually update the field (in the window structure) to use this queue.


BrowseFilterComboWithGroup

TYPE: Control
PROPERTIES: DESCRIPTION('FILTER BROWSE BOX ON ' & %PRIMARY),REQ(BROWSEBOX(ABC)),MULTI
Browse: Filter based on Combo with surrounding group box (ABC)

 This template is incomplete. You may want to use it as a guideline only. Steps to filter a browse: 1. Add this template. 2. Add "reset" fields to the browse if the Xplore template is used. To use this template as a guideline, search the source code for "BFC:". This inserts code to load a queue from a file. You will have to manually update the field (in the window structure) to use this queue.


BrowseMoveSequencedUpDownABC

TYPE: Control
PROPERTIES: WINDOW,REQ(BROWSEBOX(ABC))
Browse: Move Sequenced Records Up/Down (ABC)

A set of controls intended to allow the end-user to re-sequence sequenced records.  Note that you must prime any fields that precede the sequence field (“Fields to Prime” button).

For faster processing, you can also have LOGOUT/COMMIT or STREAM/FLUSH added.  There are also options to insert (assign the sequence variable to the current value, and move the rest of the records out of the way) or delete (close the gap) in sequence.

Example from Chris Cook (thanks!):

CustomerRate

ByRateNo                 KEY(Rat:RateNo)

Unique, auto-number

ByCustomerNo        KEY(Rat:CustomerNo,Rat:Sequence)     Unique

Record                      RECORD,PRE()

RateNo                         LONG

CustomerNo                LONG

Sequence                    BYTE

                                   END

etc. etc.

Browse uses key by customer no with current customer no as current value.

The properties for the move sequence records up and down are:

File=CustomerRate

Key=Rat:ByCustomerNo

Sequence field=Rat:Sequence

I then complete the prime fields function with the value for Rat:CustomerNo set to the current customer. If you root through the code you'll see that the values put into the prime fields are used as a filter on the sequencing. You only prime the key values higher in order than the field used for sequencing.


BrowseViewButtonABC

TYPE: Control
PROPERTIES: REQ(BROWSEBOX(ABC))
Browse: Call Standard Update Form to View

Superceded by the BrowseViewButtonClass template.


BrowseViewButtonClass

TYPE: Control
PROPERTIES: REQ(BROWSEBOX(ABC)),MULTI
Browse: Call Standard Update Form to View (Class)

This calls the update procedure (specifed in the ABC BrowseUpdateButtons template) in view mode. You do not have to specify a procedure to call.

To operate correctly, you need two changes at the global level:

(1)	The vsBrowseClass Class is required - replace BrowseClass with vsBrowseClass (in global class declarations).

(2)	Add the FormViewClassGlobal extension template.


FormStringWrapText

TYPE: Control
PROPERTIES: MULTI,REQ(FORMSTRINGWRAPGLOBAL),WINDOW,MULTI
Form: Wrapped strings

Based on code posted in comp.lang.clarion in February 1999.

Use when you want to have a series of string simulate a display-only memo field.


FormWizardButtonClass

TYPE: Control
PROPERTIES: WINDOW,MULTI
Form: Wizard Buttons (Class) for forms with OK/Cancel

Add Next/Back buttons to a form that has a tabbed sheet to create a “wizard”.  Class-implementation (VSA_FWIZ.*), with embed points for customized code.  Object.CurTabNum gives current tab number.

TIP:  Hide tabs when you need them skipped.


FormWizardButtons

TYPE: Control
PROPERTIES: WINDOW,REQ(SAVEBUTTON(ABC))
Form: Wizard Buttons for forms with an OK and Cancel

Add Next/Back buttons to a form that has a tabbed sheet to create a “wizard”. Assumes you have an ?Ok and ?Cancel control.

Use FormWizardButtonClass instead.


FunctionCallCalender

TYPE: Control
PROPERTIES: MULTI,WINDOW,REQ(FUNCTIONS)
Function: Call Calendar function

Call a standard calendar and return the selected value. Requires the Functions global template.


LookupButtonDesc

TYPE: Control
PROPERTIES: WINDOW,MULTI
Lookup: Find value, show the description

This template will maintain a set of related ENTRY/LOOKUP BUTTON/DESCRIPTION fields: - The ENTRY field is validated. If it is invalid, the lookup procedure is called. - A lookup procedure is called from the LOOKUP BUTTON. - The description field is filled if the ENTRY field is valid, blank if it isn''t. The Lookup Key is the key used to perform the value validation. If the Lookup Key is a multi-component key, you must insure that other key elements are primed BEFORE this Code Template is used. The Lookup field must be a component of the Lookup Key. Before execution of the lookup code, this field will be assigned the value of the control being validated, and the control will be assigned the value of the lookup field if the Lookup procedure is successful. The Lookup Procedure is called to let the user to select a value. Request upon entrance to the Lookup will be set to SelectRecord, and successful completion is signaled when Response = RequestCompleted.


LookupButtonSimple

TYPE: Control
PROPERTIES: WINDOW,MULTI
Lookup: Find a value

Adds a button that when pressed allows the user to select a record.  Does not validate the entry field that precedes it.


LookupButtonTrigger

TYPE: Control
PROPERTIES: WINDOW,MULTI
Lookup: Trigger previous entry control

Trigger an Entry Control Lookup. The control immediately preceding this button will be used, and you must have already filled in the lookup information on the entry control’s properties->actions tab.


LookupDescReport

TYPE: Control
PROPERTIES: REPORT,MULTI
Lookup: Find value to print on report

This template will maintain a set of related BASE and DESCRIPTION fields: - The description field is filled if the base field is valid, blank if it isn't.


LookupEntryCompletionControl

TYPE: Control
PROPERTIES: MULTI
Lookup: Auto-completion entry field

This template will allow users to select from a queue or file using an auto-complete entry field. Note: Key must have only one free element. Place appropriate code in the Access:%File.PrimeRecord() method if priming is required.

If you are basing the entry on a queue, make sure that relevant field (the one you want to base completion on) is the first field in the queue.


MiscDisplayAmount

TYPE: Control
PROPERTIES: WINDOW
Misc: Display an amount (ABC)

Places a string and prompt control on the window, and fills in the string with a numeric value.


PrintButton

TYPE: Control
PROPERTIES: FIRST
Procedure: Call print procedure(s)


ReportStringWrapText

TYPE: Control
PROPERTIES: MULTI,REQ(FORMSTRINGWRAPGLOBAL),REPORT,MULTI
Report: Wrapped strings

See also FormStringWrapText.

NOTE: Leave "Fill with" blank to use initial value from dictionary


apiEnumChildWin32AutoRefresh

TYPE: Extension
PROPERTIES:
API: Enumerate Windows - Refresh Child Queue on Gain Focus Event

Refreshes the queue of window titles automatically when current window gains focus.  See also apiEnumWin and apiEnumWinRefresh.


apiEnumPrinters

TYPE: Extension
PROPERTIES: PROCEDURE
API: Enumerate Printers

Adds a class that provides a queue containing the list of printers. (Object).DefaultPrinter contains the name default printer. (Object).PrinterQ contains the list printer. (Also valid as a procedure extension)


apiEnumWin

TYPE: Extension
PROPERTIES: APPLICATION
API: Enumerate Windows and Child Windows (32-bit Only)

Load queue with list of top-level window titles. Optionally load another queue with list of child "windows". (Child windows can be windows, buttons, or other controls).


apiEnumWin32AutoRefresh

TYPE: Extension
PROPERTIES:
API: Enumerate Windows - Refresh Queue on Gain Focus Event

Refreshes the queue of window titles when current window gains focus.  See also apiEnumWin and apiEnumWinRefresh.


apiGetError

TYPE: Extension
PROPERTIES: APPLICATION
API: Get last error from API

This adds the GetAPIError function. This function can be used to get further information in a string format when an API call fails or returns an error.


apiNTServices

TYPE: Extension
PROPERTIES: APPLICATION,LAST
API: NT Service Global Support

On Windows NT systems, you may run a console application as a service.  This service does not depend on a specific user being logged in, but instead is logged in automatically by NT when it starts.

I do not recommend using this template until you have familiarized yourself with the concept of services (MSDN is a good source), and examined the contents of the comments in VSA_NTSR.TPW.

In Clarion 4 and earlier, there was a conflict between the NT thread manager and Clarion’s thread manager, so that an ACCEPT loop could not be used.  I have had a report that this is no longer the case in Clarion 5, but I haven’t tried it myself.

NOTE: Do not use spaces in the service name. Spaces can be used in the display name.


apiPressKeyClass

TYPE: Extension
PROPERTIES: APPLICATION
API: Declare PressKeyClass

Useful for sending keys to other applications.

Declares the PressKeyClass Class and SendKeys Object at the global level. Use SendKeys.vsPress() and SendKeys.vsPressKey() in place of PRESS() and PRESSKEY().  SendKeys.PressEx() will translate embedded keywords on the fly – for example, you could SendKeys.PressEx(‘This is a test[ENTER]’).

Now compatible with international keyboards that have an Alt-Gr key.

Example in : TSend.CLW and Tsend.PRJ


apiRegistryClassGlobal

TYPE: Extension

PRPOERTIES: APPLICATION

API:  Declare Global Registry Class

Access Windows Registry using:

-	Simple Get/Put/Delete methods similar to GETINI() and PUTINI()

-	Fetch/Update/Remove methods similar to other languages.

Examples:

Registry.Get('MyKey','MyValue','HKEY_CURRENT_USER')

Registry.Get('MyKey','MyValue',HKEY_CURRENT_USER)

Registry.Get('MyKey','MyValue','Default_Value',HKEY_CURRENT_USER)


apiRegistry

TYPE: Extension
PROPERTIES: APPLICATION,LAST
API: Registry functions (Global access to the Windows Registry)

The class-based template is more flexible, but this extension is retained for compatibility with existing applications.

The following FUNCTIONs use the default registry key root name:

AddRegistryList(ServerName,ListName,Value) returns 0 or error.

FindRegistryList(ServerName,ListName,Value) returns 0 or element #.

GetRegistryList(ServerName,ListName,Queue) returns the queue.

SetRegistryList(ServerName,ListName,Element#,Value) returns 0 or error. GetRegistryItem(ServerName,ItemName,ResultsString) returns 0 or error. SetRegistryItem(ServerName,ItemName,NewValue) returns 0 or error.

The following FUNCTIONs do not use the default registry key root name:

_AddRegistryList(ServerName,ListName,Value) returns 0 or error.

_FindRegistryList(ServerName,ListName,Value) returns 0 or element #.

_GetRegistryList(ServerName,ListName,Queue) returns the queue. _SetRegistryList(ServerName,ListName,Element#,Value) returns 0 or error. _GetRegistryItem(ServerName,ItemName,ResultsString) returns 0 or error. _SetRegistryItem(ServerName,ItemName,NewValue) returns 0 or error.

Example of using the raw API calls:

The following code checks the registry to get the current program id for Outlook.

        Module('api')

          RegOpenKeyEX(unsigned,*cstring,uLONG,uLONG,*uLONG),LONG,pascal,raw,Name('RegO

penKeyExA')

          RegCloseKey(unsigned),LONG,pascal,proc

          RegEnumValue(Unsigned,uLONG,*CSTRING,*uLONG,uLONG,*uLONG,*CSTRING,*uLONG),boo

l,pascal,raw,name('RegEnumValueA')

        END

GetOutLookName        PROCEDURE(*CSTRING pAppObjName)

hregkey            ULONG,AUTO

szKeyName          CSTRING('Outlook.Application\CurVer')

szValueName        CSTRING(20)

cbValueName        ULONG

datatype           ULONG

cbData             ULONG

  CODE

  CLEAR(pAppObjName)

  IF regOpenKeyEX(80000000H, szKeyName, 0, 20019H, hRegKey)

    RETURN

  END

  cbValueName = SIZE(szValueName)

  cbData = SIZE(pAppObjName)

  IF RegEnumValue(hRegKey, 0, szValueName,  cbValueName, 0, DataType,

pAppObjName, cbData)

    CLEAR(pAppObjName)

  END

  RegCloseKey(hRegkey)

  RETURN


apiSendKeys

TYPE: Extension
PROPERTIES: APPLICATION
API: Send keys to another application

This global template adds functions that allow you to send keys to other applications. (Requires EnumWindows32 template)

apiPressKeyClass is a more up-to-date template that provides similar functionality.


apiSubclass

TYPE: Extension
PROPERTIES: PROCEDURE,LAST
API: Subclass (Tray, Shutdown, Hot Keys, etc)

Declarations Code Mouse This template should generally be an extension on your application''s main procedure if you''re using the Shut Down and Tray Icon options. Buttons/Clicks: Leave these blank to use the default actions (Double-click=restore, Right-click=default menu). Code Before/After Can be used to make "minimize to tray" a user preference. Stay In Tray The tray icon can be available either with the main window, or in place of the main window. Post Events Posts events Event:NIM:MouseLeft, Event:NIM:MouseRight2, etc. to your main ACCEPT loop. Icons/Tips You can use variables for the icon and tip fields by prefixing with an exclamation mark ("!GLO:IconName") NOTE: These are not dynamically updated. If you change tip and icon variable contents, use Shell_NotifyIcon with the NIM_MODIFY parameter. (Animated icons shows an example of this. Icons should be entered without a hard-coded pathname (I.E. Use THIS.ICO rather than C:\CW20\ICONS\THIS.ICO). (Timer=0 uses Window setting) If "stay in tray" activated: This template should generally be an extension on your application''s main procedure if you''re using the Shut Down and Tray Icon options. - The code before/after fields can be used to make the "minimize to tray" a user preference. - Typically the left double-click restores an app while the right-mouse event gives a popup menu. - The tray icon can be available either with the main window, or in place of the main window. - "Post Events" sends events Event:NIM:MouseLeft through Event:NIM:MouseRight2 to your main procedure. - You can use variables for the icon and tip fields by prefixing with an exclamation mark ("!GLO:IconName") - Icons should be entered without a hard-coded pathname (I.E. Use THIS.ICO rather than C:\CW20\ICONS\THIS.ICO). NOTE: This procedure will be passed two parameters: (ULONG wParam,LONG lParam) Multi-Function Sub-Classing - Gives access to Windows events normally handled automatically by Clarion. - Lets your application shut down graceful


apiSystemHotKey

TYPE: Extension
PROPERTIES: PROCEDURE
API: System-wide Hot Keys

Registers system-wide hot keys – when the user presses a given key, your application is alerted, and may take action.

- Populate this template on your application frame or main procedure.

- Use the embed point to process messages

- LastSystemHotKey contains the translated key code (eg. "Ctrl-Shift-B")

- Examine VSA_HOT.TRN for a list of valid base keys

- Hot keys should be entered as standard equates.

Examples: CtrlShiftUp, Shift-Alt-F, CtrlEnter

- Object.KeysQ - Queue of hot keys to register/watch

- Object.PassedKeysQ - Queue of hot keys pressed

- Object.Activate - Register queue of hot keys with Windows

- Object.Unactivate - Unregister queue of hot keys

- Object.AddKey(String) - Add a key to the hot key queue

Example:

HotKeys.AddKey(''Ctrl-Shift-R')

HotKeys.AddKey(''Ctrl-Shift-S')

HotKeys.AddKey(''Ctrl-Shift-T')

HotKeys.Activate()

- Object.RemoveKey(String) Example: HotKeys.RemoveKey(''Ctrl-Shift-R'


apiTerminateProcess

TYPE: Extension
PROPERTIES: APPLICATION
API: Terminate a Process (uses EXE name) (32-bit Only)

This global template adds a function that can be used to terminate a process using a given EXE name. The list of processes is loaded into a queue. It requires the GetAPIError() function. There are 2 templates that add GETAPIError(): 1. Get last API Error 2. NT Services Functions added: TPTerminateEXE(STRING) TPGetProcessID(STRING) Procedures added: TPLoadProcessesQueue Some of the code enclosed in this template is from a Public Domain example called "TASKLIST".


apiTrayIcon

TYPE: Extension
PROPERTIES: APPLICATION
API: Windows System Tray Icon Support

This extension template should be removed. For tray icon and windows shutdown support, add the "apiSubclass", “apiTrayPopupMenu ”, and/or “apiWindowsShutdownHandler” template(s) to your application frame or main procedure.


apiTrayPopupMenu

TYPE: Extension
PROPERTIES: PROCEDURE
API: System Tray Icon (Class-Based)

Populate this template on your application frame or main procedure. Do not include a path in the icon file name. Use Tray.ChangeIcon(STRING Icon) to change at runtime (icon must be already included in your project). Use Tray.ChangeTip(STRING Tip) to change at runtime. (In other words, hide window when minimized). Important: Any icons used must be declared on this window (eg. BUTTON,AT(1,1),HIDE,ICON(''icon.ico' (This will also solve the general Clarion 5 problem where icons disappear when a DLL is called.) Tip: Call Tray.Restore() to restore the window. Result is a string variable.


apiWindowsShutdown

TYPE: Extension
PROPERTIES: APPLICATION
API: Close on Windows Shutdown

This extension template should be removed. For tray icon and windows shutdown support, add the "apiSubclass", “apiTrayPopupMenu ”, and/or “apiWindowsShutdownHandler” template(s) to your application frame or main procedure.


apiWindowsShutdownHandler

TYPE: Extension
PROPERTIES: PROCEDURE
API: Handle Shutdown Request from Windows (Class-Based)

Populate this template on your application frame or main procedure. If the users tries to shut down Windows, the current application will be closed automatically. Procedure to call on: Value to return to Windows on: Note: Currently there is no support for replying to Windows with a variable value.


apiAddShFileOpClass

This template adds a class that wraps the Windows API Shell File Operation commands.

The following methods are available:

FileOp.Copy(Source,Target)

FileOp.Move(Source,Target)

FileOp.Rename(Source,Target)

FileOp.Delete(Filename)

FileOp.Recycle(Filename)

A code template is also available.


BrowseAddPopupAction

TYPE: Extension
PROPERTIES: PROCEDURE,MULTI,REQ(BROWSEBOX(ABC))
Browse: Add an Action to a List Box Pop Up


BrowseConditionalCallUpdateProcedure

TYPE: Extension
PROPERTIES: PROCEDURE,MULTI,REQ(BROWSEBOX(ABC))
Browse: Call update procedure on condition

This template will call a different update procedure when a condition is met. Once it has been called, further conditions and/or the normal update procedure may or may not be called, based on the "If...no further checking" option. If the parameters you enter include a "),", the procedure is assumed to be a function, and it's value will be returned from ThisWindow.Run(N,R).


BrowseGlobalCodeAfterOpen

TYPE: Extension
PROPERTIES: APPLICATION
Browse: Globally insert code after open on BrowseBox() procedures

Add this extension globally and all WINDOW templates where a BrowseBox(ABC) template has been populated will contain this code in the After Window Opening EMBED point.


BrowseInvertCheckOnLeftClick

TYPE: Extension
PROPERTIES: PROCEDURE,MULTI,REQ(BROWSEBOX(ABC))
Browse: Invert a Checkmark on Left Mouse Click

This template will allow the user to toggle a boolean variable when they click on a column containing the field.


BrowseReselectListAfterTabChange

TYPE: Extension
PROPERTIES: PROCEDURE
Browse: Reselect List After Tab Change

When the user selects a different tab, the first control after the sheet is selected.  Use this extension to have the list control selected instead. Also available as a global template.


BrowseReselectListAfterTabChangeGlobal

TYPE: Extension
PROPERTIES: APPLICATION
Browse: Reselect List After Tab Change (Global)

When the user selects a different tab, the first control after the sheet is selected.  Use this extension to have the list control selected instead. Also available as a procedure-level extension template.


BrowseSaveFormats

TYPE: Extension
PROPERTIES: PROCEDURE
Browse: Save/Restore Control Formats between sessions

Primarily used for list boxes, but also can be used for dates and other fields. The "Use INI File" global setting must be checked. When you change the list box format in the EXE/DLL and ship a new version to your client, the old user-selected format will remain unless:


ClassDeclare

TYPE: Extension
PROPERTIES: MULTI
Class: Declare an ABC-compliant class


DateRuntimeFormatting

TYPE: Extension
PROPERTIES: APPLICATION
Date: Set Date Field Formats at Runtime

Allow your users to select a report font at run-time.


EmbedDumpToINI

TYPE: Extension
PROPERTIES: APPLICATION
Embed: Generate PUTINI statements in empty embeds

Does not work in C5A and above.


FileBlobReadWrite

TYPE: Extension
PROPERTIES: APPLICATION
File: Transfer between Blob and DOS File (functions)

This global template adds two functions that allow you to write a Blob to or read a Blob from a DOS File.


FileDebugCheckIfOpen

TYPE: Extension
PROPERTIES:
File: Debug - Check file open state at procedure entry and exit

Populate this template at the global level to update an INI file with the status of files when procedures and entered/exited. (Also valid as a procedure extension).


FileUseDescriptionInErrors

TYPE: Extension
PROPERTIES: APPLICATION
File: Use FileDescription in errors

Substitute the description of a file from the dictionary instead of the file name.  Useful if you have cryptic file names, but you don’t want the user to have to know them to understand an error message.


FileSetUseFileUseType

TYPE: Extension

PROPERTIES: PROCEDURE

File:  Set the Use Type for a specific file (override default ABC behaviour)

-	Introduced for version C5B.

-	Adds the Access:FILE.UseFile(UseType:????) statement that sets file usage behaviour in the File Manager.

-	Typically used where a file record is being blanked when returning from a procedure, or where a file needs to be forced open at the start of a procedure.


FormCallfRelies

TYPE: Extension
PROPERTIES: PROCEDURE,REQ(FUNCTIONS)
Form: Call fRelies()

The fRelies() function enables/disables a field depending on another variable being true or false. It also clears the dependent field if the base variable is false. The fReliesRange() function simply enables/disables a range of fields depending on the base variable (true or false). No defaulting or clearing is done

Requires the global functions template.


FormDisableRelatedUsedFields

TYPE: Extension
PROPERTIES: REQ(SAVEBUTTON(ABC))
Form: Disable related field(s) if used in another file

This will disable all fields on this window related to and in use in other files.  This prevents the user from even trying to change a referential integrity field.


FormDisableRelationRestrictedFields

TYPE: Extension
PROPERTIES: REQ(SAVEBUTTON(ABC))
Form: Disable related field(s) if change restricted

This will disable all fields on this window if changing them would result in a "Change Not Allowed" RI message.


FormGlobalCodeAfterOpen

TYPE: Extension
PROPERTIES: APPLICATION
Form: Globally insert code after open on FORM procedures

Add this extension globally and all WINDOW templates where a SaveButton(ABC) template has been populated will contain this code in the After Window Opening EMBED point.


FormGlobalForceAttributes

TYPE: Extension
PROPERTIES: APPLICATION
Form: Globally ensure FORMs have certain attributes

Add this extension globally and all WINDOW templates where a SaveButton(ABC) template has been populated will contain this code in the After Window Opening EMBED point. Leave an option unchecked to use the attribute as defined on the window.


FormNoBrowseInsert

TYPE: Extension
PROPERTIES: PROCEDURE,REQ(SAVEBUTTON(ABC))
Form: Insert (new) without a browse

This extension allows you to use a form to insert a new record without having a calling browse. Usually this is used where you have a NEW option on a main menu or a NEW button.


FormNoBrowseUpdate

TYPE: Extension
PROPERTIES: PROCEDURE,REQ(SAVEBUTTON(ABC))
Form: Update without a browse

This extension allows you to use a form without having a calling browse. Usually this is used where you have a single configuration record The information entered through the FILES button for this procedure will be used to determine the primary file and key.


FormReqMissingDataClass

TYPE: Extension
PROPERTIES:
Form: Ensure required data is entered w/message (Class)

Add this extension globally and all WINDOW templates where a SaveButton(ABC) template has been populated will contain a test to ensure that required data has been entered. This test differs from standard behaviour by presenting the user with a message that tells which field is about to be selected. @PROMPT, @MSG, @TIP, @FIELD are replaced with the appropriate data for the required field.

You can manually add fields by using the AddField method, and you can manually remove fields using the RemoveField method.  These are most commonly used when you have a field that may or may not be required, based on some condition.

Example:  IF This=True THEN ?Field{Prop:Req}=True;ReqFldMgr.AddField(?AnotherField ,etc…) ELSE ?Field{Prop:Req}=False;ReqFldMgr.RemoveField(?AnotherField).


FormStringWrapGlobal

TYPE: Extension
PROPERTIES:
Form: Global Declaration for wrapped strings

Allows you to have display-only memo fields that behave like strings.


FormViewABC

TYPE: Extension
PROPERTIES: REQ(SAVEBUTTON(ABC)),FIRST,PROCEDURE
Form: Support View on Standard Update Form

Use FormViewClassGlobal instead.

All fields will be disabled, except:

- Sheets

- Tabs

- Lookups (use "Enable Controls")

- "Cancel"


FormViewClass

TYPE: Extension
PROPERTIES: REQ(SAVEBUTTON(ABC)),FIRST,PROCEDURE
Form: Support View Mode (Class)

Use FormViewClassGlobal instead.

All fields will be disabled, except:

- Sheets

- Tabs

- Lookups (use "Enable Controls")

- "Cancel"


FormViewClassGlobal

TYPE: Extension
PROPERTIES: APPLICATION
Form: Support View Mode (Global)

When a form (any window with the SaveButton(ABC) template) is called in view mode (see also BrowseViewButtonClass), all appropriate fields (eg. entry fields) will be disabled, the OK button will be hidden, and the Cancel button will be changed into a Close button.


FormViewClassGlobalOverride

TYPE: Extension
PROPERTIES: REQ(FORMVIEWCLASSGLOBAL),PROCEDURE
Form: Support View Mode (Override Global)

If the FormViewClassGlobal template is populated, override it with window specific requirements.


FormWarnDeletionNotAllowed

TYPE: Extension
PROPERTIES: REQ(SAVEBUTTON(ABC)),MULTI
Form: Warn if deletion not allowed

Check for the existence of child records, and it they exist, warn the user that the parent record may not be deleted.


Functions

TYPE: Extension
PROPERTIES: APPLICATION
Values: Standard functions and values (Global)

Adds functions that will do the following:

* Display a calendar, returns a date

* Concatenate two strings with a delimiter

* Test if string 1 ends with string 2

* Display an OCX-based calendar, returns a date

* Enable/disable/default Target if Base is true or false

* Replace a substring within a string

* Split a string at a space

* Convert a "|" delimited string into a queue

* Convert a string for use in an EVALUATE() statement (double up '' (quotes), {{ (braces), <<.

* Display message with an icon depending on the severity level (eg. Level:Fatal).


KeysAlert

TYPE: Extension
PROPERTIES: APPLICATION
Keys: Global Alert

Alert keys at the global level.


KeysDOSEnterKey

TYPE: Extension
PROPERTIES: GLOBAL
Keys: DOS-style Enter key (Enter=Tab)

This template allows your user to move on a form in the same manner as they did in Clarion for DOS – using the ENTER key.

The EnterKey is set as an Alert Key for the window.

Optionally add a global variable as a switch and let the user check or uncheck it.

Template supplied by Jeff Berlinghoff, email: BERLINGHOF_J@epic6.dep.state.fl.us


LibraryAdd

TYPE: Extension
PROPERTIES: APPLICATION,MULTI
Library: Add a 16/32 library to the current project


LookupAutoPress

TYPE: Extension
PROPERTIES:
Lookup: Press related lookup button if alerted key pressed

This template will allow users press a key on an entry field and have the button that follows it pressed as a result.


LookupAutotipFieldLookupButtons

TYPE: Extension
PROPERTIES: APPLICATION
Lookup: Place a "Select" tip on ABC Field Lookup Buttons

Automatically adds a Tip and Message to the lookup button (if there isn''t one already) everywhere that the FieldLookupButton(ABC) template is populated, based on the tip/message of the field that precedes it.


LookupEntryCompletionExt

TYPE: Extension
PROPERTIES: PROCEDURE,MULTI
Lookup: Auto-complete an entry field

This template will allow users to select from a queue or file using an auto-complete entry field. Note: Key must have only one free element. Place appropriate code in the Access:%File.PrimeRecord() method if priming is requried.


LookupEntryCompletionOnAllFieldsWithLook

TYPE: Extension
PROPERTIES: APPLICATION
Lookup: Auto-complete all fields with a defined lookup (Global)

Any entry field controls with a defined lookup/validation will be converted to entry auto-completion fields.

For cases where filters on the lookup file are required, or where you simply wish to use a queue, use the control template and select the queue option.


LookupFieldReportExt

TYPE: Extension
PROPERTIES: REPORT,MULTI,PROCEDURE
Lookup: Put result of lookup in variable

Load variable (Report) This template will maintain a set of related BASE and DESCRIPTION fields: - The description field is filled if the base field is valid, blank if it isn''t.


MiscAfterEntryPointCodeStatement

TYPE: Extension
PROPERTIES: APPLICATION
Misc: Allow code after entry point CODE statement

This is directly after the CODE statement in the first module.


MiscBuildInfo

TYPE: Extension
PROPERTIES: PROCEDURE
Misc: Update and display build information

Update a control with:

- the current build number

- the current build date/timer

Before using, create a file named the same as your application with a .BN extension containing the current build number.

Example:

To begin with, MyApp.BN should contain 1 character - “1”.  With each build, that would increment.


MiscControlDump

TYPE: Extension
PROPERTIES:
Misc: Insert comments re: all control information

A template debugging utility.


MiscDisplayInStatusBar

TYPE: Extension
PROPERTIES: PROCEDURE,LAST,MULTI
Misc: Display value in the status bar **ALPHA**


MiscForceWindowToTopOnOpen

TYPE: Extension
PROPERTIES:
Misc: Force window to top when opened (Windows 98 Kludge)

Not needed for most applications.


MiscGlobalCodeAfterOpen

TYPE: Extension
PROPERTIES: APPLICATION
Misc: Globally insert code after open on selected procedures

Add this extension globally and all WINDOW templates where a selected template has been populated will contain this code in the After Window Opening EMBED point.


MiscGrabCornerLines

TYPE: Extension
PROPERTIES: PROCEDURE
Misc: Create "Grab Corner" Lines

This template will add lines on the lower right-hand corner of a window to simulate the "grab-corner" effect.

NOTE:  Does not work on a frame.

Based on code by Jeff Slarve.


MiscMCI

TYPE: Extension
PROPERTIES: APPLICATION
Miscellaneous MCI functions

This global template adds functions that make calculations related to the MCI API. Primary use: Calculate a CDDB value for a CD.


MiscModuleCode

TYPE: Extension
PROPERTIES: PROCEDURE
Misc: Place data/include/code in the current module


MiscNoCloseOnExit

TYPE: Extension
PROPERTIES: PROCEDURE
Misc: No Close on Exit

This extension will not allow users to exit from your procedure (or application if template placed on frame) unless a specific control is used.


MiscOmitIfCompiling16Bit

TYPE: Extension
PROPERTIES: PROCEDURE
Misc:Omit all code in procedure if 16-bit

Generates an COMPILE(''****'',_width32_) statement Note that you cannot have any other OMIT/COMPILE statements in the code.


MiscOmitIfCompiling32Bit

TYPE: Extension
PROPERTIES: PROCEDURE
Misc: Omit all code in procedure if 32-bit

Generates an OMIT(''****'',_width32_) statement Note that you cannot have any other OMIT/COMPILE statements in the code.


MiscOverrideFileErrorMessage

TYPE: Extension
PROPERTIES: APPLICATION,MULTI
Misc: Override an error message for a file


MiscPaletteManagement

TYPE: Extension
PROPERTIES:
Misc: Set palette to 256 on window with focus, 0 on all others


MiscRuntimeMask

TYPE: Extension
PROPERTIES: APPLICATION,MULTI
Misc: Runtime field masking

This template will change the mask attribute (on all string, entry, and spin controls where a particular mask is found) with a mask contained in a global variable.


MiscSetButtonProperties

TYPE: Extension
PROPERTIES: APPLICATION
Misc: Set Button Properties (Make All Buttons Flat)


PathSmartPath

TYPE: Extension
PROPERTIES: APPLICATION
Path: Smart path at start up

If the specified data file is not found at program start up, the user is asked to provide the path to the data.


PrinterSaveRestore

TYPE: Extension
PROPERTIES:
Printer: Save and restore printer settings


PrinterSupUse

TYPE: Extension
PROPERTIES: PROCEDURE
Printer: **ALPHA** Use printer based on procedure name

The printer device and port is set based on the procedure name. Requires global extension: "Printer: Add UsePrinter procedure (Global)"


PrinterSupUsePrinter

TYPE: Extension
PROPERTIES: APPLICATION
Printer Support: **ALPHA** Add UsePrinter procedure (Global)

The printer device and port is set based on the procedure name and other variables.


ProcessLogout

TYPE: Extension
PROPERTIES: PROCEDURE
Process: Use Logout on a process.


ProcessStream

TYPE: Extension
PROPERTIES: PROCEDURE
Process: Use Stream/Flush on a process.


ReportAssignReportVariables

TYPE: Extension
PROPERTIES:
Report: Assign Report Variables

 This template will automatically assign the date and time to report controls when the report is opened.


ReportFontReplacement

TYPE: Extension
PROPERTIES: APPLICATION
Report: Replace fonts at run-time

Use alternate font on report if a global variable is true. Enter any code you wish to place before the template generated code: Enter any code you wish to place after the template generated code:


ReportFontsAtRunTime

TYPE: Extension
PROPERTIES: PROCEDURE
Report: Set control fonts at run-time

Ask user for font information at run-time. Save to INI file (blank if none): Global On/Off Switch (blank if none):


ReportGlobalDetailCodeAft

TYPE: Extension
PROPERTIES:
Report: Globally insert code after printing detail section (Legacy)

Add this extension globally and all REPORT templates will contain this code.


ReportGlobalDetailCodePre

TYPE: Extension
PROPERTIES:
Report: Globally insert code before printing detail section (Legacy)

Add this extension globally and all REPORT templates will contain this code.


TabColourBold

TYPE: Extension
PROPERTIES:
Tab: Colours and bolding

Populate this template at the global level to change the appearance of all tabbed sheets in your application (Also valid as a procedure extension)


ThreadLimitGlobal

TYPE: Extension
PROPERTIES: APPLICATION
Thread: Only allow browse procedures to be started once, unless called as a Select.

Only allow browse procedures to be active on one thread at a time (except for selection calls). The ThreadLimitGlobalChild template is provided for use on non-browse procedures.

TIP: To adjust for cases where you want to allow a non-select browse to be opened depending on where it was called from, you can OMIT the generated code in ThisWindow.Init and ThisWindow.Kill , and replace it with your own. For example:

IF GlobalRequest <> SelectRecord

  ThreadQ.Proc='ProcedureName' & SomeVariableThatTellsWhereThisProcedureWasCalledFrom  ! ***

  GET(ThreadQ,ThreadQ.Proc)

  IF ERRORCODE()

    ThreadQ.ThreadNo = THREAD()

    ADD(ThreadQ,ThreadQ.Proc)

    ThisThreadActive = THREAD()

  ELSE

    POST(EVENT:GainFocus,,ThreadQ.ThreadNo)

    RETURN Level:Fatal

  END

END


ThreadLimit

TYPE: Extension
PROPERTIES: PROCEDURE
Thread: Only allow a procedure to be started once

Only allow a procedure to be active on one thread at a time (except for selection calls).

If ThreadLimitGlobal is used, use ThreadLimitGlobalChild instead.


ValuesAppGenerationDateTime

TYPE: Extension
PROPERTIES: PROCEDURE
Values: Global variables for application generation date/time

Create global variables containing application generation date/time. Add this extension to the procedure in which you want the variables set.

GLO:ApplicationName

GLO:ApplicationCreationDate

GLO:ApplicationCreationTime

GLO:ApplicationChangeDate

GLO:ApplicationChangeTime

Etc.


ValuesAppNameEquate

TYPE: Extension
PROPERTIES:
Values: Create an equate for the Application Name(s)

The global variable AppName will be equated to the Application Name, and a series of equates will be created for all possible AppNames.  Useful when you have an application that contains code that should be compiled or omitted based on the application name. Example:  You may copy MyApp32 to MyApp16 and MyAppR on a regular basis.  This template would allow you to compile/omit 16-bit code, or code for registered users.


ValuesEquatesForAllFiles

TYPE: Extension
PROPERTIES: APPLICATION
Values: Create numbered equates using file names

Example:

Where there are files names MyFile, MyChild, and MyParent, there would be equates:

eMyFile EQUATE(1)

eMyChild EQUATE(2)

eMyParent EQUATE(3)

I use this to easily set up unique file equates for use with Mike Hanson’s SuperTagging templates.


ValuesGlobalMenu

TYPE: Extension
PROPERTIES: PROCEDURE
Values: Copy frame menu item equates into global variables

Creates global equates for each menu and toolbar control in the current procedure I.E.: GLO:Main:FileMenu would represent ?FileMenu in the procedure "Main".


WindowGlobalCodeAfterOpen

TYPE: Extension
PROPERTIES: APPLICATION
Window: Globally insert code after open

Add this extension globally and all WINDOW templates will contain this code in the After Window Opening EMBED point.


MiscCreateTestData

TYPE: Procedure
PROPERTIES:
Misc: Create Test Data

This is terrible template that fills databases with sample data , but use it if you wish!


EmbedCreateTemplate

TYPE: Utility
PROPERTIES:
Embed: Make a template using code inside embeds

Create a template from the code within a procedure.

Bug:  Multiple #ENDATs may need to be edited out.


EmbedRefreshABC

TYPE: Utility
PROPERTIES:
Embed: Refresh ABC Classes


EmbedTemplate

TYPE: Utility
PROPERTIES: WIZARD
Embed: Add/remove templates

NOTE: Make a backup. This wizard will only work on simple templates. Some editing may be required.


Create Procedure Tree
UtilityProcCallTree

TYPE: Utility

PROPERTIES:

Utility:  Create text file containing procedure calls

Creates an ASCII file named %Application.TRE that contains a “tree” of procedures and calls within the application.


ClassObjectExporter

TYPE:  Extension

PROPERTIES:  Application

Class: Object Exporter

Export selected objects from this DLL.

From topspeed.topic.language, thread: "I want to declare a class within a DLL and then export them", Template from: dberton@lawaudit.com (Dave Berton)


ReportVerticalWizard

TYPE: Utility
PROPERTIES: WIZARD
Report: Create a "Vertical" Report Procedure (ABC)

Similar to the Report procedure wizard in ABC, except creates the data vertically instead of horizontally.


Wrappers for Catalyst SocketTools

-	There is an ABC-compliant class that wraps around the Catalyst Library Edition FTP DLL.  TESTFTP.APP is the example for using this.

-	The Princen-IT OLE Generator has been used to generate classes to wrap around the Catalyst Visual Edition OCXs, and I’ve modified these a small amount. TESTDNS.APP is the example for using this.


Modified Clarion Components

By request, I have included modified standard CW Components, such as ABUPDATE.TPW (added a missing legacy embed point), and ABRESIZE.CLW (changed behaviour for maximized windows), and C5CONV.EXE (compiled the source code in CONVSRC so that it was up to date).

These have been placed in "modify" subdirectories below the directories where they are normally found.  You have the option to move and use them, if you wish.


License

License

Templates - Free for use by Clarion developers (distribute with permission)

Tools - Free for use by Clarion developers only (do not distribute)

Examples - Free for use by Clarion developers only (please do not distribute the Application Explorer example)

Disclaimer

Contents are distributed on an as is basis.  The author may

not be held responsible for undesirable results or misuse.


Conversion from the WinAPI Toolkit

A conversion rules DLL has been included for users of the "Free WinAPI Toolkit". Please note that some templates are no longer supported, and that the Enumerate Windows and Enumerate Child Windows templates have been combined. Ensure that you have a backup before converting. Some manual changes may be required.


Report Converter

The Report Converter grew out of my frustration with the IDE.  I ran into all kinds of problems - grid points weren’t used when they should have bee, you couldn’t lassoo multiple controls, and when I would highlight a control to modify some properties, and it would move slightly! With the latest release, some of the problems have been rectified, and some haven’t.

The report converter allows you to:

-	Import/convert Clarion for DOS 2.1 formatted reports

-	Align Clarion for Windows reports to a grid

Some default settings have been provided, but you may wish to experiment with the settings to match the font you wish to use.


Clipboard Sorter

Sorts the contents of the clipboard.  If AT() attributes exist, the contents are sorted by these, otherwise they are sorted alphabetically.


Examples

Examples are provided in the C:\CLARION5\EXAMPLES\VSFREE directory for several of the templates.

Appexpl5.app - An interactive testing tool that uses the send keys and enumerate windows templates

hotkeys.app - Demonstrates using the system-wide hot keys template

Read_ie5.app - Get a list of MS Internet Explorer shortcuts from the registry

reslines.clw - Jeff Slarve's original code that the "Grab Corners" class is based upon

testdns.app - Uses the Catalyst Visual Edition DNS wrapper classes

Testenu5.app - Enumerate windows

testftp.app - Uses the Catalyst Library Edition FTP wrapper classes

testftp.dct - Dictionary for above

TSEND.CLW - Simple test of send keys class

tsend.prj - Project for above

winstate.app - Command line (console) app - Hide/unhide a window by name


Installation

Note:  The latest released “gold” version of Clarion is required for these templates.

Before installing, ensure Clarion is not running.  If it was running during installation, close and re-start it before attempting to use this template set.

After the files have been installed, register VSABCTPL.TPL.

Please report any errors or problems you encounter.