Vote for this Product at ClarionShop  
Buy now at ClarionShop
Version

www.capesoft.com
c3pa approved
     
   

feEditor - HTML Editor

   
Contents
       
The feEditor Object
  Introduction
  Distribution
 

Methods

  New Methods
Documentation for the old (Deprecated) feHtmlEditor class
   
The Templates
 

Overview
 

Useful References
 

Summary of callback events

Using the HTML editor in Windows Vista

 
     


File Explorer Classes - feEditor

The feEditor class is new in FileExplorer 5 and replaces the (now deprecated) feHtmlEditor class. As much as possible this class maintains backwards compatibility with the existing class, so all the old methods should continue to work. In the Beta version of FileExplorer 5 not all backward compatibility is complete, so a number of the old method may have issues. If you find a method that is not working as expected please report it to us.

The documentation for the old feHtmlEditor class is still available.

Important: When the editor Init() method is called the control is loaded followed by the actual editor. The Init() method is asynchronous, so it completes and returns control to your application while the editor is being initialised in the background. Any calls to the methods while the editor is still loading will be ignored.

Once the initialisation is complete and the editor is loaded and ready to use the EditorReady() method is called. You can embed your code in this method that needs to execute as soon as the editor is ready to be used. The .editorReady property of the object is also set to 1, and you can call the IsReady() method to check whether the editor has is ready to be used at any time.


Distribution

Important: The new editor requires that you ship the following files with your application (place these in the application or Data directory for your application). All of these files are shipped in the example folders: Clarion\3rdparty\examples\FileExplorer\Demo

 

feEditor - Methods

Quick Reference
 
Method Description Beta Notes
Edit The Edit command, allows Copy, Paste, Cut etc. to be performed Not fully backward compatible
GetHtmlGraphicsInfo Retrieves the list of images used in the document (use EmbedImages instead of this method). Supported, and enhanced by the new EmbedImagesmethod
GetInfo Retreives properties of the document and control Supported, some properties may be deprecated or unsupported
HideControl Hides the control  
Init Intialises the object and control  
InsertHtml Inserts HTML into the control Supported
InsertTable Inserts a table into the HTML In progress
InsertText Inserts text into the control Needs testing
KeyPressed Detects a key press Not tested
Kill Cleans up and destroys the control  
Load Loads a document  
NewDocument Creates a new (blank document) In progress (can be done simply by blanking the HTML)
PrintMe Prints the document Needs testing and possibly additional support
Reload Reloads the document  
Save Saves the document  
SetFocus Sets the focus to the control In progress, this is vastly improved in the new version
Settings Allowed the background color to be set in the old editor, provides access to all document properties in the new editor. In progress
UnhideControl Unhides the control and refreshes the display  
Update Updates the properties of the document and control. The new editor will provide methods for doing this directly for each property. Supported, some properties still need to be added.
     
     
New Methods    
Debugging Enables or disabled debug logging and error messages displayed  
Log Outputs a string to the debug log  
ErrorTrap Called class methods to indicate an error or warning  
GetHtml Returns the HTML of the edited page  
GetPageTitle Returns the title of the edited page Not implemented
EmbedImages Embeds the images and returns a string containing a comma seperate list. Replaces and enhances the GetHtmlGraphicsInfo method  
Load Loads document  
Revert Reverts the document to the version of disk  
SetHtml Sets the HTML content of the current document  
SetPageTitle Sets the title of the page Not Implemented
IsReady Returns whether the editor is fully loaded and ready to be used  
SetFileName Sets the filename used by the editor, typically not called manually.  
SetSkin Sets the skin for the editor, must be called from BeforeEditorLoad. Cannot be done once the editor has loaded.  
CollapseToolbar Collapses the editor toolbar  
ExpandToolbar Expands the editor toolbar  
EditorReady Called by the object to indicate that the editor has loaded and is ready to be used  
BeforeEditorInit Called when the control and editor have both loaded, but before the editor is initialised.  
BeforeEditorLoad Called when the control has loaded,but before the editor has loaded.
     
 
     

 

New Methods of the feEditor class

Debugging (long debug)

Enables or disables debug logging and the display of scripting error or warning messages by the IE control. The debug output and whether the the control displays messages can also be set independantly by setting the .debugging property of the feEditor directly, and by calling Update() to change the SilentMode of the control itself. See the example below.

