New Border Handling

Top  Previous  Next

Border definitions are now stored in the regular properties of a TParagraph or TWPTextStyle class. These properties are usually read by the AGet function and written using the ASet procedure.


For your convenience all border properties can be saved in and restored from a TBorder record.


This record is written by the ASetBorder procedure.


The TBorder record is similar to the one used by WPTools 4, but has been improved to hold different modes, colors and widths for each line by using arrays for the values BorderType, BorderColor and BorderWidth.



a)  The blDouble and blDot LineType no longer exist. Instead the 'type' must be used to choose a different border line style.


So code such as

Ndouble.Checked  := blDouble in Border.LineType;


must be changed to

Ndouble.Checked := Border.AllBorderType = WPBRD_DOUBLE;


Please note that this is using the AllBorderType item which contains the type of all borders, if they are the same. To read or set a single style for one of the possible borders (left, right ...) use the array Border.BorderType[BlLeft..BLBar].


b) The value 'FUse256Colors' or 'Use256Colors' no longer exists. WPTools always uses at least 256 colors.


c) The elements HColor, HColorR, VColor, VColorB have been replaced by the array BorderColor: array[BlLeft..BLBar] of Integer;


So please change code such as

     btnLColor.Tag    := Border.HColor;

     btnRColor.Tag    := Border.HColorR;

     btnTColor.Tag    := Border.VColor;

     btnBColor.Tag    := Border.VColorB;



     btnLColor.Tag    := Border.BorderColor[blLeft];

     btnRColor.Tag    := Border.BorderColor[blRight];

     btnTColor.Tag    := Border.BorderColor[blTop];

     btnBColor.Tag    := Border.BorderColor[blBottom];


d) The Thickness value no longer exists. Please use either the AllBorderWidth or the BorderWidth[] elements. Please note that the width is stored as twip value, not as 1/2 pt.


e) The Space value is no longer used. The styles now support padding values which are defined by the WPAT_ codes WPAT_PaddingLeft, WPAT_PaddingRight, WPAT_PaddingTop and WPAT_PaddingBottom. These values cannot be set in the TBorder record.


f) The function Memo.Set_ParBorder no longer exists. Instead you can use



      LineSelection: TBorderType = [blLeft,blTop,blRight,blBottom];

      WPBRD_mode: Integer = -1;

      ThicknessTW : Integer = -1;

      LeftColor   : Integer = -1;

      RightColor  : Integer = -1;

      TopColor    : Integer = -1;

      BottomColor : Integer = -1;

      AllPadding  : Integer = -1;

      DeleteDefaultSettings: Boolean = TRUE).


A value of -1 is used to select the default value. By default using -1 will delete the corresponding attribute from the list of attributes which causes the inherited values to be used.