![]() |
|||
| Version
www.capesoft.com Updated Thursday 28 July 2011 |
|
||
Introduction
Installation
JumpStart
Example
Programmer's
Guide
FAQ
Support
Purchasing AnyFont
Distribution
Relationship
with other 3rdParty products
The Global AnyFont Extension
Global General Tab
Global
Multi-DLL Tab
Global
Default Font Tab
Global
Save & Load Tab
The
Local AnyFont Extension
Local
General Tab
Local
Classes Tab
Class
Method Reference
Class
Properties and Global Variable Reference
Properties
Global Variables
Version
History
License
& Copyright
![]()
| Introduction | |||
|
|
CapeSoft AnyFont extension allows you to change different
properties of your application font at run-time. Settings can be saved using an .INI file or the
registry. |
||
Run the supplied installation file. CapeSoft AnyFont adheres to the standards laid out by by the C3PA (Clarion 3rd Party Association) for 3rd party Accessory installation:
Template (anyfont.tpl and anyfont1.tpw) - Clarion\3rdparty\template\
Source code(anyfont.clw and anyfont.inc) - Clarion\3rdparty\libsrc\
Examples - Clarion\3rdParty\Examples\AnyFont\
![]()

This jumpstart shows you how to add font resizing to your application.
You won't even have to type a single line of code.
Adding AnyFont to your Application.
To add the AnyFont template to your program, do the following:
This will add the global extension to you application. It will also add local
extensions to each of your windows.
NOTE: For Multi-DLL applications, you will need to do this in
each DLL (and EXE) that has windows. See the Global
Multi-DLL Tab on the Globalextension template for settings pertaining to
Multi-DLL applications.
Changing your Application's Default Font
This can be done in the Global Default Font tab.
(For Multi-DLL apps, this is done in the EXE)
Adding the Embedded Code to Change the Font.
This is normally done via a menu command using the FontDialog procedure. To make your life easier, embedded
code has already been written for you.
Your application is now ready for use!
There is an example in your \Clarion\3rdParty\Examples\AnyFont\Demo directory. The example shows a simple application that allows storage of names and addresses. An example screen is shown below.
Writing Code for AnyFont
Normally, the only code you will have to add is the FontDialog embed point.
This is called "AnyFontDialog - Call FontDialog to set Font
parameters". The Jump
Start guide shows how to add this embed point.
If you want to be more adventurous and not use the font dialog, the AnyFont global variables are just what you need. To change the font parameters, follow these steps.
Setting the font manually, along with window-resizing templates
If you set the font using the AnyFont dialog box, no extra code needs to
be written. However, if you change the font size manually you will have to insert
some code if you are using a window-resizing template.
NOTE: In all the following examples, the parameters shown by (...) must be supplied as specified in this document.
Listbox Style Behaviours for Different Clarion Versions
Certain versions of Clarion do not read listbox styles correctly. These are
Clarion 5.5 up to Clarion 6.1, RC5.
I get a template Assert requiring me to modify my existing legacy templates. What must I do?
I lost my settings after upgrading AnyFont.
1. Why don't all my open windows' fonts update immediately?
2. Why don't my listbox styles update correctly?
3. When I change the font properties, why does moving and resizing of the
controls not work properly?
4. When I increase the font size so that the window is too large for the
screen, some controls disappear when I decrease the font size. How do I
fix this?
5. AnyFont doesn't remember my window's position correctly.
6. The controls on my MDI child window don't resize.
7. How do I disable AnyFont dynamically?
8. My windows flicker a lot when I open/resize them.
9. I'm using C55 and when I change the Font color, my XP theme
gets lost on my buttons.
10. I get a template Assert requiring me to modify my existing legacy templates.
What must I do?
11. How do I restrict my users to select a certain range of font settings?
12. My decimal fields are not correctly justified when using a larger font.
1. Why don't all my open windows' fonts update immediately?
Answer: All windows, except the window in which the font was changed, will display their new font only when they are newly opened. To update all the windows' fonts, close the application and re-open it.
2. Why don't my listbox styles update correctly?
Answer: You are probably using Clarion 5.5 or 6.0. These versions of Clarion do not read the proplist styles correctly.
3. When I change the font properties, why does moving and resizing of the controls not work properly?
Answer: You're probably using a move-and-resize template that isn't supported yet. At the moment the resizers that AnyFont supports are the standard WindowResize template and IngaSoft's EasyResizeAndSplit v2.07. However, support for more resizers is on the way. In the meantime, there are a few ways to fix this.
4. When I increase the font size so that the window is too large for the screen, some controls disappear when I decrease the font size. How do I fix this?
When the window becomes too large for the screen, the size of the window (in Clarion units) decreases even though the actual size, in pixels, increases. Here are two ways to fix this.
5. AnyFont doesn't remember my window's position correctly.
This may be caused by other code that executes after AnyFont.SetWindow has been called, such as the INI manager or a resizer template. To find out if AnyFont is the culprit, insert the following lines after the call to SetWindow:
display()
stop('SetWindow
called')
If the window displays in the wrong place, then AnyFont is indeed causing the problem. Please call support if this the case.
6. The controls on my MDI child window don't resize.
This is probably caused by setting the font directly in the child window. The correct way of setting the font in an MDI application is to do it in the MDI menu.
7. How do I disable AnyFont dynamically?
To disable AnyFont globally, set the global variable AnyFont:Disable to true. To disable AnyFont in a single window, set the ThisAnyFont.AFdisable variable to true, or call ThisAnyFont.Disable().
8. My windows flicker a lot when I open/resize them.
Answer 1: To use the buffer attribute in a window, you can turn on prop:buffer (in the window.init method after opening the window).
0{prop:Buffer} = 1
This does adversely affect some 3rdparty tools - so this may not be an option in all situations.
Answer 2: There's a problem in one of the ABC methods. For a workaround:
DISPLAY(Toolbar:First,Toolbar:Last)
!DISPLAY(Toolbar:First,Toolbar:Last)
9. I'm using C55 and when I change the Font color, my XP theme gets lost on my buttons.
Answer:C55 does not support Font colorisation and XP theme. If you change the font color manually (in a non-AnyFont app) you will see the effect. The only solution is to upgrade to Clarion6.
10. I get a template Assert requiring me to modify my existing legacy templates. What must I do?
You need to add an extra embed point into the Standard.tpw file (which is located in your Clarionx\template directory).
Open the file in a text editor, and search for the following text:
#IF(%Window)
CLOSE(%Window)
#ELSE
Immediately before these lines, insert a new line with the following code (which you can copy and paste from this document):
#EMBED(%BeforeWindowClosingAfterSaveINI,'Before Closing the Window - After Saving INI')
So your modified template should look as follows:
#IF(%INIActive AND %INISaveWindow)
INISaveWindow('%Procedure','%INIFileName') !or
INISaveWindow('%Procedure',%(%StripPling(%INIFileName))) for later versions.
#ENDIF
#EMBED(%BeforeWindowClosingAfterSaveINI,'Before Closing
the Window - After Saving INI')
#IF(%Window)
CLOSE(%Window)
#ELSE
Close your application and re-open it (you may need to re-register your Clarion templates if your IDE is not set to re-register templates on update), then recompile and run it.
11. How do I restrict my users to select a certain range of font settings?
Answer: You can quite easily reject the
settings if the font settings fall outside the parameters that you require.
You'll need to handcode before the template generated code (in the Validate User
Font Selection embed):
if ValidateFontSettings() = false !This is a
function you create to return whether the font settings are valid or not
message('Warn user he has selected the incorrect font settings')
cycle
end
ThisAnyFont.SetWindow(AnyFont:FontName,AnyFont:FontSize,AnyFont:FontColor,AnyFont:FontStyle,AnyFont:FontCharset,0)
!Template generated code
12. My decimal fields are not correctly justified when using a larger font.
Answer: You will need to Right-justify decimal settings as the RTL does not position a font adjustment decimal justification after the control is created.
I lost my settings after upgrading AnyFont.
Vista (operating under UAC) does not allow programs to write to the Local Machine section of the registry settings. In version 1.51, AnyFont now supports storing the AnyFont settings in the Current User section of the registry by default. you can revert back to using the Local Machine section of the registry (a setting in the Global Save & Load Tab), which will maintain your current settings, but will make your program Vista unfriendly.
![]()
| CapeSoft Support | |||
| Support Page | Find support page with various options here | ||
|
|
|||
| Telephone | +27 21 715 4000 | ||
| Fax | +27 21 715 2535 | ||
| Snail Mail | PO Box 511, Plumstead, 7801, South Africa | ||
| Buy Online | |||
|
Purchase CapeSoft AnyFont from: |
|||
| CapeSoft Sales | |||
| Web | www.capesoft.com | ||
|
|
|||
| Telephone | +27 21 715 4000 | ||
| Fax | +27 21 715 2535 | ||
| Snail Mail | PO Box 511, Plumstead, 7801, South Africa | ||
See the Jump Start for information on how to add the Global Extension. The global extension allows you to set the default font for your application, as well as allowing you to save your font settings in a .INI file.
Global General Tab
Global Default Font Tab
Global Multi-DLL Tab
Global Save & Load Tab
| Global General Tab | |||
![]() |
Disable All AnyFont features |
||
This allows you to control how AnyFont will behave for each window in your application.
NOTE: If the extension is in a report or source template, then AnyFont will be automatically disabled.
Local General Tab
Local Classes Tab
Local Tab (disabled)
| Local General Tab | |||
![]() |
Disable AnyFont in this Procedure Disable Moving and Sizing of Controls Override
Individual Control Behaviour |
||
| Local Control Options Tab | |||
|
Window Control: Disable Resize Disable Font Change |
||
| Local Classes Tab | |||
|
Object: |
||
| Local Tab (disabled) | |||
|
This local extension is shown when the local template is a Report or a Source template. |
||
![]()
Most of the time your PowerToolbar will reside on the frame of your application together with your AnyFont code templates. The best solution is to partially disable AnyFont locally on the Frame. You do this by going to the AnyFont Local Extension prompts on the frame and checking the Disable AnyFont in this Procedure checkbox. You can leave the Disable Change Font dialog code and/or the Disable AnyFont Disable code checkboxes unchecked here to still use this functionality for your application.
![]()
SetWindow
SetControlFont
SetControlTypeFont
Disable
Enable
SetWindow (<string p_FontName>, long p_FontSize= -1, long p_Fontcolor= -1, long p_FontStyle= -1, long p_FontCharset= -1, byte p_NoMoveSize=0)
Sets the font of the current window.
Parameters:
p_FontName: Name of the new font required. This can either be a variable
name or a literal font name, e.g. 'Arial'.
p_FontSize: Size of the new font.
p_Fontcolor: The new font's colour.
p_FontStyle: The style of the new font (bold, italic, etc.)
p_FontCharset: The character set of the new font. The character set values are listed in the global template in the Default Font tab.
p_NoMoveSize: Set to 1 if the window controls are not to be moved or sized.
Return value: none.
Example:
If the font is to be set for the entire application, do this (AnyFont does
this automatically). Moving and sizing is enabled in this example.
Anyfont:Fontname =
'Tahoma'
Anyfont:Fontsize = 8
Anyfont:Fontcolor =
color:red
Anyfont:Fontstyle =
style:bold
Anyfont:FontCharset =
charset:ansi
thisAnyFont.SetWindow (Anyfont:Fontname,
Anyfont:Fontsize,
Anyfont:Fontcolor,
|
Anyfont:Fontstyle,
Anyfont:FontCharset,
false)
The font can be set for only one window, in which case don't use the global variables in the font setting. Here is an example, with moving and sizing disabled:
thisAnyFont.SetWindow ('Tahoma', 8, color:red, style:bold, charset:ansi, true)
![]()
SetControlFont (long p_Ctrl, <string p_FontName>, long p_FontSize= -1, long p_Fontcolor= -1, long p_FontStyle= -1, long p_FontCharset= -1)
Sets the font of the selected window control. If this control is the window, then resizing also takes place.
Parameters:
p_Ctrl: Handle of the control whose font is to be changed.
p_FontName: Name of the new font required. This can either be a variable name or a literal font name, e.g. 'Arial'.
p_FontSize: Size of the new font.
p_Fontcolor: The new font's colour.
p_FontStyle: The style of the new font (bold, italic, etc.)
p_FontCharset: The character set of the new font. The character set values are listed in the global template in the Default Font tab.
Return value: none.
Example:
thisAnyFont.SetControlFont
(?Listbox,
'Tahoma',
8, color:red,
style:bold,
|
charset:ansi)
![]()
SetControlTypeFont (long p_CtrlType, <string p_FontName>, long p_FontSize= -1, long p_Fontcolor= -1, long p_FontStyle= -1, long p_FontCharset= -1)
Sets the font of all the window controls of the specified type. For example, use this method if you want to change all your entry fields' fonts.
Parameters:
p_CtrlType: Type of control whose font is to be changed. A list of
all control types can be found in EQUATES.CLW.
p_FontName: Name of the new font required. This can either be a variable name or a literal font name, e.g. 'Arial'.
p_FontSize: Size of the new font.
p_Fontcolor: The new font's colour.
p_FontStyle: The style of the new font (bold, italic, etc.)
p_FontCharset: The character set of the new font. The character set values are listed in the global template in the Default Font tab.
Return value: none.
Example:
thisAnyFont.SetControlTypeFont
(create:button,
'MS Sans Serif',
8, color:red,
|
style:bold,
charset:ansi)
![]()
Allows dynamic disabling of AnyFont. Sets the AnyFont property AFDisable to true. This must be called before the call to ThisAnyFont.SetWindow().
Parameters: none.
Return value: none.
Example:
thisAnyFont.Disable()
![]()
Enables AnyFont after Disable() has been called. Sets the AnyFont property AFDisable to false. This is its default value.
Parameters: none.
Return value: none.
Example:
thisAnyFont.Enable()
OldFont
NewFont
RegistryFolder
AFdisable
The font attributes used by the program on startup. The initial values of the group are taken from the global variables.
The FontParams group is defined as follows. The elements of the group are self-explanatory.
FontParams
group
Name
string
Size
long
Color
long
Style
long
Charset
long
end
The new font attributes changed by the user.
This variable contains the folder in the registry where the AnyFont settings will be kept. The folder will be in the HKEY_LOCAL_MACHINE\Software folder.
This is the variable changed by the methods AnyFont.Disable() and AnyFont.Enable(). It is used to disable AnyFont in a single window and is normally set to false. To disable AnyFont, set this variable to true just before the initial call to ThisAnyFont.SetWindow().
AnyFont:Fontname
string(31)
AnyFont:FontSize
long(-1)
AnyFont:FontColor
long(-1)
AnyFont:FontStyle
long(-1)
AnyFont:FontCharset
long(-1)
These are used to store the current application font and correspond to the variables in the FontParams group. They can be set before the AnyFont.Init procedure is called in order to determine the default application font.
AnyFont:Disable bool(false)
This is used to disable AnyFont globally at runtime and is normally set to false. To disable AnyFont, set this global variable to true. This can be done anywhere in your code. Disabling AnyFont causes all windows to revert to the default system font. If they are already open, no change will occur. See FAQ 1.
Using the embed described below will help you when you want the user to be able to change the value of AnyFont:Disable.
Changing the value of AnyFont:Disable does not affect the value of the local AnyFont.AFdisable properties.
![]()
Call FontDialog to set Font Parameters
Save the AnyFont global Disable Variable
Call FontDialog to set Font Parameters
Insert this embed in order to change the application's font. It opens the font dialog window and saves the results to the place you have chosen in the global extension (.INI file or registry).
Save the AnyFont Global Disable Variable
Insert this embed where you want to change the state of the AnyFont global disable variable, for example in a menu item. It toggles the value of AnyFont:Disable and saves the value to the place you have chosen in the global extension (.INI file or registry).
This embed also allows you to insert code to change any text in the control used. For example, if you have used a menu item labeled 'Disable AnyFont', you can change the text to 'Enable AnyFont' inside the embed when AnyFont is disabled.
![]()
![]()