Parameters

long debug

A value of 1 to enable debug logging by the class, and to allow IE to display scripting (and other) errors and warnings. A value of zero disables debug logging and sets IE to silent mode to ensure it does not display prompts.

Return Values

None

Examples

! Enable debugging and the display of error or warning messages by the underlying control.
htmlEditor.Debugging(
true)

! Turn off the display of errors and warnings, but still
! allow debug output to be sent to the system debug log.

htmlEditor.
Update('SilentMode', true)  

! Enabled or disable debugging without affecting whether the control displays messages
htmlEditor.debugging = false

Remarks

Regardless of whether debug logging is enabled or not, ther ErrorTrap method will still be called with any errors or warnings, allowing them to be handled, although the output will not be sent to the system debug log when this occurs.

In order to view the debug output a tool such as DebugView is needed. DebugView is available free from Microsoft - www.sysinternals.com.

 

 

Log (string info)

Outputs a string to the system debug log. In order to view the debug output a tool such as DebugView is needed. DebugView is available free from Microsoft - www.sysinternals.com. Output will only be displayed if the .debugging property of the object is set to 1.

Parameters

string info

The string to output to the system debug log. There is no limit on the length of this string. In order to identify the output as coming from your application, and to allow the output to be highlighted and filtered it is strongly recommended that you prepend an identifier to your string that identifies it as having come from your application (see the remarks section below).

Return Values

None

Examples

