How do I add an image control to
an application
How do I add an image control to a hand coded
project
When Linking I receive the error message: "Link
error: Unsupported record type21"
I receive Windows error 14001 when executing my program
How do I add an image control to an application:
First you must add the global extension template labeled Activate_ClarionFreeImage to
your application. This extension includes the class files and set the
project defines for link and DLL mode. To do this follow these steps:
- Open the application's Global Properties dialog by
selecting Application from the main menu and then choose
Global Properties... from the pop up menu.
- Click the Extensions button and the Extension
and Control Templates dialog is displayed.
- Click the Insert button on the Extension and
Control Templates dialog.
- Select the Activate_ClarionFreeImage from the Select
Extension dialog's list.
- Click the Select button on the Select
Extension dialog and the extention is added to the list of extensions
for this application.
If you intend to use the built in image dialogs (like Brightness and
Contrast, Gamma correction, Rescaling...) you must check the Include
Dialog support box. If you attempt to use one of the built in
dialogs without checking this box, the compiler will inform you need
to check this box.
Next, go to the window where you want to display an image and add
the Clarion FreeImage Control template. To do this follow these steps:
- Select Populate from the main menu and then select Control
Templates... from the popup or select the Control
Template icon on the Control toolbox.
- Select the ClarionFreeImageControl from the Select
Control Template dialog.
- Click the Select button.
- Draw the control on your window.
This places a region control on your
window with a default label of ?ImageCtrl.
The region is replaced with the image control at runtime. However, you
can still refer to the region control's in your code to do things like
move or hide it with Clarion property syntax.
You can now access the properties of the Clarion FreeImage control on
the Actions tab of the region's properties.
Top
How to add an image control to a hand coded project:
When you want to include the Clarion FreeImage control in a hand coded
project you'll need to follow these steps:
- Add the link library file FreeImage.lib to the Library,
Object, and Resource files node of the project tree. This
link libary is used to resolve the references in FreeImage.DLL. If
you forget this step, you will receive many "...unresolved..." link
errors.
- Add the Link and DLL mode defines to your project's Global
Options, Defines tab. These are used in the class headers.
Failure to set these project defines will result in a GPF as soon as
one of the class constructors fires at startup.
_FreeImageLinkMode_=>1
_FreeImageDLLMode_=>0
_SALinkMode_=>1
_SADLLMode_=>0
- Include the class header files globally. It's very important that you
do not include this in a procedure as it will lead to GPF's and general
instability.
Include('cfiImgCt.inc'),Once
- To use the built in image dialogs, include it's header globally. This
should be with the header file defined in step 3.
Include('cfiDlgs.inc'),Once
- Place a region control on your window where you want the image control
displayed. For this example assume it's label is "?ImageCtrl".
- Instantiate the Clarion FreeImage control class like this:
theImage cfiImageControl
- When using the image control dialogs, instantiate a dialog class like
this:
cfiDialogs cfiDialogsClass
- After the window opens you must initialize the image control by calling
the iImageControl interface Init method with the label of the region
control that's holding it's place on the window and the border and scroll
bar options.
Open(Window)
If theImage.iImageControl.Init(?ImageControl,
CFIBS_SUNKEN, CFISB_BOTH) = False
Message('Unable to initialize the
image control', |
'Clarion FreeImage project example',Icon:Exclamation)
Return
End
- Initialize the image control dialogs, when used, by passing the dialog
class an iImageControl interface and an iImage interface from the Clarion
FreeImage class that you are associating the dialog class with:
cfiDialogs.Init(theImage.iImageControl, theImage.iImage)
- Call the iImage interface Load method to load an image into the control.
If theImage.iImage.Load(sFileName) = False
Return !Unable to load the image
End
- Call the iImageControl interface Reset method to display the image.
theImage.iImageControl.Reset()
Top
When Linking I receive the error message: "Link
error: Unsupported record type21"
This means that you have copied the the freeimage.lib file supplied with
the FreeImage.Dll. This link library is in a format that Clarion does not
recognize. You can either reinstall Clarion FreeImage or run the Clarion
utility LibMaker.exe on the FreeImage.Dll and create a new freeimage.lib.
Top
I receive Windows error 14001 when executing my program
This error is caused by a corrupt application manifest that includes Windows Vista information. Clarion 6.3 build 9058 has an
error in the shipping manifest template. A replacement was posted by Softvelocity and you
may download a copy of the VistaManifest.tpw here.
Simply copy the file to your %ClarionRoot%\TEMPLATE folder and recompile your application.
Top
|