Upgrade from Version 3

    • Offizieller Beitrag

    How to upgrade from Version 3

    Version 5 which emulates Version 4 ("emulate" because it is based on a new object oriented concept) tries to follow the WPTools 4 specifications as far as that was possible.The following changes were already introduced in version 4.

    1) Changed unit names
    Please check out the PDF manual which shows which unit names must be replaced. In general we suggest to add WPIO, WPRTEDefs, WPRTEPaint, WPCTRMemo, WPCTRRich and remove all units which are not found anymore (such as WPRtf*, WPDefs, WPWinCTR, WPRich, WPEmObj).

    2) Removed Properties
    When you open your project you will notice that some properties have been removed.
    This is the Hints property of the ToolBar (TWPToolBar.Hints), the info strings in the property Header, the XOffset property of the ruler and a few others. The StreamUndo EditOption is now obsolete.
    The hint property has been removed because the toolbar now uses the WPTools Shared localization system (WPLanguageControl). Please see the demo Tasks\Localisation! The other properties are redundant.

    3) PTextObject^.extra
    There is no PTextObject anymore but something similar still exists.
    This is the TWPTextObj class. Objects of this class are used for mailmerge fields, bookmarks, fields such as page number and also images. In case they are used for images their property ObjRef points to an object of type TWPObject, usually a TWPOImageObject which is implemented in unit WPObj_Image.

    4) Header.Title, Header.Subject, Header.Comment
    They are replaced by the collection RTFVaraiables which can contain additional fields.

    5) ScreenResMode
    Obsolete - please read the chapter WYSIWYG in the manual
    (https://www.wpcubed.com/manuals/wp5man…tml?wysiwyg.htm)

    6) HTML Import/Export
    The units WPReadHT and WPWrtHT are not used any more. The HTML import/export is implemented in unit WPIOHTML. WPTools 5 will alsways use CSS in HTML data. (Unlike in WPTools 4 it is not necessary to use a TWPStyleCollection for the HTML import/export to use)

    7) Bookmark support
    In WPTools V3 the bookmarks were text attributes just as bold or italic. This has been changed. The new concept uses the embedded "code" management (TWPTextObj) which is also used by mail merge and other features. The new bookmark support uses start and end markers. All special bookmark support functions start with 'Bookmark': https://www.wpcubed.com/manuals/wp5man…l?bookmarks.htm

    The property BookmarkLabels does not exist anymore. Please use BookmarkGetList(list: TStrings; FromAllBlock: Boolean = FALSE) to fill a string list with the bookmarks of a document.

    9) The WPTools Version 2 picture support function have been now removed.
    Please use the functions of the object TWPRichText.TextObjects instead of:

    Please read:
    https://www.wpcubed.com/manuals/wp5man/index.html?images.htm

    The list WPRichText1.Memo.TxtObj does not exist anymore. You can use the functions of a TParagraph directly to access a TWPTextObj, for example par.ObjRefs[pos_in_par].

    Note that there is no TAttr anymore, no PTAttr pointer of course and no TAttr.tag which was used to identify an object. Objects in WPTools 5 are actually TWPTextObj objects which are hosted by the paragraph. They are not anymore TextObj records which are referenced by the 'tag' of a certain character. If you code uses PTAttr, PTLine, PTextObj please rewrite it. Probably the same functionality can be achieved with a few lines of "WPTools 5" code. Please post follow-up questions here!

    10) The events OnDrawBackground, PrintHeader, PrintFooter has been removed. Please use OnPaintWatermark
    https://www.wpcubed.com/manuals/wp5man…twatermarks.htm

    11) Hyperlinks are now implemented as start/end objects. Similar to bookmarks. No more 'hidden' text which is used as URL.
    https://www.wpcubed.com/manuals/wp5man…?hyperlinks.htm

    12) the functions ReadFieldCommand, GetFieldName have been removed.
    Note that fields are implemented as TWPTextObj, if you have a reference to suach an object (most field-functions, bookmark-functions, "code" functions) return such a refence you have access to the propereties it stores. The name is in property 'Name', the optional string (such as the command) in property 'Source'.

    13) Hints for upgrade from V4:
    https://www.wpcubed.com/manuals/wp5man…oldprojects.htm

    You can also search the online version of the programmers reference:
    http://www.google.com/search?sourcei…ols5+TParagraph

    Please don't forget to look at the source files WPCtrRich.PAS, WPObj_Image and WPCtrMemo.PAS.

    Please post follow up questions here!

    Regards,

    Julian Ziersch