htmlEditor.debugging = false
htmlEditor.Log('
[FE] feEditor.Load(): Error the file name specified did not exist.')

Remarks

In order to identify the output as coming from your application, and to allow the output to be highlighted and filtered it is strongly recommended that you prepend an identifier to your string that identifies it as having come from your application. For example all FileExplorer output begins with '[FE] '. This makes it simple to identify the output, and also to filter it out if needed. It is also recommended that you provide the ability to enable and disable output at runtime, as the debug log is shared by all applications on the machine and applications that use the bebug log indiscriminately as if it is their own private log can be quite inconvenient, especially if the strings being output have no identifier to allow them to be easily filtered out.

 

 

 

ErrorTrap (string methodName, string errorMessage)

Called be the methods of the class when an error occurs. This allows errors to be trapped and handled within your code. If the .debugging property of the object is set to 1 to enable debug output then this method will also log the message to the system debug log. See the Log() method for more information.

Parameters

string methodName

A string containing the name of the method that the error occured in

string errorMessage

A string containing the actual error message. FileExplorer uses the convention that the string beings with 'Warning:' for warning messages and 'Error' for error messages, which make it easy to identify the severity of the error.

Return Values

None

Examples

feEditor.ErrorTrap Procedure(string methodName, string errorMessage)
  code 

    if Instring('Error:', errorMessage, 1, 1) 
       
Message('An error occured in ' & Clip(methodName) & ': ' & Clip(errorMessage))
   
end

    parent.ErrorTrap(methodName, errorMessage)   

Remarks

 

 

 

GetHtml (*string htmlSource), long

Returns the actual HTML source of the document being edited. If the passed string is not large enough then the HTML is trucated to fit the string and the method returns the size required to store the entire document.

Parameters

*string htmlSource

A string that will be populated the the HTML source for the current document.

Return Values

Returns 0 for success. If the passed string is not large enough then the HTML is trucated to fit the string and the method returns the size required to store the entire document.

Examples

htmlSource         &string
reqSize            long
 
code

! Example 1: This example loads a file and dynamically allocates a string to store
! the HTML source for the document. If the string allocated was not large enough
! It is diposed and allocated again with the size required.

HtmlEditor.Load(fileName)

htmlSource &=
new string(4096)
reqSize = HtmlEditor.GetHtml(htmlSource)
if reqSize > 0
   
Dispose(htmlSource)
    htmlSource &=
new string(reqSize)
    HtmlEditor.GetHtml(htmlSource)
end
Dispose
(htmlSource)                        ! Dispose the string when done

 

! Example2: This code stores the editor contents in a BLOB field in a table and
! then disposes the string that was created


htmlLen = HtmlEditor.GetHtml(htmlSource)  
! Assumes htmlSource has been allocated at this point
if htmlLen > 0                             ! The string needs to be larger to hold the source
   
Dispose(htmlSource)
    htmlSource &=
new string(htmlLen)
    HtmlEditor.GetHtml(htmlSource)
end

MyFile.HtmlBlob{
prop:size} = 0             ! Clear the BLOB field
htmlLen =
Len(Clip(htmlSource))
MyFile.HtmlBlob[0 : htmlLen-1] = htmlSource[1 : htmlLen]
Access:MyFile.
Update()
Dispose(htmlString)

 

 

GetPageTitle (), string, virtual

Not supported in the current release. Returns the title of the loaded document.

Parameters

None

Return Values

None

Examples

pageTitle = HtmlEditor.GetTitle()

 

 

EmbedImages (long embedImages=1), string

This method is used to return a string containing a comma seperated list of all images used in the document, and also to optionally change the source for each image to use the format for embedding the image when sending the HTML in an email. Note that if embedImages is set to 1 this modies the actual HTML source of the document.

For example when using NetTalk the HTML file can be send with all images simply by calling EmbedImages and assigning the returned string to the embedList property of the the NetEmailSend object (see the example below).

Parameters

long embedImages=1

Determines where the images will be embedded (the default behaviour) or whether to just return the string containing the comma seperated list of images used. If this is set to 1 then each image source is changed to the format required for embedding. This allows the image list to be retrieved and the image sources to be changed to use the 'cid:' format required for embedding in a single step. Setting this to 0 will return the image

Return Values

 

Examples

EmailSender.embedList = HtmlEditor.EmbedImages()    ! Embed the images and create the embed list
HtmlEditor.GetHtml(htmlData)                       
! Get the HTML to send

! The code below sends the message using CapeSoft NetTalk
EmailSender.SetRequiredMessageSize(Len(Clip(textData)), Len(Clip(htmlData)), 0)
if not EmailSender.error
    EmailSender.messageText = textData
    EmailSender.messageHtml = htmlData
    EmailSender.SendMail(NET:EMailMadeFromPartsMode)
end

 

 

Load (), long
Load (string fileName), long

Loads a document. If no parameter is passed then a FileDialog is displays to allow the user to select the document to load.

Parameters

string fileName

An optional parameter indicating the file name to load (including the path). If no parameter is passed then a FileDialog is displays to allow the user to select the document to load.

Return Values

Returns 1 for sucess and zero to indicate failure. If an error occurs then the ErrorTrap() method is called with the error message.

Examples

if fileName = ''
    HtmlEditor.Load()
else
    HtmlEditor.Load(fileName)
end

 

 

Revert (long promptUser=0)

Reverts to the previous version of the document (whatever is currently on disk). Any unsaved changeds are lost.

Parameters

long promptUser=0

Determines whether or not the user is prompted before the document is reverted to the last saved version. If this is set to 1 then the user is prompted, and the user can then cancel the process and choose to not allow the document to be reverted.

Return Values

None

Examples

HtmlEditor.Revert(true)      ! Revert but prompt the user to make sure that they are aware that changes will be lost.

 

 

SetHtml (*string htmlSource)

Sets the HTML of the document to the passes string. The string should contain a valid HTML document (although if the it only contains HTML code the required html, head and body tags will be created). This can be used in conjunction with GetHtml() to retreive the HTML source, modify it, and then update the control. It can also be used to load the control directly from memory rather than from disk. See the example below for loading the editor from a BLOB field.

Parameters

*string htmlSource

A string containing the HTML to load into the control. The string should contain a valid HTML document (although if the it only contains HTML code the required html, head and body tags will be created)

Return Values

None

Examples

! This example
! Load the data from a BLOB field into the editor

htmlLen = MyFile.HtmlBlob{prop:size}
if htmlLen > 0
    htmlString &=
new string(htmlLen)
    htmlString = MyFile.HtmlBlob[0 : htmlLen-1]
! BLOB fields are zero indexed
    HtmlEditor.SetHtml(htmlString)        
! Load the data into the editor.
end

! This code store the editor contents back in the BLOB field and
! then diposes the string that was created


htmlLen = HtmlEditor.GetHtml(htmlSource)
if htmlLen > 0                             ! The string needs to be larger to hold the source
   
Dispose(htmlSource)
    htmlSource &=
new string(htmlLen)
    HtmlEditor.GetHtml(htmlSource)
end

MyFile.HtmlBlob{
prop:size} = 0             ! Clear the BLOB field
htmlLen =
Len(Clip(htmlSource))
MyFile.HtmlBlob[0 : htmlLen-1] = htmlSource[1 : htmlLen]
Access:MyFile.
Update()
Dispose(htmlString)

 

 

SetPageTitle (string pageTitle)

Not supported in the current release. Sets the Title of the current document. This is the contents of the <title> tag in the HTML.

Parameters

string pageTitle

A string that contains the title of the page.

Return Values

None

Examples

HtmlEditor.SetPageTitle('Hello World')

 

 

IsReady (), long

This method returns the .editorReady  property of the editor, which indicates whether the editor has fully loaded and is ready for use or not. Methods that interact with the editor cannot be called before the EditorReady() callback is called and the .editorReady property is set to 1.

When the editor intialises it does so in two stages. First the actual control is intialised, and then the editor is loaded. Once the control has loaded it calls the BeforeEditorLoad() method, which allows last minute configuration to be done before the editor itself is loaded. Once the editor is loaded, but before it intialises the BeforeEditorInit() method is called and finally the EditorReady() method is called to indicate that the loading is complete. This allows code to be added in each stage of the loading process.

Once editor is loaded completly the .editorReady property is set to 1 and the EditorReady() method is called.

 

Parameters

None

Return Values

Returns 1 if the editor is intialised and ready to be used, or zero if the editor either has not been initialising, or is still in the process of doing so.

Examples

if HtmlEditor.IsReady()
    HtmlEditor.Load(myFileName)
end

 

 

SetFileName (string fileName)

Sets the file name properties for the class based on the passed file name. This method would not typically be called, except from within the class when a new document is loaded. For file loading, saving and file name and path handling the feFile class can be used.

Parameters

string fileName

The name of the file, including the path. This is then parsed, split and stored in the object properties.

Return Values

None

Examples

n/a

 

 

SetSkin (string skinPath)

Sets the skin (style) for the editor to use. The editor ships with a number of different skin (style) options. This must be set in the BeforeEditorInit() method in order to work. One the editor has initialised the skin cannot be changed. The Office2003 skin is currently the default.

Parameters

string skinPath

The path to one of the folders in the skin directory in the Editor directory. For example: 'skins/aluminium/' or 'skins/office2003'

Return Values

None

Examples

HtmlEditor.BeforeEditorInit Procedure()
  code

    case mySkinStyle
    of 1
        HtmlEditor.SetSkin('
skins/Office2007Real') 
    of 2
        HtmlEditor.SetSkin('skins/Office2003')  
    of 3
        HtmlEditor.SetSkin('
skins/Aluminium')
    of 4
        HtmlEditor.SetSkin('
skins/silver')  
    else
        HtmlEditor.SetSkin('')  
! Use the default
    end

  parent.BeforeEditorInit () 

 

 

CollapseToolbar ()

Collapses (hides) the toolbar. The equivilent of the user clicking on the bar on the left of the toolbar to collapse it.

Parameters

None

Return Values

None

Examples

HtmlEditor.CollapseToolbar()

 

 

ExpandToolbar ()

Expands (show) the toolbar. The equivilent of the user clicking on the bar on the left of the toolbar to expand it.

Parameters

None

Return Values

None

Examples

HtmlEditor.ExpandToolbar()

 



Callback methods

_EventCallback (long EventID, string Parm1, string Parm2, string Parm3, string Parm4, string Parm5, string Parm6, string Parm7), long

The internal event callback method, this is not typically a method that would be called directly or overrriden. Additional methods will be provided to handle each specific event

Parameters

long EventID

The identifier for the particular event generated by the control

string Parm1...string Parm7

The list of parameter values associated with the event.

 

Return Values

Returns 1 for success and zero for failure

Examples

n/a

 

 

EditorReady ()

Called once the editor has loaded and initialised. This indicates that the editor is actually ready to be used. If you need to execute code as soon as the editor has loaded, then this is the method to use.

Parameters

None

Return Values

None

Examples

HtmlEditor.EditorReady Procedure()
  code

    HtmlEditor.Load(myFileName)   ! Load a file as soon as the editor is ready

  parent.EditorReady() 

 

 

BeforeEditorInit ()

This method is called once the control has loaded, and the editor has loaded, but not been intialised. It provides a point at which any last minutes changes to the configuration can be made. For example the SetSkin() method can be called to change the skin (style) of the editor.

When the editor intialises it does so in two stages. First the actual control is intialised, and then the editor is loaded. Once the control has loaded it calls the BeforeEditorLoad() method. Once the editor is loaded, but before it intialises, the BeforeEditorInit() method is called and finally the EditorReady() method is called to indicate that the loading is complete. This allows code to be added in each stage of the loading process.

Once editor is loaded completely the .editorReady property is set to 1 and the EditorReady() method is called.

 

Parameters

None

Return Values

None

Examples

HtmlEditor.BeforeEditorInit Procedure()
  code

    case mySkinStyle    ! Load a skin (style) file based on a variable's value
    of 1
        HtmlEditor.SetSkin('
skins/Office2007Real') 
    of 2
        HtmlEditor.SetSkin('skins/Office2003')  
    of 3
        HtmlEditor.SetSkin('
skins/Aluminium')
    of 4
        HtmlEditor.SetSkin('
skins/silver')  
    else
        HtmlEditor.SetSkin('')  
! Use the default
    end

  parent.BeforeEditorInit () 

 

 

 

BeforeEditorLoad ()

This method is called once the control has loaded and before the actual editor is loaded.

When the editor intialises it does so in two stages. First the actual control is intialised, and then the editor is loaded. Once the control has loaded it calls the BeforeEditorLoad() method. Once the editor is loaded, but before it intialises, the BeforeEditorInit() method is called and finally the EditorReady() method is called to indicate that the loading is complete. This allows code to be added in each stage of the loading process.

Once editor is loaded completely the .editorReady property is set to 1 and the EditorReady() method is called.

 

Parameters

None

Return Values

None

Examples

 

 

 

Additional Methods of the feEditor class

 

Edit (long EditType)

This is not supported by the new editor at this stage.

The functionality all exists and can be controlled by the user via the toolbar.

Calls various "Editing" commands (command available from the Edit menu). Note that this method is currently under construction in the new feEditor class.

Parameters

long EditType

Can be one of the following values:

Return Value

None

Example

n/a

 

 

GetHtmlGraphicsInfo ( *string HtmlSource), string

This method is deprecated and the functionality is expanded int he new EmbedImages methods. Calling this method will call EmbedImages to return a string containing the image files used in the HTML document. This is usually done in order to then embed the images when sending an email. The EmbedImages method also allows each image SRC in the HTML to be modified to the format required for embedding when sending the email.

This method was written primarily to make it easier to use File Explorer with NetTalk, to create and send emails. The idea is that you use File Explorer to create / view an email (html). To send this email (using NetTalk), you need to set several NetTalk properties.  Two of these properties are a comma separated list of graphics in the html (ThisEmailSend.EmbedList), and a modified version of the html code (ThisEmailSend.MessageHtml), where image paths are changed from qualified paths to paths prefixed with "cid".

This File Explorer method simply updates two File Explorer properties, self.Source and self.GraphicsList. Also look at the notes below on the "RootFolder" property.

Parameters

string HtmlSource

A string that contains the HTML document to extract the images from

Return Value

Returns a string containing a comma seperated list of all images used in the HTML document.

Example

HtmlEditor.GetHtml(htmlString)               ! needed only for the next line
HtmlEditor.GetHtmlGraphicsInfo (htmlString) 
! updates the Source and Graphics list properties
ThisEmailSend.MessageHtml = htmlStringe
ThisEmailSend.EmbedList = HtmlEditor.GraphicsList

 

 

 

GetInfo (long property)
GetInfo ()

This method is deprecated with the new editor. It will still be supported, but the specific methods should be called to fetch the required properties where possible.

This method queries the object and updates properties with information.  Think of this as updating the properties (variables) at a moment in time.

Parameters

long property

This optional parameter used to specify which values should be retrieved. If no parameter is passed them all the values are retrieved. Can be one of the following values:

Other values are not supported at this time.

Return Values

None.

Example

ThisViewer1.GetInfo ()

 

 

HideControl ( )

Hides the File Explorer viewer control.  Note: ?feControl{prop:hide} = true will not work. This is becuase the panel control that is placed on the window is replaced entirely with the COM control.

Parameters

None.

Return Value

None

Examples

ThisViewer.HideControl()

 

 

Init ( )
Init ( long CurrentControl, <string LoadPath>, long Handle1=0, long Handle2=0, byte SkipCallbacks=false)

Called to initialise the control and load the editor. Must be called before any other methods are called. The second prototype is provided for backward compatibility with the old editor. The parameters are optional and ignored by the new editor.

Important: When the editor Init() method is called the control is loaded followed by the actual editor. The Init() method is asynchronous, so it completes and returns control to your application while the editor is being initialised in the background. Any calls to the methods while the editor is still loading will be ignored. Just before the editor is actually loaded the Init() methods calls the BeforeEditorLoad() callback method. This is where you can add code to modify the editor just before it is loaded. For example you can call SetSkin() to change the skin being used.

Once the initialisation is complete and the editor is loaded and ready to use the EditorReady() method is called. You can embed your code in this method that needs to execute as soon as the editor is ready to be used. The .editorReady property of the object is also set to 1, and you can call the IsReady() method to check whether the editor has is ready to be used at any time.

Parameters

None. No parameters are needed with the new editor, however the old prototype for the method is still supported for backward compatibility. Any passed parameters are ignored.

Return Value

None

Example

HtmlEditor.Init()

 


InsertHtml (long location, string htmlToInsert )

This method enables you to insert html into the loaded document.  The TextToInsert parameter that you pass can be either actual "html", or a variable containing the html to insert (as illustrated in the examples below).

Parameters

byte location

This parameter is not currently supported by the new editor, the text is always inserted at the current cursor position.
One of the following values:

string htmlToInsert

A string containing the HTML to insert into the document.

Return Value

None

Example

HtmlEditor.InsertHtml(myHtmlString)

 


InsertTable ()

This method is not currently supported by the new editor. It will be supported in a future release. The Toolbar button can be used by the user to insert and manipulate tables.

Parameters

n/a

Return Value

None.

Examples

n/a

 


InsertText     ( byte location, string textToInsert )

This method enables you to insert text into the loaded document.  The TextToInsert parameter that you pass can be either actual text, or a variable containing the text to insert (as illustrated in the examples below).

Parameters

byte Location

This parameter is not supported in this release. In future releasesthe following values will be supported:

string textToInsert

The actual text to insert into the document.

Return Value

None

Examples

MyVar = 'I am here'
ThisViewer1.InsertText (1, MyVar)

Remarks

In order to insert multiple spaces the InsertHtml method needs to be used. The HTML format ignores extraneous white space, so multiple spaces will be displayed as a single space.

 


KeyPressed (signed feControl) ,long

This method was provided but not fully implement with the old editor. It is deprecated and no longer supported.

 

 

Kill (  )

Handles the "closing down" of an object. Typically called as the window which contains the object is closed. This method must be called before the object goes out of scope in order to ensure that all allocated memory is released.

Parameters

None

Return Values

None

Examples

HtmlEditor.Kill ()

 

 

NewDocument ( )

Creates a new, blank document.

You can call this method before calling the Load method (although it is not necessary as a new blank document is created automatically). The Init() method must be called before any other methods are called and will automatically create a new blank document, so it is not neccessary to call NewDocument unless you would like to clear the contents of the editor and create a blank document.

Parameters

None

Return Value

None

Examples

HtmlEditor.NewDocument()

 

 



PrintMe (byte showDialog)

Prints the loaded document, either with or without a dialog being displayed.

Parameters

byte showDialog

If set to 1 the print dialog is display, otherwise the document is send to print without displaying any dialogue.

Return Value

None

Examples

ThisViewer1.PrintMe (true)

 

 


Reload ( )

Reloads the last document which you loaded, the equivilent of the Revert() method, without the option to prompt the user. This is identical to calling the Load() method with the same file name as previously specified. It will load the document from disk and any usaved changes will be lost.

Parameters

None

Return Value

None

Example

ThisViewer1.Reload()

 



Save     ( *string saveLocation, byte saveType, byte promptUser=true ), byte, proc

Saves the HTML document to disk, or into the passed string, depending on the value of the saveType parameter.

If the saveType is set to 1 the function saves to disk.

Parameters

None

Return Value

None

Example

! Save a file and specify the file name
fileName =
LongPath() & '\MyFile.htm'
HtmlEditor.Save(fileName, 1)

! Save a file that is being edited (commit the changes to disk)
HtmlEditor.Save()

 

 


SetFocus     ( )

Sets the focus to the window that contains the FileExplorer control.

Parameters

None

Return Value

None

Examples

HtmlEditor.SetFocus()

 

 

 

Settings     ( string bkgColor ) ,byte

 This method is deprecated and not supported by the new editor. It was provided to set the background colour of the page, which will be exposed through  SetBackgroundColor() and GetBackgroundColor() methods in future versions.

 

 

UnhideControl     ( )

Unhides the FileExplorer control if it has been hidden using the HideControl method. Note that the panel populated in the Window Editor is purely a place holder, and has no relation to the actual Com control, it ise used purely for positioning and visual representation in the Window Editor in Clarion. Setting ?feControl{prop:hide} = false will have no impact on the visibility of the control.

Parameters

None

Return Value

None

Examples

ThisViewer.UnhideControl()

 

 

Update     ( string property, string propValue )

Use this method to update various properties / values. This method is supported by the editor, but it is recommended that you call the relevant methods directly rather than using this method. For example use GetHtml() and SetHtml() rather calling GetInfo() and Update() to get or set the HTML.

Parameters

string property

The Property parameter can be one of the following strings

string propValue

The value to set the specified property to.

Return Value

None

Examples

code

htmlSource = '<html><head></head><body><h1>Hello World</h1><p>This is an HTML document</p></body></html>'
ThisViewer1.Update('
Source', htmlSource)

Remarks

The reason you use this method and don't just change the properties "directly" is because using this method results in the changes being implemented "immediately", and not for instance only coming into effect the next time you load a document into the object which is often the "default" behaviour.

This method should be considered largely deprecated, and is primarily provided for backward compatibility.

 

 

feEditor - Properties

active byte Deprecated
browser byte Deprecated with the new editor.
currentPath string The full path (including filename) of the file currently loaded
debugging long Enableds or disables debug output. See the ErrorTrap(), Log() and Debugging() methods.
fileName string
The file name only, excluding the path
filePath string The path to the document (without the file name), if a document is loaded by specifying a file name without a path then the current application path is used. This property has URL style forward slashs (/) for Windows style slashes use the pagePath property
pagePath string The document path, but with normal Windows style backslashes (\)
docInnerText cstring Same as the InnerText property, but this property holds the InnerText component for the whole document, not just the currently selected portion.  Use this property if you're wanting the "text" from an entire html page.  Refreshed using the GetInfo method.
innerHtml cstring Holds the HTML for the selected object, between the start and end tags.  See the GetInfo and Update methods.
innerText cstring Holds the text for the selected object, between the start and end tags.  See the GetInfo and Update methods.
editorReady long Whether the editor is ready for use or not. Can also be retrieved by calling the IsReady() method

When the editor intialises it does so in two stages. First the actual control is intialised, and then the editor is loaded. Once the control has loaded it calls the BeforeEditorLoad() method. Once the editor is loaded, but before it intialises, the BeforeEditorInit() method is called and finally the EditorReady() method is called to indicate that the loading is complete. This allows code to be added in each stage of the loading process.

The editor is then loaded and once complete the .editorReady property is set to 1 and the EditorReady() callback method is called.

Methods that interact with the editor cannot be called before the EditorReady() callback is called and the isReady property is set to 1.
objType string Not supported in the current version
This property holds the selected object type within the current document.  It can be one of three things:
  • "Text" - Selection is text based
  • "None" - Nothing selected
  • "Control" - An image or a form control is selected
outerHtml cstring Use the GetHtml() method to retrieve the HTML source.
Holds the selected (html) object's html content  See the GetInfo and Update methods.
outerText cstring Holds the selected (html) object's text content  See the GetInfo and Update methods.
pageTitle cstring Not supported in the current version, will be replaced by the GetPageTitle() method.
Holds the title of the page being displayed.  See the GetInfo method.
picAlign cstring Not supported in the current version
Holds the "Alignment" setting for the currently selected image in an html document.  Use the GetInfo and Update methods.
picBorder (Byte) Not supported in the current version
Holds the "Border" width for the currently selected image in an html file.  Use the GetInfo and Update methods.  (Setting the border to 0 will result in the image having no border).
picHSpacing (Byte) Not supported in the current version
Holds the "Horizontal Spacing" setting for the currently selected image in an html file.  Use the GetInfo and Update methods.
picVSpacing (Byte) Not supported in the current version
Holds the "Vertical Spacing" setting for the currently selected image in an html file.  Use the GetInfo and Update methods.
picSource (String) Not supported in the current version
Holds the source (web url or filename) for the currently selected image in an html file.  Use the GetInfo and Update methods.
picText (String) Not supported in the current version
Holds the "Alternate Text" (the text that displays when you point at the image, and/or if the image fails to load) for the currently selected image in an html file.  Use the GetInfo and Update methods.
rootFolder (String) This has been deprecated as the GetHtmlGraphicsInfo method has been replaced by the enhanced EmbedImages() method. See EmbedImages().
source cstring Use the GetHtml() method to retrieve the source rather than this property.
Holds the html component (source / text) of the loaded page.  See the GetInfo and Update methods.
tagName string Not supported in the current version
Holds the Tag Name of the selected object (e.g. "STRONG", "FONT", "A").  See the GetInfo method.
url string Replaces by the filePath property.

 

feEditor - Templates

At this time there is quite an overlap in terms of multiple File Explorer classes being implemented by the same templates.  In the future we may revisit this, but for now all templates are covered in the main (FileExplorer.htm) help document, please click here.

 

Summary of callback events

See the feEditor_Callbacks procedure in the feabc.app example application for more info. Note that these need to be revised with the new feEditor class.They are all supported by the new editor, but may not act entirely as expected as they refer to the events generated by the editor, rather than the document that it contains.

Event Name Equate Description
ContextMenuAction fe:EdEvt_ContextMenuAction The user right clicked to display the popup context menu
DisplayChanged fe:EdEvt_DisplayChanged The display of the page changed
DocumentComplete fe:EdEvt_DocumentComplete The document completed downloading. For frames pages this will be called once for each frame
OnBlur fe:EdEvt_OnBlur The control lost focus
OnClick fe:EdEvt_OnClick The control was clicked on by the user
OnDblClick fe:EdEvt_OnDblClick The control was double clicked on by the user
OnKeyDown fe:EdEvt_OnKeyDown The user pressed a key
OnKeyPress fe:EdEvt_OnKeyPress The user pressed a key
OnKeyUp fe:EdEvt_OnKeyUp The user released the pressed key
OnMouseDown fe:EdEvt_OnMouseDown The mouse button was pressed
OnMouseMove fe:EdEvt_OnMouseMove The mouse was moved
OnMouseOut fe:EdEvt_OnMouseOut The mouse was moved outside the control
OnMouseOver fe:EdEvt_OnMouseOver The mouse was moved over the control
OnMouseUp fe:EdEvt_OnMouseUp The mouse button was released
OnReadyStateChange fe:EdEvt_OnReadyStateChange  
ShowContextMenu fe:EdEvt_ShowContextMenu The right click context menu will be displayed

 

Using the HTML editor in Windows Vista and Windows Server 20088

The new feEditor class that ships with FileExplorer 5 and later is fully compatible with Vista and Windows Server 2008 and does not have any dependencies other than requiring Internet Explorer.

To use the old feHtmlEditor under Windows Vista you need to ship the DhtmlEd.msi that FileExplorer will place in your Clarion\3rdparty\bin\ directory when it is installed. This should be run to install the MS DHTML control on the users machine when your application is installed. We recommend not using the old control, but rather using the new feEditor, which is the default with FileExplorer 5 and higher. Not only is it faster, but it is more feature rich and stable than the Microsoft based control is.

 

Copyright © 2008 CapeSoft Software (Pty) Ltd