KHexEditor help: All Units

All Units

Name | Description
KControls | This unit contains the base class for all visible controls.
KDialogs | This unit contains all dialogs supplied with KControls.
KFunctions | This unit contains miscellaneous supporting functions
KGraphics | This unit contains advanced graphic functions used by KControls suite.
KHexEditor | This unit contains the TKHexEditor component and all supporting classes
KWideWinProcs | This unit contains Unicode equivalents of ANSI Win32 API functions not supported in Win9X without Unicode Layer for Win9X
Generated by DIPasDoc 0.8.9 on 25. XI. 2010 12:59:35


KHexEditor help: KControls

Unit KControls

Description

This unit contains the base class for all visible controls.

This unit implements the base class TKCustomControl for all visible controls from the KControls Development Suite. Copyright © 2009 Tomas Krysl (tk@tkweb.eu)

License:
This code is distributed as a freeware. You are free to use it as part of your application for any purpose including freeware, commercial and shareware applications. The origin of this source code must not be misrepresented; you must not claim your authorship. You may modify this code solely for your own purpose. Please feel free to contact the author if you think your changes might be useful for other users. You may distribute only the original package. The author accepts no liability for any damage that may result from using this code.

Classes, Interfaces and Objects

Name | Description
Class TKCustomControl |
Class TKPreviewColors | Container for all colors used by TKPrintPreview class
Class TKPrintPageSetup | Class to specify the print job parameters
Class TKPrintPreview | Print preview control for the TKCustomControl component

Functions and Procedures

Overview

function InchesToValue(Units: TKPrintUnits; Value: Double): Double;
function ValueToInches(Units: TKPrintUnits; Value: Double): Double;

Description

function InchesToValue(Units: TKPrintUnits; Value: Double): Double;

Converts a value given in inches into a value given in specified units.

    Parameters:
  • Units - measurement units for the output value
  • Value - input value to convert

function ValueToInches(Units: TKPrintUnits; Value: Double): Double;

Converts value given in specified units into a value given in inches.

    Parameters:
  • Units - measurement units for the input value
  • Value - input value to convert

Types

Overview

TKColorArray = array of TColor;
TKPreviewChangedEvent = procedure(Sender: TObject) of object;
TKPreviewColorIndex = Integer;
TKPrintMeasureInfo = record OutlineWidth: Integer; OutlineHeight: Integer; HorzPageCount: Integer; VertPageCount: Integer; PageCount: Integer; end;
TKPrintNotifyEvent = procedure(Sender: TObject; Status: TKPrintStatus; var Abort: Boolean) of object;
TKPrintOptions = set of TKPrintOption;
TKPrintPaintEvent = procedure(Sender: TObject) of object;

Description

TKColorArray = array of TColor;

This array serves as storage place for all colors.

TKPreviewChangedEvent = procedure(Sender: TObject) of object;

Declares OnChanged event handler

    Parameters:
  • Sender - identifies the event caller

TKPreviewColorIndex = Integer;

Declares possible indexes e.g. for the Color property.

TKPrintMeasureInfo = record OutlineWidth: Integer; OutlineHeight: Integer; HorzPageCount: Integer; VertPageCount: Integer; PageCount: Integer; end;

Declares the information structure for the MeasurePages method

    Members:
  • OutlineWidth - printed outline width (maximum of all pages) in desktop pixels
  • OutlineHeight - printed outline height (maximum of all pages) in desktop pixels
  • HorzPageCount - number of pages to split a wide shape into
  • VertPageCount - number of pages to split a tall shape into
  • PageCount - total number of pages for 1 copy. Might be HorzPageCount * VertPageCount but does not necessarilly have to be.

TKPrintNotifyEvent = procedure(Sender: TObject; Status: TKPrintStatus; var Abort: Boolean) of object;

Declares OnPrintNotify event handler

    Parameters:
  • Sender - identifies the event caller
  • Status - specifies the event type
  • Abort - set to True to abort the print job
Remark: At certain time slots, the print spooler allows the message queue to be processed for the thread where the print job is running. This e.g. allows the user to press a button on the Abort dialog. Because this message loop can be invoked e.g. during a Printer.Canvas.TextRect function and any painting messages may hover in the message queue, any functions used both to print a job and to process particular messages should be reentrant to avoid conflicts. Perhaps should print jobs be run in seperate threads?

TKPrintOptions = set of TKPrintOption;

Print options can be arbitrary combined.

TKPrintPaintEvent = procedure(Sender: TObject) of object;

Declares OnPrintPaint event handler

    Parameters:
  • Sender - identifies the event caller

Enumerations

TKPreviewScaleMode

Declares possible values for the ScaleMode property

smScale | Apply scale defined by the Scale property
smPageWidth | Scale the page so that it horizontally fits to the window client area
smWholePage | Scale the page so that it fits to the window client area
TKPrintOption

Declares print options - possible values for the Options property.

poCollate | If there are more printed copies these will be collated.
poFitToPage | The printed shape will be scaled to fit on page.
poMirrorMargins | Every even page will be printed with mirrored (swapped) margins.
poPageNumbers | Page numbers will be added to the bottom of each printed page.
poPaintSelection | Paints the selection in control's specific manner.
poTitle | Title will be printed to the top of each printed page.
poUseColor | Color page will be printed instead of B/W page.
TKPrintRange

Declares possible values for the Range property.

prAll | All pages will be printed.
prSelectedOnly | Only selected block will be printed.
prRange | Only given range of pages will be printed.
TKPrintStatus

Declares possible values for the Status parameter in the TKPrintNotifyEvent event

epsBegin | This event occurs at the beginning of the print job - you may show an Abort dialog here
epsNewPage | This event occurs after each page has been printed - you may update the Page/Copy information in the Abort dialog
epsEnd | This event occurs at the end of the print job - you may hide the Abort dialog here
TKPrintUnits

Declares measurement units for KControls printing system.

puMM | Corresponding value is given in millimeters.
puCM | Corresponding value is given in centimeters.
puInch | Corresponding value is given in inches.
puHundredthInch | Corresponding value is given in hundredths of inches.

Constants

Overview

cBkGndDef = clAppWorkSpace;
cBorderDef = clBlack;
cBorderStyleDef = bsSingle;
cCopiesDef = 1;
cCopiesMax = 1000;
cCopiesMin = 1;
ciBkGnd = TKPreviewColorIndex(1);
ciBorder = TKPreviewColorIndex(2);
ciPaper = TKPreviewColorIndex(0);
ciPreviewColorsMax = ciSelectedBorder;
ciSelectedBorder = TKPreviewColorIndex(3);
cMarginBottomDef = 2.0;
cMarginLeftDef = 1.5;
cMarginRightDef = 1.5;
cMarginTopDef = 1.8;
cOptionsDef = [poFitToPage, poPageNumbers, poUseColor];
cPaperDef = clWhite;
cPF_Dragging = $00000001;
cPF_UpdateRange = $00000002;
cRangeDef = prAll;
cScaleDef = 100;
cScaleMax = 500;
cScaleMin = 10;
cScrollDelta = -2;
cScrollNoAction = -1;
cSelectedBorderDef = clNavy;
cUnitsDef = puCM;

Description

cBkGndDef = clAppWorkSpace;

Default value for the BkGnd color property.

cBorderDef = clBlack;

Default value for the Border color property.

cBorderStyleDef = bsSingle;

Default value for the BorderStyle property.

cCopiesDef = 1;

Default value for the Copies property

cCopiesMax = 1000;

Maximum for the Copies property

cCopiesMin = 1;

Minimum for the Copies property

ciBkGnd = TKPreviewColorIndex(1);

Index for the BkGnd property.

ciBorder = TKPreviewColorIndex(2);

Index for the Border property.

ciPaper = TKPreviewColorIndex(0);

Index for the Paper property.

ciPreviewColorsMax = ciSelectedBorder;

Maximum color array index

ciSelectedBorder = TKPreviewColorIndex(3);

Index for the SelectedBorder property.

cMarginBottomDef = 2.0;

Default value for the MarginBottom property

cMarginLeftDef = 1.5;

Default value for the MarginLeft property

cMarginRightDef = 1.5;

Default value for the MarginRight property

cMarginTopDef = 1.8;

Default value for the MarginTop property

cOptionsDef = [poFitToPage, poPageNumbers, poUseColor];

Default value for the Options property.

cPaperDef = clWhite;

Default value for the Paper color property.

cPF_Dragging = $00000001;

Internal flag for TKPrintPreview.

cPF_UpdateRange = $00000002;

Internal flag for TKPrintPreview.

cRangeDef = prAll;

Default value for the Options property.

cScaleDef = 100;

Minimum for the Scale property

cScaleMax = 500;

Default value for the Scale property

cScaleMin = 10;

Maximum for the Scale property

cScrollDelta = -2;

Constant for control scrollbars. It means: Use given Delta to update scrollbar.

cScrollNoAction = -1;

Constant for control scrollbars. It means: Leave that scrollbar untouched.

cSelectedBorderDef = clNavy;

Default value for the SelectedBorder color property.

cUnitsDef = puCM;

Default value for the Units property.

Author

Tomas Krysl (tk@tkweb.eu)

Created

18 Sep 2009

Last Modified

20 Jun 2010


KHexEditor help: KControls: Class TKCustomControl

Class TKCustomControl

Unit

KControls

Declaration

type TKCustomControl = class(TCustomControl)

Description

Base class for all visible controls in KControls.

Fields

 | Name | Description
Protected | FFlags | Holds the mutually inexclusive state as cXF... flags.
Protected | FMessages | Defines the message queue for late update.
Protected | FPreviewList | Gains access to the list of associated previews.

Methods

Overview

Public | constructor Create(AOwner: TComponent); override;
Public | destructor Destroy; override;
Protected | procedure AddPreview(APreview: TKPrintPreview);
Protected | procedure AdjustPageSetup; virtual;
Protected | procedure CancelMode; virtual;
Protected | procedure CreateParams(var Params: TCreateParams); override;
Public | function Flag(AFlag: Cardinal): Boolean;
Protected | procedure FlagAssign(AFlag: Cardinal; Value: Boolean);
Protected | procedure FlagClear(AFlag: Cardinal);
Protected | procedure FlagSet(AFlag: Cardinal);
Protected | procedure FlagToggle(AFlag: Cardinal);
Protected | function InternalGetSelAvail: Boolean; virtual;
Protected | procedure InternalUnlockUpdate; virtual;
Public | procedure Invalidate; override;
Protected | procedure InvalidatePageSetup;
Protected | procedure InvalidateRectArea(const R: TRect); virtual;
Protected | function IsThemed: Boolean; virtual;
Protected | procedure LateUpdate(var Msg: TLMessage); virtual;
Public | procedure LockUpdate;
Protected | procedure MeasurePages(var Info: TKPrintMeasureInfo); virtual;
Protected | function MessagePeek(out Msg: TLMessage): Boolean;
Protected | procedure MessagePoke(const Msg: TLMessage);
Protected | function MessageSearch(MsgCode: Cardinal): Boolean;
Protected | procedure MouseFormLeave; virtual;
Protected | procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
Protected | procedure NotifyPreviews;
Protected | procedure Paint; override;
Protected | procedure PaintPage; virtual;
Protected | procedure PaintToCanvas(ACanvas: TCanvas); virtual; abstract;
Protected | procedure PostLateUpdate(const Msg: TLMessage; IfNotExists: Boolean = False);
Protected | procedure PrintNotify(Status: TKPrintStatus; var Abort: Boolean); virtual;
Public | procedure PrintOut;
Protected | procedure PrintPaint; virtual;
Protected | procedure RemovePreview(APreview: TKPrintPreview);
Protected | function SetMouseCursor(X, Y: Integer): Boolean; virtual;
Public | procedure UnlockUpdate;
Protected | procedure UpdateSize; virtual;
Public | function UpdateUnlocked: Boolean;

Description

Public constructor Create(AOwner: TComponent); override;

Creates the instance. Assigns default values to properties, allocates default column, row and cell data.

Public destructor Destroy; override;

Destroys the instance along with all allocated column, row and cell data. See TObject.Destroy in Delphi help.

Protected procedure AddPreview(APreview: TKPrintPreview);

Adds a preview control to the internal list of associated previews.

Protected procedure AdjustPageSetup; virtual;

Gives the descendant the possibility to adjust the associated TKPrintPageSetup instance just before printing.

Protected procedure CancelMode; virtual;

Cancels any dragging or resizing operations performed by mouse.

Protected procedure CreateParams(var Params: TCreateParams); override;

Defines additional styles.

Public function Flag(AFlag: Cardinal): Boolean;

Determines whether a flag specified by AFlag is included in FFlags.

Protected procedure FlagAssign(AFlag: Cardinal; Value: Boolean);

If Value is True, includes the flag specified by AFLag to FFlags. If Value is False, excludes the flag specified by AFLag from FFlags.

Protected procedure FlagClear(AFlag: Cardinal);

Excludes the flag specified by AFLag from FFlags.

Protected procedure FlagSet(AFlag: Cardinal);

Includes the flag specified by AFLag to FFlags.

Protected procedure FlagToggle(AFlag: Cardinal);

If the flag specified by AFLag is included in FFlags, FlagToggle excludes it and vice versa.

Protected function InternalGetSelAvail: Boolean; virtual;

Returns True if the control has a selection.

Protected procedure InternalUnlockUpdate; virtual;

Called in UnlockUpdate. Allows the changes to be reflected.

Public procedure Invalidate; override;

Invalidates the entire control if control updating is not locked by LockUpdate.

Protected procedure InvalidatePageSetup;

Invalidates the page setup settings. If page setup is required again, it's UpdateSettings method is called.

Protected procedure InvalidateRectArea(const R: TRect); virtual;

Invalidates a rectangular part of the client area if control updating is not locked by LockUpdate.

Protected function IsThemed: Boolean; virtual;

Determines if control can be painted with OS themes.

Protected procedure LateUpdate(var Msg: TLMessage); virtual;

Called from KM_LATEUPDATE. Performs late update. Override to adapt.

Public procedure LockUpdate;

Locks control updating so that all possibly slow operations such as all Invalidate... methods will not be performed. This is useful e.g. when assigning many properties at one time. Every LockUpdate call must have a corresponding UnlockUpdate call, please use a try-finally section.

Protected procedure MeasurePages(var Info: TKPrintMeasureInfo); virtual;

Updates information about printed shape.

Protected function MessagePeek(out Msg: TLMessage): Boolean;

Retrieves a message from message queue if there is one. Used for late update.

Protected procedure MessagePoke(const Msg: TLMessage);

Puts a new message into the message queue. Used for late update.

Protected function MessageSearch(MsgCode: Cardinal): Boolean;

Searches the message queue for given message code.

Protected procedure MouseFormLeave; virtual;

Responds to WM_MOUSELEAVE message.

Protected procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;

Overriden method - see Delphi help.

Protected procedure NotifyPreviews;

Notifies all associated previews about a change in the associated page setup.

Protected procedure Paint; override;

Overriden method - see Delphi help. Paints the entire control client area.

Protected procedure PaintPage; virtual;

Paints a page to a printer/preview canvas.

Protected procedure PaintToCanvas(ACanvas: TCanvas); virtual; abstract;

Paints the control to the specified canvas. Must always be overriden.

Protected procedure PostLateUpdate(const Msg: TLMessage; IfNotExists: Boolean = False);

Adds a message to message queue for late update. Set IfNotExists to True to add that message only if the specified message code does not exist in the message queue at this moment.

Protected procedure PrintNotify(Status: TKPrintStatus; var Abort: Boolean); virtual;

Calls the OnPrintNotify event

Public procedure PrintOut;

Prints the control.

Protected procedure PrintPaint; virtual;

Calls the OnPrintPaint event

Protected procedure RemovePreview(APreview: TKPrintPreview);

Removse a preview control to the internal list of associated previews.

Protected function SetMouseCursor(X, Y: Integer): Boolean; virtual;

Updates mouse cursor according to the state determined from current mouse position. Returns True if cursor has been changed.

Public procedure UnlockUpdate;

Unlocks back to normal control updating and calls InternalUnlockUpdate to reflect (possible) multiple changes made. Each LockUpdate call must be always followed by the UnlockUpdate call.

Protected procedure UpdateSize; virtual;

Updates the control size. Responds to WM_SIZE under Delphi and similar notifications under Lazarus.

Public function UpdateUnlocked: Boolean;

Returns True if control updating is not locked, i.e. there is no open LockUpdate and UnlockUpdate pair.

Properties

Overview

Public | property BorderStyle: TBorderStyle;
Public | property CanPrint: Boolean;
Public | property MemoryCanvas: TCanvas;
Public | property MemoryCanvasRect: TRect;
Public | property MouseInClient: Boolean;
Public | property OnPrintNotify: TKPrintNotifyEvent;
Public | property OnPrintPaint: TKPrintPaintEvent;
Public | property PageSetup: TKPrintPageSetup;
Public | property PageSetupAllocated: Boolean;

Description

Public property BorderStyle: TBorderStyle;

Determines whether a single line border is drawn around the control. Set BorderStyle to bsSingle to add a single line border around the control. Set BorderStyle to bsNone to omit the border.

Public property CanPrint: Boolean;

Returns True if the control has anything to print and a printer is installed.

Public property MemoryCanvas: TCanvas;

Setting this property causes the control to be painted to MemoryCanvas in it's Paint method. This approach replaces PaintTo as it does not work good for all LCL widget sets. The control is painted normally on it's Canvas and then copied only once to MemoryCanvas. MemoryCanvas is then set to nil (not freed) to indicate the copying is complete.

Public property MemoryCanvasRect: TRect;

Specifies what rectangular part of the control should be copied on MemoryCanvas.

Public property MouseInClient: Boolean;

This property has the same meaning as the MouseInClient property introduced into TWinControl in BDS 2006.

Public property OnPrintNotify: TKPrintNotifyEvent;

This event is called at certain phases of the actually running print job.

Public property OnPrintPaint: TKPrintPaintEvent;

This event is called after the shape was drawn onto the printer canvas.

Public property PageSetup: TKPrintPageSetup;

Specifies the page setup component used for this control.

Public property PageSetupAllocated: Boolean;

Returns True if page setup component is allocated for this control.


KHexEditor help: KControls: Class TKPreviewColors

Class TKPreviewColors

Unit

KControls

Declaration

type TKPreviewColors = class(TPersistent)

Description

Container for all colors used by TKPrintPreview class

This container allows to group many colors into one item in object inspector. Colors are accessible via published properties or several public Color* properties.

Fields

 | Name | Description
Protected | FColors |

Methods

Overview

Public | constructor Create(APreview: TKPrintPreview);
Public | procedure Assign(Source: TPersistent); override;
Protected | procedure Initialize; virtual;
Protected | function InternalGetColor(Index: TKPreviewColorIndex): TColor; virtual;
Protected | procedure InternalSetColor(Index: TKPreviewColorIndex; Value: TColor); virtual;

Description

Public constructor Create(APreview: TKPrintPreview);

Creates the instance. You can create a custom instance and pass it e.g. to a Colors property. The APreview parameter has no meaning in this case and you may set it to nil.

Public procedure Assign(Source: TPersistent); override;

Copies the properties of another instance that inherits from TPersistent into this TKPreviewColors instance.

Protected procedure Initialize; virtual;

Initializes the color array.

Protected function InternalGetColor(Index: TKPreviewColorIndex): TColor; virtual;

Returns the specific color according to ColorScheme.

Protected procedure InternalSetColor(Index: TKPreviewColorIndex; Value: TColor); virtual;

Replaces the specific color.

Properties

Overview

Published | property BkGnd: TColor;
Published | property Border: TColor;
Public | property Color[Index: TKPreviewColorIndex]: TColor;
Public | property Colors: TKColorArray;
Published | property Paper: TColor;
Published | property SelectedBorder: TColor;

Description

Published property BkGnd: TColor;

Specifies the color of the background around paper.

Published property Border: TColor;

Specifies the color of the paper border.

Public property Color[Index: TKPreviewColorIndex]: TColor;

Returns color for given index.

Public property Colors: TKColorArray;

Returns array of colors.

Published property Paper: TColor;

Specifies the paper background color.

Published property SelectedBorder: TColor;

Specifies the color of the paper border when the control has input focus.


KHexEditor help: KControls: Class TKPrintPageSetup

Class TKPrintPageSetup

Unit

KControls

Declaration

type TKPrintPageSetup = class(TPersistent)

Description

Class to specify the print job parameters

Methods

Overview

Public | constructor Create(AControl: TKCustomControl);
Protected | procedure AfterUnitsChange; virtual;
Public | procedure Assign(Source: TPersistent); override;
Protected | procedure BeforeUnitsChange; virtual;
Public | function HMap(Value: Integer): Integer;
Public | procedure Invalidate;
Public | procedure LockUpdate; virtual;
Protected | procedure PaintPageToPreview(APreview: TKPrintPreview); virtual;
Public | procedure PrintOut;
Protected | procedure PrintPageNumber(Value: Integer); virtual;
Protected | procedure PrintTitle; virtual;
Public | procedure UnlockUpdate; virtual;
Protected | procedure UpdateSettings; virtual;
Public | function UpdateUnlocked: Boolean; virtual;
Public | procedure Validate;
Public | function VMap(Value: Integer): Integer;

Description

Public constructor Create(AControl: TKCustomControl);

Creates the instance. Assigns default values to properties.

Protected procedure AfterUnitsChange; virtual;

Called before new Units are set. Converts the margins to inches by default.

Public procedure Assign(Source: TPersistent); override;

Copies shareable properties of another TKPrintPageSetup instance to this instance.

Protected procedure BeforeUnitsChange; virtual;

Called after new Units are set. Converts the margins from inches by default.

Public function HMap(Value: Integer): Integer;

Returns a value mapped from desktop horizontal units to printer horizontal units.

Public procedure Invalidate;

Invalidates the settings.

Public procedure LockUpdate; virtual;

Locks page setup updating. Use this if you assign many properties at the same time. Every LockUpdate call must have a corresponding UnlockUpdate call, please use a try-finally section.

Protected procedure PaintPageToPreview(APreview: TKPrintPreview); virtual;

Paints a page to APreview.Canvas.

Public procedure PrintOut;

Prints the associated control.

Protected procedure PrintPageNumber(Value: Integer); virtual;

Prints the page number at the bottom of the page, horizontally centered.

Protected procedure PrintTitle; virtual;

Prints the title at the top of the page.

Public procedure UnlockUpdate; virtual;

Unlocks page setup updating and updates the page settings. Each LockUpdate call must be always followed by the UnlockUpdate call.

Protected procedure UpdateSettings; virtual;

Updates entire printing information.

Public function UpdateUnlocked: Boolean; virtual;

Returns True if updating is not locked, i.e. there is no open LockUpdate and UnlockUpdate pair.

Public procedure Validate;

Validates the settings.

Public function VMap(Value: Integer): Integer;

Returns a value mapped from desktop vertical units to printer vertical units.

Properties

Overview

Public | property Active: Boolean;
Public | property CanPrint: Boolean;
Public | property Canvas: TCanvas;
Public | property Control: TKCustomControl;
Public | property Copies: Integer;
Public | property CurrentCopy: Integer;
Public | property CurrentPage: Integer;
Public | property CurrentScale: Double;
Public | property DesktopPixelsPerInchX: Integer;
Public | property DesktopPixelsPerInchY: Integer;
Public | property EndPage: Integer;
Public | property FooterSpace: Double;
Public | property HeaderSpace: Double;
Public | property HorzPageCount: Integer;
Public | property MarginBottom: Double;
Public | property MarginLeft: Double;
Public | property MarginRight: Double;
Public | property MarginTop: Double;
Public | property Options: TKPrintOptions;
Public | property OutlineHeight: Integer;
Public | property OutlineWidth: Integer;
Public | property PageCount: Integer;
Public | property PageHeight: Integer;
Public | property PageWidth: Integer;
Public | property PaintAreaHeight: Integer;
Public | property PaintAreaWidth: Integer;
Public | property Previewing: Boolean;
Public | property PrinterFooterSpace: Integer;
Public | property PrinterHeaderSpace: Integer;
Public | property PrinterMarginBottom: Integer;
Public | property PrinterMarginLeft: Integer;
Public | property PrinterMarginLeftMirrored: Integer;
Public | property PrinterMarginRight: Integer;
Public | property PrinterMarginRightMirrored: Integer;
Public | property PrinterMarginTop: Integer;
Public | property PrinterName: string;
Public | property PrinterPixelsPerInchX: Integer;
Public | property PrinterPixelsPerInchY: Integer;
Public | property PrintingMapped: Boolean;
Public | property Range: TKPrintRange;
Public | property Scale: Integer;
Public | property SelAvail: Boolean;
Public | property StartPage: Integer;
Public | property Title: string;
Public | property Units: TKPrintUnits;
Public | property VertPageCount: Integer;

Description

Public property Active: Boolean;

Returns True if printing or previewing is active.

Public property CanPrint: Boolean;

Returns True if the control is associated and has anything to print.

Public property Canvas: TCanvas;

Returns the Printer.Canvas or TkPrintPreview.Canvas. Do not access outside print job.

Public property Control: TKCustomControl;

Returns the control to which this TKPrintPageSetup instance is assigned.

Public property Copies: Integer;

Specifies the number of copies to print.

Public property CurrentCopy: Integer;

Returns the currently printed copy.

Public property CurrentPage: Integer;

Returns the currently printed page.

Public property CurrentScale: Double;

Returns the horizontal scale for the printed shape, without dimension.

Public property DesktopPixelsPerInchX: Integer;

Returns the amount of pixels per inch for the desktop device context's horizontal axis

Public property DesktopPixelsPerInchY: Integer;

Returns the amount of pixels per inch for the desktop device context's vertical axis

Public property EndPage: Integer;

Specifies last page printed if Range is eprRange.

Public property FooterSpace: Double;

Specifies the vertical space that should stay free for application specific footer. Value is given in Units.

Public property HeaderSpace: Double;

Specifies the vertical space that should stay free for application specific header. Value is given in Units.

Public property HorzPageCount: Integer;

Returns the maximum amount of pages for horizontal axis of the control.

Public property MarginBottom: Double;

Specifies the bottom margin. Value is given in Units.

Public property MarginLeft: Double;

Specifies the left margin. Value is given in Units.

Public property MarginRight: Double;

Specifies the right margin. Value is given in Units.

Public property MarginTop: Double;

Specifies the top margin. Value is given in Units.

Public property Options: TKPrintOptions;

Specifies the printing options.

Public property OutlineHeight: Integer;

Returns the printed shape height (maximum of all pages) in units depending on PrintingMapped..

Public property OutlineWidth: Integer;

Returns the printed shape width (maximum of all pages) in units depending on PrintingMapped..

Public property PageCount: Integer;

Returns the amount of all pages.

Public property PageHeight: Integer;

Returns the page height in printer device context's pixels.

Public property PageWidth: Integer;

Returns the page width in printer device context's pixels.

Public property PaintAreaHeight: Integer;

Returns the top paint area width on canvas in units depending on PrintingMapped.

Public property PaintAreaWidth: Integer;

Returns the top paint area width on canvas in units depending on PrintingMapped.

Public property Previewing: Boolean;

Returns True if painting to a TKPrintPreview.Canvas is active.

Public property PrinterFooterSpace: Integer;

Returns the footer space in printer device context's units.

Public property PrinterHeaderSpace: Integer;

Returns the header space in printer device context's units.

Public property PrinterMarginBottom: Integer;

Returns the bottom margin in printer device context's units.

Public property PrinterMarginLeft: Integer;

Returns the left margin in printer device context's units.

Public property PrinterMarginLeftMirrored: Integer;

Returns the left margin in printer device context's units with respect to current page.

Public property PrinterMarginRight: Integer;

Returns the right margin in printer device context's units.

Public property PrinterMarginRightMirrored: Integer;

Returns the left margin in printer device context's units with respect to current page.

Public property PrinterMarginTop: Integer;

Returns the top margin in printer device context's units.

Public property PrinterName: string;

Specifies the printer name.

Public property PrinterPixelsPerInchX: Integer;

Returns the amount of pixels per inch for the printer device context's horizontal axis

Public property PrinterPixelsPerInchY: Integer;

Returns the amount of pixels per inch for the printer device context's vertical axis

Public property PrintingMapped: Boolean;

Specifies the units for printing the control's shape and OutlineX properties. If True, those extents are given in printer device context's pixels, otherwise in desktop device context's pixels. It can be adjusted by the descendant in the AdjustPageSetup method.

Public property Range: TKPrintRange;

Specifies the printing range.

Public property Scale: Integer;

Specifies the requested scale for the printed shape, in percent. If epoFitToPage is specified in Options, this parameter is ignored.

Public property SelAvail: Boolean;

Returns True if the associated control has a selection.

Public property StartPage: Integer;

Specifies first page printed if Range is eprRange.

Public property Title: string;

Specifies the document title as it appears in printer manager.

Public property Units: TKPrintUnits;

Specifies the units for print margins.

Public property VertPageCount: Integer;

Returns the maximum amount of pages for vertical axis of the control.


KHexEditor help: KControls: Class TKPrintPreview

Class TKPrintPreview

Unit

KControls

Declaration

type TKPrintPreview = class(TKCustomControl)

Description

Print preview control for the TKCustomControl component

Hierarchy

TKCustomControl

Methods

Overview

Public | constructor Create(AOwner: TComponent); override;
Public | destructor Destroy; override;
Protected | procedure BeginScrollWindow;
Protected | procedure Changed;
Protected | procedure CreateParams(var Params: TCreateParams); override;
Protected | function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;
Protected | procedure EndScrollWindow;
Public | procedure FirstPage;
Protected | function GetPageRect: TRect;
Protected | procedure KeyDown(var Key: Word; Shift: TShiftState); override;
Public | procedure LastPage;
Protected | procedure ModifyScrollBar(ScrollBar, ScrollCode, Delta: Integer);
Protected | procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
Protected | procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
Protected | procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
Public | procedure NextPage;
Protected | procedure Notification(AComponent: TComponent; Operation: TOperation); override;
Protected | procedure Paint; override;
Public | procedure PreviousPage;
Protected | procedure SafeSetFocus;
Protected | function SetMouseCursor(X, Y: Integer): Boolean; override;
Public | procedure UpdatePreview;
Protected | procedure UpdateScrollRange;
Protected | procedure UpdateSize; override;

Description

Public constructor Create(AOwner: TComponent); override;

Performs necessary initializations - default values to properties.

Public destructor Destroy; override;

Destroy instance...

Protected procedure BeginScrollWindow;

Initializes a scroll message handling.

Protected procedure Changed;

Calls the OnChanged event.

Protected procedure CreateParams(var Params: TCreateParams); override;

Defines additional styles.

Protected function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;

Overriden method - handles mouse wheel messages.

Protected procedure EndScrollWindow;

Calls the ScrollWindowEx function to complete a scroll message.

Public procedure FirstPage;

Shows first page for the given range.

Protected function GetPageRect: TRect;

Returns current page rectangle inside of the window client area.

Protected procedure KeyDown(var Key: Word; Shift: TShiftState); override;

Processes virtual key strokes.

Public procedure LastPage;

Shows last page for the given range.

Protected procedure ModifyScrollBar(ScrollBar, ScrollCode, Delta: Integer);

Processes scrollbar messages.

    Parameters:
  • ScrollBar - scrollbar type from OS
  • ScrollCode - scrollbar action from OS
  • Delta - scrollbar position change

Protected procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;

Initializes drag&scroll functionality.

Protected procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;

Performs drag&scroll functionality.

Protected procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;

Finalizes drag&scroll functionality.

Public procedure NextPage;

Shows next page.

Protected procedure Notification(AComponent: TComponent; Operation: TOperation); override;

Notifies about associated TKCustomControl control removal.

Protected procedure Paint; override;

Paints paper and control shape.

Public procedure PreviousPage;

Shows previous page.

Protected procedure SafeSetFocus;

Grants the input focus to the control when possible and the control has had none before.

Protected function SetMouseCursor(X, Y: Integer): Boolean; override;

Updates mouse cursor.

Public procedure UpdatePreview;

Updates the preview.

Protected procedure UpdateScrollRange;

Updates page sizes and scrollbar ranges.

Protected procedure UpdateSize; override;

Updates the control size.

Properties

Overview

Published | property Align;
Published | property Anchors;
Published | property BorderStyle;
Published | property BorderWidth;
Published | property Colors: TKPreviewColors;
Published | property Constraints;
Published | property Control: TKCustomControl;
Public | property CurrentScale: Integer;
Published | property DragCursor;
Published | property DragKind;
Published | property DragMode;
Public | property EndPage: Integer;
Published | property OnChanged: TKPreviewChangedEvent;
Published | property OnClick;
Published | property OnContextPopup;
Published | property OnDblClick;
Published | property OnDockDrop;
Published | property OnDockOver;
Published | property OnDragDrop;
Published | property OnDragOver;
Published | property OnEndDock;
Published | property OnEndDrag;
Published | property OnEnter;
Published | property OnExit;
Published | property OnGetSiteInfo;
Published | property OnKeyDown;
Published | property OnKeyPress;
Published | property OnKeyUp;
Published | property OnMouseDown;
Published | property OnMouseMove;
Published | property OnMouseUp;
Published | property OnMouseWheel;
Published | property OnMouseWheelDown;
Published | property OnMouseWheelUp;
Published | property OnResize;
Published | property OnStartDock;
Published | property OnStartDrag;
Published | property OnUnDock;
Published | property Page: Integer;
Public | property PageRect: TRect;
Published | property ParentShowHint;
Published | property PopupMenu;
Published | property Scale: Integer;
Published | property ScaleMode: TKPreviewScaleMode;
Published | property ShowHint;
Public | property StartPage: Integer;
Published | property TabOrder;
Published | property TabStop;
Published | property Visible;

Description

Published property Align;

Inherited property - see Delphi help.

Published property Anchors;

Inherited property - see Delphi help.

Published property BorderStyle;

See TKCustomControl.BorderStyle for details.

Published property BorderWidth;

Inherited property - see Delphi help.

Published property Colors: TKPreviewColors;

Specifies all colors used by TKPrintPreview's default painting.

Published property Constraints;

Inherited property - see Delphi help.

Published property Control: TKCustomControl;

Specifies the associated control.

Public property CurrentScale: Integer;

Returns the page scaling with regard to the ScaleMode property.

Published property DragCursor;

Inherited property - see Delphi help.

Published property DragKind;

Inherited property - see Delphi help.

Published property DragMode;

Inherited property - see Delphi help.

Public property EndPage: Integer;

Returns the last page for the given range.

Published property OnChanged: TKPreviewChangedEvent;

Called whenever print preview is updated.

Published property OnClick;

Inherited property - see Delphi help.

Published property OnContextPopup;

Inherited property - see Delphi help.

Published property OnDblClick;

Inherited property - see Delphi help.

Published property OnDockDrop;

Inherited property - see Delphi help.

Published property OnDockOver;

Inherited property - see Delphi help.

Published property OnDragDrop;

Inherited property - see Delphi help.

Published property OnDragOver;

Inherited property - see Delphi help.

Published property OnEndDock;

Inherited property - see Delphi help.

Published property OnEndDrag;

Inherited property - see Delphi help.

Published property OnEnter;

Inherited property - see Delphi help.

Published property OnExit;

Inherited property - see Delphi help.

Published property OnGetSiteInfo;

Inherited property - see Delphi help.

Published property OnKeyDown;

Inherited property - see Delphi help.

Published property OnKeyPress;

Inherited property - see Delphi help.

Published property OnKeyUp;

Inherited property - see Delphi help.

Published property OnMouseDown;

Inherited property - see Delphi help.

Published property OnMouseMove;

Inherited property - see Delphi help.

Published property OnMouseUp;

Inherited property - see Delphi help.

Published property OnMouseWheel;

Inherited property - see Delphi help.

Published property OnMouseWheelDown;

Inherited property - see Delphi help.

Published property OnMouseWheelUp;

Inherited property - see Delphi help.

Published property OnResize;

Inherited property - see Delphi help.

Published property OnStartDock;

Inherited property - see Delphi help.

Published property OnStartDrag;

Inherited property - see Delphi help.

Published property OnUnDock;

Inherited property - see Delphi help.

Published property Page: Integer;

Specifies the currently displayed page.

Public property PageRect: TRect;

Returns the current page area rectangle in desktop pixels.

Published property ParentShowHint;

Inherited property - see Delphi help.

Published property PopupMenu;

Inherited property - see Delphi help.

Published property Scale: Integer;

Specifies the user defined page scale - i.e. when ScaleMode = smScale.

Published property ScaleMode: TKPreviewScaleMode;

Specifies the scale mode to display and scroll previewed pages.

Published property ShowHint;

Inherited property - see Delphi help.

Public property StartPage: Integer;

Returns the first page for the given range.

Published property TabOrder;

Inherited property - see Delphi help.

Published property TabStop;

Inherited property - see Delphi help.

Published property Visible;

Inherited property - see Delphi help.


KHexEditor help: KDialogs

Unit KDialogs

Description

This unit contains all dialogs supplied with KControls.

This unit implements all dialogs supplied with KControls Development Suite. Copyright © 2009 Tomas Krysl (tk@tkweb.eu)

License:
This code is distributed as a freeware. You are free to use it as part of your application for any purpose including freeware, commercial and shareware applications. The origin of this source code must not be misrepresented; you must not claim your authorship. You may modify this code solely for your own purpose. Please feel free to contact the author if you think your changes might be useful for other users. You may distribute only the original package. The author accepts no liability for any damage that may result from using this code.

Classes, Interfaces and Objects

Name | Description
Class TKPrintPreviewDialog | Encapsulates the print preview dialog
Class TKPrintSetupDialog | Encapsulates the print preview dialog

Author

Tomas Krysl (tk@tkweb.eu)

Created

18 Sep 2009

Last Modified

14 Oct 2009


KHexEditor help: KDialogs: Class TKPrintPreviewDialog

Class TKPrintPreviewDialog

Unit

KDialogs

Declaration

type TKPrintPreviewDialog = class(TComponent)

Description

Encapsulates the print preview dialog

Methods

Overview

Public | constructor Create(AOwner: TComponent); override;
Public | function Execute: Boolean;
Public | procedure Show;

Description

Public constructor Create(AOwner: TComponent); override;

Creates the instance. Assigns default values to properties.

Public function Execute: Boolean;

Shows the dialog as modal dialog.

Public procedure Show;

Shows the dialog.

Properties

Overview

Published | property Control: TKCustomControl;
Public | property PrintPreviewForm: TKPrintPreviewForm;

Description

Published property Control: TKCustomControl;

Specifies the associated control.

Public property PrintPreviewForm: TKPrintPreviewForm;

Specifies the associated preview form.


KHexEditor help: KDialogs: Class TKPrintSetupDialog

Class TKPrintSetupDialog

Unit

KDialogs

Declaration

type TKPrintSetupDialog = class(TComponent)

Description

Encapsulates the print preview dialog

Methods

Overview

Public | constructor Create(AOwner: TComponent); override;
Public | function Execute: Boolean;

Description

Public constructor Create(AOwner: TComponent); override;

Creates the instance. Assigns default values to properties.

Public function Execute: Boolean;

Shows the dialog as modal dialog.

Properties

Overview

Published | property Control: TKCustomControl;
Published | property PreviewDialog: TKPrintPreviewDialog;
Published | property SelAvail: Boolean;

Description

Published property Control: TKCustomControl;

Specifies the associated control.

Published property PreviewDialog: TKPrintPreviewDialog;

Specifies the preview dialog for the Preview... button. If not specified, the print setup dialog creates a new one.

Published property SelAvail: Boolean;

If True, the Selection Only option will be checked (if selection is available for the control).


KHexEditor help: KFunctions

Unit KFunctions

Description

This unit contains miscellaneous supporting functions

Copyright © 2001 Tomas Krysl (tk@tkweb.eu)

License:
This code is distributed as a freeware. You are free to use it as part of your application for any purpose including freeware, commercial and shareware applications. The origin of this source code must not be misrepresented; you must not claim your authorship. You may modify this code solely for your own purpose. Please feel free to contact the author if you think your changes might be useful for other users. You may distribute only the original package. The author accepts no liability for any damage that may result from using this code.

Functions and Procedures

Overview

function AdjustDecimalSeparator(const S: string): string;
function AnsiStringToWideChar(const Text: AnsiString; CodePage: Cardinal = CP_ACP): PWideChar;
function AsciiToInt(S: string; Digits: Integer): Int64;
function BCDToInt(Value: Cardinal): Cardinal;
function BinStrToInt(S: string; Digits: Byte; Signed: Boolean; var Code: Integer): Int64;
procedure CallTrackMouseEvent(Control: TWinControl; var Status: Boolean);
function CharInSetEx(AChar: WideChar; const ASet: TKSysCharSet): Boolean; overload;
function CharInSetEx(AChar: AnsiChar; const ASet: TKSysCharSet): Boolean; overload;
function CompareIntegers(I1, I2: Integer): Integer;
function CompareWideChars(W1, W2: PWideChar): Integer;
function CompareWideStrings(W1, W2: WideString): Integer;
function DecStrToInt(S: string; var Code: Integer): Int64;
function DivDown(Dividend, Divisor: Integer): Integer;
function DivUp(Dividend, Divisor: Integer): Integer;
procedure Error(const Msg: string);
procedure Exchange(var Value1, Value2: Extended); overload;
procedure Exchange(var Value1, Value2: Double); overload;
procedure Exchange(var Value1, Value2: Char); overload;
procedure Exchange(var Value1, Value2: Int64); overload;
procedure Exchange(var Value1, Value2: Single); overload;
procedure Exchange(var Value1, Value2: SmallInt); overload;
procedure Exchange(var Value1, Value2: ShortInt); overload;
procedure Exchange(var Value1, Value2: Integer); overload;
procedure Exchange(var Value1, Value2: Cardinal); overload;
procedure Exchange(var Value1, Value2: Word); overload;
procedure Exchange(var Value1, Value2: Byte); overload;
function FillMessage(Msg: Cardinal; WParam: WPARAM; LParam: LPARAM): TLMessage;
function FormatCurrency(Value: Currency; const AFormat: TKCurrencyFormat): WideString;
function GetAppVersion(const ALibName: string; var MajorVersion, MinorVersion, BuildNumber, RevisionNumber: Word): Boolean;
function GetControlText(Value: TWinControl): WideString;
function GetShiftState: TShiftState;
function HexStrToInt(S: string; Digits: Byte; Signed: Boolean; var Code: Integer): Int64;
function IntPowerInt(Value: Int64; Exponent: Integer): Int64;
function IntToAscii(Value: Int64; Digits: Integer): string;
function IntToBCD(Value: Cardinal): Cardinal;
function IntToBinStr(Value: Int64; Digits: Byte; const Suffix: string): string;
function IntToDecStr(Value: Int64): string;
function IntToHexStr(Value: Int64; Digits: Byte; const Prefix, Suffix: string; UseLowerCase: Boolean): string;
function MinMax(Value, Min, Max: Double): Double; overload;
function MinMax(Value, Min, Max: Extended): Extended; overload;
function MinMax(Value, Min, Max: Int64): Int64; overload;
function MinMax(Value, Min, Max: Single): Single; overload;
function MinMax(Value, Min, Max: ShortInt): ShortInt; overload;
function MinMax(Value, Min, Max: SmallInt): SmallInt; overload;
function MinMax(Value, Min, Max: Integer): Integer; overload;
procedure SetControlClipRect(AControl: TWinControl; const ARect: TRect);
procedure SetControlText(Value: TWinControl; const Text: WideString);
function StringCharBegin(const AText: WideString; Index: Integer): Integer;
function StringLength(const AText: WideString): Integer;
function StringNextCharIndex(const AText: WideString; Index: Integer): Integer;
function StrNextCharIndex(AText: PWideChar; Index: Integer): Integer;
procedure TrimWhiteSpaces(var AText: PWideChar; var ALen: Integer; const ASet: TKSysCharSet); overload;
procedure TrimWhiteSpaces(var AText: WideString; const ASet: TKSysCharSet); overload;
function WideCharToAnsiString(Text: PWideChar; CodePage: Cardinal = CP_ACP): AnsiString;

Description

function AdjustDecimalSeparator(const S: string): string;

Replaces possible decimal separators in S with DecimalSeparator variable.

function AnsiStringToWideChar(const Text: AnsiString; CodePage: Cardinal = CP_ACP): PWideChar;

Converts an AnsiString into a PWideChar string. If CodePage is not set the current system code page for ANSI-UTFx translations will be used.

function AsciiToInt(S: string; Digits: Integer): Int64;

Converts a binary string into integer with custom alignment (given by Digits).

function BCDToInt(Value: Cardinal): Cardinal;

Converts a BCD number into integer value.

function BinStrToInt(S: string; Digits: Byte; Signed: Boolean; var Code: Integer): Int64;

Converts a binary digit string into integer with custom alignment (given by Digits) and sign of a value represented by the string (given by Signed). Code returns either zero for a successful conversion or the position of first bad character.

procedure CallTrackMouseEvent(Control: TWinControl; var Status: Boolean);

Under Windows this function calls the WinAPI TrackMouseEvent. Under other OSes the implementation is still missing.

function CharInSetEx(AChar: WideChar; const ASet: TKSysCharSet): Boolean; overload;

Compiler independent Delphi2009-like CharInSet function for Unicode characters.

function CharInSetEx(AChar: AnsiChar; const ASet: TKSysCharSet): Boolean; overload;

Compiler independent Delphi2009-like CharInSet function for ANSI characters.

function CompareIntegers(I1, I2: Integer): Integer;

Compares two Integers. Returns 1 if I1 > I2, -1 if I1 < I2 and 0 if I1 = I2.

function CompareWideChars(W1, W2: PWideChar): Integer;

Compares two PWideChar strings. Returns 1 if W1 > W2, -1 if W1 < W2 and 0 if W1 = W2. The strings will be compared using the default user locale unless another locale has been specified in Locale.

function CompareWideStrings(W1, W2: WideString): Integer;

Compares two WideString strings. Returns 1 if W1 > W2, -1 if W1 < W2 and 0 if W1 = W2. The strings will be compared using the default user locale unless another locale has been specified in Locale.

function DecStrToInt(S: string; var Code: Integer): Int64;

Converts a decimal digit string into integer. Code returns either zero for a successful conversion or the position of first bad character. Equals to Val.

function DivDown(Dividend, Divisor: Integer): Integer;

Performs integer division. If there is a nonzero remainder, the result will be decremented.

function DivUp(Dividend, Divisor: Integer): Integer;

Performs integer division. If there is a nonzero remainder, the result will be incremented.

procedure Error(const Msg: string);

Raises a general exception with associated message Msg.

procedure Exchange(var Value1, Value2: Extended); overload;

Swaps values of two Extended variables.

procedure Exchange(var Value1, Value2: Double); overload;

Swaps values of two Double variables.

procedure Exchange(var Value1, Value2: Char); overload;

Swaps values of two Char variables.

procedure Exchange(var Value1, Value2: Int64); overload;

Swaps values of two Int64 variables.

procedure Exchange(var Value1, Value2: Single); overload;

Swaps values of two Single variables.

procedure Exchange(var Value1, Value2: SmallInt); overload;

Swaps values of two SmallInt variables.

procedure Exchange(var Value1, Value2: ShortInt); overload;

Swaps values of two ShortInt variables.

procedure Exchange(var Value1, Value2: Integer); overload;

Swaps values of two Integer variables.

procedure Exchange(var Value1, Value2: Cardinal); overload;

Swaps values of two Cardinal variables.

procedure Exchange(var Value1, Value2: Word); overload;

Swaps values of two Word variables.

procedure Exchange(var Value1, Value2: Byte); overload;

Swaps values of two Byte variables.

function FillMessage(Msg: Cardinal; WParam: WPARAM; LParam: LPARAM): TLMessage;

Fills the message record.

function FormatCurrency(Value: Currency; const AFormat: TKCurrencyFormat): WideString;

Formats the given currency value with to specified parameters. Not thread safe.

function GetAppVersion(const ALibName: string; var MajorVersion, MinorVersion, BuildNumber, RevisionNumber: Word): Boolean;

Returns the module version for given module. Works under WinX only.

function GetControlText(Value: TWinControl): WideString;

Returns the Text property of any TWinControl instance as WideString (up to Delphi 2007) or string (Delphi 2009, Lazarus).

function GetShiftState: TShiftState;

Returns current status of Shift, Alt and Ctrl keys.

function HexStrToInt(S: string; Digits: Byte; Signed: Boolean; var Code: Integer): Int64;

Converts a hexadecimal digit string into integer with custom alignment (given by Digits) and sign of a value represented by the string (given by Signed). Code returns either zero for a successful conversion or the position of first bad character.

function IntPowerInt(Value: Int64; Exponent: Integer): Int64;

function IntToAscii(Value: Int64; Digits: Integer): string;

Converts an integer into binary string with custom alignment (given by Digits).

function IntToBCD(Value: Cardinal): Cardinal;

Converts an integer value into BCD number.

function IntToBinStr(Value: Int64; Digits: Byte; const Suffix: string): string;

Converts an integer into binary digit string with custom alignment (given by Digits) and suffix.

function IntToDecStr(Value: Int64): string;

Converts an integer into decimal digit string. Equals to IntToStr.

function IntToHexStr(Value: Int64; Digits: Byte; const Prefix, Suffix: string; UseLowerCase: Boolean): string;

Converts an integer into hexadecimal digit string with custom alignment (given by Digits), prefix and suffix. Digits represented by alphabetical characters can be either in lower or upper case.

function MinMax(Value, Min, Max: Double): Double; overload;

Returns a clipped Double value so that it lies between Min and Max

function MinMax(Value, Min, Max: Extended): Extended; overload;

Returns a clipped Extended value so that it lies between Min and Max

function MinMax(Value, Min, Max: Int64): Int64; overload;

Returns a clipped Int64 value so that it lies between Min and Max

function MinMax(Value, Min, Max: Single): Single; overload;

Returns a clipped Single value so that it lies between Min and Max

function MinMax(Value, Min, Max: ShortInt): ShortInt; overload;

Returns a clipped ShortInt value so that it lies between Min and Max

function MinMax(Value, Min, Max: SmallInt): SmallInt; overload;

Returns a clipped SmallInt value so that it lies between Min and Max

function MinMax(Value, Min, Max: Integer): Integer; overload;

Returns a clipped Integer value so that it lies between Min and Max

procedure SetControlClipRect(AControl: TWinControl; const ARect: TRect);

Under Windows this function calls the WinAPI SetWindowRgn. Under other OSes the implementation is still missing.

procedure SetControlText(Value: TWinControl; const Text: WideString);

Modifies the Text property of any TWinControl instance. The value is given as WideString (up to Delphi 2007) or string (Delphi 2009, Lazarus).

function StringCharBegin(const AText: WideString; Index: Integer): Integer;

Returns the index for given string where character at given index begins. Takes MBCS (UTF8 in Lazarus) into account.

function StringLength(const AText: WideString): Integer;

Returns the number of characters in a string. Under Delphi it equals Length, under Lazarus it equals UTF8Length.

function StringNextCharIndex(const AText: WideString; Index: Integer): Integer;

Returns next character index for given string and character index. Takes MBCS (UTF8 in Lazarus) into account.

function StrNextCharIndex(AText: PWideChar; Index: Integer): Integer;

Returns next character index for given null terminated string and character index. Takes MBCS (UTF8 in Lazarus) into account.

procedure TrimWhiteSpaces(var AText: PWideChar; var ALen: Integer; const ASet: TKSysCharSet); overload;

Trims characters specified by ASet from the beginning and end of AText. New text length is returned by ALen.

procedure TrimWhiteSpaces(var AText: WideString; const ASet: TKSysCharSet); overload;

Trims characters specified by ASet from the beginning and end of AText.

function WideCharToAnsiString(Text: PWideChar; CodePage: Cardinal = CP_ACP): AnsiString;

Converts a PWideChar string into AnsiString. If CodePage is not set the current system code page for ANSI-UTFx translations will be used.

Types

Overview

PBytes = ^TBytes;
PCardinals = ^TCardinals;
PChars = ^TChars;
PDataSize = ^TDataSize;
PDoubles = ^TDoubles;
PExtendeds = ^TExtendeds;
PInt64s = ^TInt64s;
PIntegers = ^TIntegers;
PLongInts = ^TLongInts;
PLongWords = ^TLongWords;
PShortInts = ^TShortInts;
PSingles = ^TSingles;
PSmallInts = ^TSmallInts;
PWords = ^TWords;
TBytes = array[0..MaxInt div SizeOf(Byte) - 1] of Byte;
TCardinals = array[0..MaxInt div SizeOf(Cardinal) - 1] of Cardinal;
TChars = array[0..MaxInt div SizeOf(Char) - 1] of Char;
TDataSize = record Data: Pointer; Size: Integer; end;
TDoubles = array[0..MaxInt div SizeOf(Double) - 1] of Double;
TDynBytes = array of Byte;
TDynCardinals = array of Cardinal;
TDynChars = array of Char;
TDynDoubles = array of Double;
TDynExtendeds = array of Extended;
TDynInt64s = array of Int64;
TDynIntegers = array of Integer;
TDynLongInts = array of LongInt;
TDynLongWords = array of LongWord;
TDynShortInts = array of ShortInt;
TDynSingles = array of Single;
TDynSmallInts = array of SmallInt;
TDynWords = array of Word;
TExtendeds = array[0..MaxInt div SizeOf(Extended) - 1] of Extended;
TInt64s = array[0..MaxInt div SizeOf(Int64) - 1] of Int64;
TIntegers = array[0..MaxInt div SizeOf(Integer) - 1] of Integer;
TKCurrencyFormat = record CurrencyFormat, CurrencyDecimals: Byte; CurrencyString: WideString; DecimalSep: Char; ThousandSep: Char; UseThousandSep: Boolean; end;
TKSysCharSet = set of AnsiChar;
TLongInts = array[0..MaxInt div SizeOf(LongInt) - 1] of LongInt;
TLongWords = array[0..MaxInt div SizeOf(LongWord) - 1] of LongWord;
TShortInts = array[0..MaxInt div SizeOf(ShortInt) - 1] of ShortInt;
TSingles = array[0..MaxInt div SizeOf(Single) - 1] of Single;
TSmallInts = array[0..MaxInt div SizeOf(SmallInt) - 1] of SmallInt;
TWords = array[0..MaxInt div SizeOf(Word) - 1] of Word;

Description

PBytes = ^TBytes;

Pointer for TBytes.

PCardinals = ^TCardinals;

Pointer for TCardinals.

PChars = ^TChars;

Pointer for TChars.

PDataSize = ^TDataSize;

Pointer for TDataSize

PDoubles = ^TDoubles;

Pointer for TDoubles.

PExtendeds = ^TExtendeds;

Pointer for TExtendeds.

PInt64s = ^TInt64s;

Pointer for TInt64s.

PIntegers = ^TIntegers;

Pointer for TIntegers.

PLongInts = ^TLongInts;

Pointer for TLongInts.

PLongWords = ^TLongWords;

Pointer for TLongWords.

PShortInts = ^TShortInts;

Pointer for TShortInts.

PSingles = ^TSingles;

Pointer for TSingles.

PSmallInts = ^TSmallInts;

Pointer for TSmallInts.

PWords = ^TWords;

Pointer for TWords.

TBytes = array[0..MaxInt div SizeOf(Byte) - 1] of Byte;

Static array for Byte.

TCardinals = array[0..MaxInt div SizeOf(Cardinal) - 1] of Cardinal;

Static array for Cardinal.

TChars = array[0..MaxInt div SizeOf(Char) - 1] of Char;

Static array for Char.

TDataSize = record Data: Pointer; Size: Integer; end;

Useful structure to handle general data and size as a single item

TDoubles = array[0..MaxInt div SizeOf(Double) - 1] of Double;

Static array for Double.

TDynBytes = array of Byte;

Dynamic array for Byte.

TDynCardinals = array of Cardinal;

Dynamic array for Cardinal.

TDynChars = array of Char;

Dynamic array for Char.

TDynDoubles = array of Double;

Dynamic array for Double.

TDynExtendeds = array of Extended;

Dynamic array for Extended.

TDynInt64s = array of Int64;

Dynamic array for Int64.

TDynIntegers = array of Integer;

Dynamic array for Integer.

TDynLongInts = array of LongInt;

Dynamic array for LongInt.

TDynLongWords = array of LongWord;

Dynamic array for LongWord.

TDynShortInts = array of ShortInt;

Dynamic array for ShortInt.

TDynSingles = array of Single;

Dynamic array for Single.

TDynSmallInts = array of SmallInt;

Dynamic array for SmallInt.

TDynWords = array of Word;

Dynamic array for Word.

TExtendeds = array[0..MaxInt div SizeOf(Extended) - 1] of Extended;

Static array for Extended.

TInt64s = array[0..MaxInt div SizeOf(Int64) - 1] of Int64;

Static array for Int64.

TIntegers = array[0..MaxInt div SizeOf(Integer) - 1] of Integer;

Static array for Integer.

TKCurrencyFormat = record CurrencyFormat, CurrencyDecimals: Byte; CurrencyString: WideString; DecimalSep: Char; ThousandSep: Char; UseThousandSep: Boolean; end;

Defines a currency format settings for FormatCurrency.

TKSysCharSet = set of AnsiChar;

Set type for CharInSetEx.

TLongInts = array[0..MaxInt div SizeOf(LongInt) - 1] of LongInt;

Static array for LongInt.

TLongWords = array[0..MaxInt div SizeOf(LongWord) - 1] of LongWord;

Static array for LongWord.

TShortInts = array[0..MaxInt div SizeOf(ShortInt) - 1] of ShortInt;

Static array for ShortInt.

TSingles = array[0..MaxInt div SizeOf(Single) - 1] of Single;

Static array for Single.

TSmallInts = array[0..MaxInt div SizeOf(SmallInt) - 1] of SmallInt;

Static array for SmallInt.

TWords = array[0..MaxInt div SizeOf(Word) - 1] of Word;

Static array for Word.

Constants

Overview

cCheckBoxFrameSize = 13;
cCR = #10;
cEllipsis = '...';
cLF = #13;
cLineBreaks = [#10, #13];
crDragHandFree = TCursor(103);
crDragHandGrip = TCursor(104);
crHResize = TCursor(101);
crVResize = TCursor(102);
cWordBreaks = [#0, #9, #32];
KM_BASE = LM_USER + 1024;
KM_LATEUPDATE = KM_BASE + 1;

Description

cCheckBoxFrameSize = 13;

Checkbox frame size in logical screen units.

cCR = #10;

Carriage return character.

cEllipsis = '...';

Text ellipsis string.

cLF = #13;

Line feed character.

cLineBreaks = [#10, #13];

Set of line break characters.

crDragHandFree = TCursor(103);

Constant for uncaptured dragging cursor.

crDragHandGrip = TCursor(104);

Constant for captured dragging cursor.

crHResize = TCursor(101);

Constant for horizontal resize cursor.

crVResize = TCursor(102);

Constant for vertical resize cursor.

cWordBreaks = [#0, #9, #32];

Set of word break characters.

KM_BASE = LM_USER + 1024;

Base for custom messages used by KControls suite.

KM_LATEUPDATE = KM_BASE + 1;

Custom message.

Author

Tomas Krysl (tk@tkweb.eu)

Created

20 Oct 2001

Last Modified

20 Jun 2010


KHexEditor help: KGraphics

Unit KGraphics

Description

This unit contains advanced graphic functions used by KControls suite.

Copyright © 2004 Tomas Krysl (tk@tkweb.eu)

License:
This code is distributed as a freeware. You are free to use it as part of your application for any purpose including freeware, commercial and shareware applications. The origin of this source code must not be misrepresented; you must not claim your authorship. You may modify this code solely for your own purpose. Please feel free to contact the author if you think your changes might be useful for other users. You may distribute only the original package. The author accepts no liability for any damage that may result from using this code.

Classes, Interfaces and Objects

Name | Description
Class TKAlphaBitmap |
Class TKDragWindow | Encapsulates the drag window
Class TKGraphicHint |
Class TKHintWindow | Base class for KControls hints
Class TKTextHint | Hint window to display formatted text

Functions and Procedures

Overview

procedure BlendLine(Src, Dest: PKColorRecs; Count: Integer);
function BrightColor(Color: TColor; Percent: Single; Mode: TKBrightMode = bsAbsolute): TColor;
procedure CanvasGetScale(ACanvas: TCanvas; out MulX, MulY, DivX, DivY: Integer);
procedure CanvasResetScale(ACanvas: TCanvas);
function CanvasScaled(ACanvas: TCanvas): Boolean;
procedure CanvasSetOffset(ACanvas: TCanvas; OfsX, OfsY: Integer);
procedure CanvasSetScale(ACanvas: TCanvas; MulX, MulY, DivX, DivY: Integer);
function ColorToGrayScale(Color: TColor): TColor;
procedure CopyBitmap(DestDC: HDC; DestRect: TRect; SrcDC: HDC; SrcX, SrcY: Integer);
function CreateEmptyRgn: HRGN;
procedure DrawAlignedText(Canvas: TCanvas; var ARect: TRect; HAlign: TKHAlign; VAlign: TKVAlign; HPadding, VPadding: Integer; const AText: WideString; BackColor: TColor = clWhite; Attributes: TKTextAttributes = []);
procedure DrawEdges(Canvas: TCanvas; const R: TRect; HighlightColor, ShadowColor: TColor; Flags: Cardinal);
procedure DrawFilledRectangle(Canvas: TCanvas; const ARect: TRect; BackColor: TColor);
procedure ExcludeShapeFromBaseRect(var BaseRect: TRect; ShapeWidth, ShapeHeight: Integer; HAlign: TKHAlign; VAlign: TKVAlign; HPadding, VPadding: Integer; StretchMode: TKStretchMode; out Bounds, Interior: TRect);
function ExtSelectClipRect(DC: HDC; ARect: TRect; Mode: Integer; out PrevRgn: HRGN): Boolean;
function ExtSelectClipRectEx(DC: HDC; ARect: TRect; Mode: Integer; CurRgn, PrevRgn: HRGN): Boolean;
procedure FillAroundRect(ACanvas: TCanvas; const Boundary, Interior: TRect; BackColor: TColor);
procedure FinalizePrevRgn(DC: HDC; ARgn: HRGN);
function GDICheck(Value: Integer): Integer;
function GetFontHeight(DC: HDC): Integer;
function ImageByType(const Header: TKImageHeaderString): TGraphic;
function IntersectClipRectIndirect(DC: HDC; ARect: TRect): Boolean;
function IsBrightColor(Color: TColor): Boolean;
procedure LoadCustomCursor(Cursor: TCursor; const ResName: string);
function MakeColorRec(R, G, B, A: Byte): TKColorRec;
function PixelFormatFromBpp(Bpp: Cardinal): TPixelFormat;
function RectInRegion(Rgn: HRGN; ARect: TRect): Boolean;
procedure SafeStretchDraw(ACanvas: TCanvas; ARect: TRect; AGraphic: TGraphic; ABackColor: TColor = clWhite);
procedure SelectClipRect(DC: HDC; const ARect: TRect);
procedure StretchBitmap(DestDC: HDC; DestRect: TRect; SrcDC: HDC; SrcRect: TRect);
function SwitchRGBToBGR(Value: TColor): TColor;
procedure TranslateRectToDevice(DC: HDC; var ARect: TRect);

Description

procedure BlendLine(Src, Dest: PKColorRecs; Count: Integer);

Draws Src to Dest with per pixel weighting by alpha channel saved in Src.

function BrightColor(Color: TColor; Percent: Single; Mode: TKBrightMode = bsAbsolute): TColor;

Calculates a brighter color of given color based on the HSL color space.

    Parameters:
  • Color - input color.
  • Percent - percentage of luminosity to bright the color (0 to 1).
  • Mode - identifies how the Percent parameter should be interpreted.

procedure CanvasGetScale(ACanvas: TCanvas; out MulX, MulY, DivX, DivY: Integer);

Returns current canvas window/wiewport scaling.

procedure CanvasResetScale(ACanvas: TCanvas);

Selects the default window/wiewport scaling to given canvas for both axes.

function CanvasScaled(ACanvas: TCanvas): Boolean;

Returns True if the ACanvas's device context has been mapped to anything else than MM_TEXT.

procedure CanvasSetOffset(ACanvas: TCanvas; OfsX, OfsY: Integer);

Selects the wiewport offset to given canvas for both axes.

procedure CanvasSetScale(ACanvas: TCanvas; MulX, MulY, DivX, DivY: Integer);

Selects the window/wiewport scaling to given canvas for both axes.

function ColorToGrayScale(Color: TColor): TColor;

Makes a grayscale representation of the given color.

procedure CopyBitmap(DestDC: HDC; DestRect: TRect; SrcDC: HDC; SrcX, SrcY: Integer);

Calls BitBlt.

function CreateEmptyRgn: HRGN;

Creates an empty rectangular region.

procedure DrawAlignedText(Canvas: TCanvas; var ARect: TRect; HAlign: TKHAlign; VAlign: TKVAlign; HPadding, VPadding: Integer; const AText: WideString; BackColor: TColor = clWhite; Attributes: TKTextAttributes = []);

Draws Text to the Canvas at location given by ARect. HAlign and VAlign specify horizontal resp. vertical alignment of the text within ARect. HPadding and VPadding specify horizontal (both on left and right side) and vertical (both on top and bottom side) padding of the Text from ARect. BackColor specifies the fill color for brush gaps if a non solid Brush is defined in Canvas. Attributes specift various text output attributes.

procedure DrawEdges(Canvas: TCanvas; const R: TRect; HighlightColor, ShadowColor: TColor; Flags: Cardinal);

Simulates WinAPI DrawEdge with customizable colors.

procedure DrawFilledRectangle(Canvas: TCanvas; const ARect: TRect; BackColor: TColor);

Draws a rectangle to Canvas. The rectangle coordinates are given by Rect. The rectangle is filled by Brush. If Brush is not solid, its gaps are filled with BackColor. If BackColor is clNone these gaps are not filled and the Brush appears transparent.

procedure ExcludeShapeFromBaseRect(var BaseRect: TRect; ShapeWidth, ShapeHeight: Integer; HAlign: TKHAlign; VAlign: TKVAlign; HPadding, VPadding: Integer; StretchMode: TKStretchMode; out Bounds, Interior: TRect);

This helper function excludes a rectangular area occupied by a shape from BaseRect and calculates the shape area rectangles Bounds and Interior. The shape area is specified by the shape extent (ShapeWidth and ShapeHeight), padding (HPadding and VPadding) and stretching mode (StretchMode). The returned Bounds includes (possibly stretched) shape + padding, and Interior includes only the (possibly stretched) shape. HAlign specifies the horizontal alignment of shape area within BaseRect. VAlign specifies the vertical alignment of shape area within BaseRect. The shape area is always excluded horizontally from BaseRect, as needed by cell data calculations in KGrid.

function ExtSelectClipRect(DC: HDC; ARect: TRect; Mode: Integer; out PrevRgn: HRGN): Boolean;

Selects ARect into device context. Returns previous clipping region.

function ExtSelectClipRectEx(DC: HDC; ARect: TRect; Mode: Integer; CurRgn, PrevRgn: HRGN): Boolean;

Selects ARect into device context. Combines with CurRgn and returns previous clipping region. Both regions have to be created first.

procedure FillAroundRect(ACanvas: TCanvas; const Boundary, Interior: TRect; BackColor: TColor);

Fills the area specified by the difference Boundary - Interior on ACanvas with current Brush. If Brush is not solid, its gaps are filled with BackColor. If BackColor is clNone these gaps are not filled and the Brush appears transparent.

procedure FinalizePrevRgn(DC: HDC; ARgn: HRGN);

Selects the region into given device context and deletes the region.

function GDICheck(Value: Integer): Integer;

Raises an exception if GDI resource has not been created.

function GetFontHeight(DC: HDC): Integer;

Determine the height (ascent + descent) of the font currently selected into given DC.

function ImageByType(const Header: TKImageHeaderString): TGraphic;

Creates a TGraphic instance according to the image file header. Currently supported images are BMP, PNG, MNG, JPG, ICO.

function IntersectClipRectIndirect(DC: HDC; ARect: TRect): Boolean;

Calls the IntersectClipRect function.

function IsBrightColor(Color: TColor): Boolean;

Determines if given color has lightness > 0.5.

procedure LoadCustomCursor(Cursor: TCursor; const ResName: string);

Loads a custom mouse cursor.

function MakeColorRec(R, G, B, A: Byte): TKColorRec;

Builds a TKColorRec structure.

function PixelFormatFromBpp(Bpp: Cardinal): TPixelFormat;

Returns a pixel format that matches Bpp.

function RectInRegion(Rgn: HRGN; ARect: TRect): Boolean;

In Lazarus this WinAPI function is missing.

procedure SafeStretchDraw(ACanvas: TCanvas; ARect: TRect; AGraphic: TGraphic; ABackColor: TColor = clWhite);

Paints an image so that it fits in ARect. Performs double buffering and fills the background with current brush for mapped device contexts.

procedure SelectClipRect(DC: HDC; const ARect: TRect);

Selects ARect as new clipping region into the device context.

procedure StretchBitmap(DestDC: HDC; DestRect: TRect; SrcDC: HDC; SrcRect: TRect);

Calls StretchBlt.

function SwitchRGBToBGR(Value: TColor): TColor;

Swaps the color format from RGB to BGR and vice versa.

procedure TranslateRectToDevice(DC: HDC; var ARect: TRect);

Subtracts the current device context offset to ARect.

Types

Overview

PKColorRec = ^TKColorRec;
PKColorRecs = ^TKColorRecs;
TKColorRec = packed record case Integer of 0: (R, G, B, A: Byte); 1: (Value: Cardinal); end;
TKColorRecs = array[0..MaxInt div SizeOf(TKColorRec) - 1] of TKColorRec;
TKDynColorRecs = array of TKColorRec;
TKImageHeaderString = string[10];
TKTextAttributes = set of TKTextAttribute;
TKTextHAlign = TKHAlign;
TKTextVAlign = TKVAlign;

Description

PKColorRec = ^TKColorRec;

Pointer to TKColorRec.

PKColorRecs = ^TKColorRecs;

Dynamic array for TKColorRecs.

TKColorRec = packed record case Integer of 0: (R, G, B, A: Byte); 1: (Value: Cardinal); end;

Declares RGB + Alpha channel color description allowing both to access single channels and the whole color item.

TKColorRecs = array[0..MaxInt div SizeOf(TKColorRec) - 1] of TKColorRec;

Dynamic array for TKColorRec.

TKDynColorRecs = array of TKColorRec;

Dynamic array for TKColorRec.

TKImageHeaderString = string[10];

String type for ImageByType function.

TKTextAttributes = set of TKTextAttribute;

Set type for TKTextAttribute enumeration.

TKTextHAlign = TKHAlign;

For backward compatibility.

TKTextVAlign = TKVAlign;

For backward compatibility.

Enumerations

TKBrightMode

Declares possible values for the Style parameter of the BrightColor function.

bsAbsolute | The Color will be brightened with Percent of its entire luminosity range.
bsOfBottom | The Color will be brightened with Percent of its current luminosity value.
bsOfTop | The Color will be brightened with Percent of the difference of its entire luminosity range and current luminosity value.
TKHAlign

Declares possible values for the HAlign parameter in the DrawAlignedText function.

halLeft | Text is aligned to the left border of a cell rectangle.
halCenter | Text is horizontally centered within the cell rectangle.
halRight | Text is aligned to the right border of a cell rectangle.
TKStretchMode

Declares possible values for the StretchMode parameter in the ExcludeShapeFromBaseRect function.

stmNone | Shape is not stretched.
stmZoomOutOnly | Shape is zoomed out.
stmZoomInOnly | Shape is zoomed in.
stmZoom | Shape is zoomed arbitrary.
TKTextAttribute

Declares possible values for the Attributes parameter in the DrawAlignedText function.

taCalcRect | Bounding rectangle is calculated. No text is drawn.
taClip | Text will be clipped within the given rectangle.
taEndEllipsis | Text will be drawn with end ellipsis if it does not fit within given width.
taFillRect | Given rectangle will be filled.
taFillText | Only yhe text within given rectangle will be filled.
taLineBreak | Text will be drawn as multi-line text if it contains carriage returns and line feeds.
taPathEllipsis | Text will be drawn with path ellipsis if it does not fit within given width.
taWordBreak | Text line(s) will be broken between words if they don't fit within given width.
taWrapText | Text line(s) will be broken if they don't fit within col width.
taTrimWhiteSpaces | No white spaces will be trimmed at the beginning or end of text lines.
TKVAlign

Declares possible values for the VAlign parameter in the DrawAlignedText function.

valTop | Text is aligned to the upper border of a cell rectangle.
valCenter | Text is vertically centered within the cell rectangle.
valBottom | Text is aligned to the lower border of a cell rectangle.

Constants

Overview

MNGHeader = #138'MNG'#13#10#26#10;
PNGHeader = #137'PNG'#13#10#26#10;

Description

MNGHeader = #138'MNG'#13#10#26#10;

PNGHeader = #137'PNG'#13#10#26#10;

PNG Support

Author

Tomas Krysl (tk@tkweb.eu)

Created

5 May 2004

Last Modified

20 Jun 2010


KHexEditor help: KGraphics: Class TKAlphaBitmap

Class TKAlphaBitmap

Unit

KGraphics

Declaration

type TKAlphaBitmap = class(TGraphic)

Description

A simple platform independent encapsulation for a 32bpp bitmap with alpha channel with the ability to modify it's pixels directly.

Methods

Overview

Public | constructor Create; override;
Public | constructor CreateFromRes(const ResName: string);
Public | destructor Destroy; override;
Public | procedure AlphaDrawTo(ACanvas: TCanvas; X, Y: Integer);
Public | procedure AlphaFill(Alpha: Byte; IfEmpty: Boolean = False); overload;
Public | procedure AlphaFill(Alpha: Byte; BlendColor: TColor; Gradient, Translucent: Boolean); overload;
Public | procedure AlphaStretchDrawTo(ACanvas: TCanvas; const ARect: TRect);
Public | procedure CombinePixel(X, Y: Integer; Color: TKColorRec);
Public | procedure CopyFrom(ABitmap: TKAlphaBitmap);
Public | procedure CopyFromRotated(ABitmap: TKAlphaBitmap);
Protected | procedure Draw(ACanvas: TCanvas; const ARect: TRect); override;
Public | procedure DrawFrom(ACanvas: TCanvas; const ARect: TRect);
Public | procedure DrawTo(ACanvas: TCanvas; const ARect: TRect);
Protected | function GetEmpty: Boolean; override;
Protected | function GetHeight: Integer; override;
Protected | function GetTransparent: Boolean; override;
Protected | function GetWidth: Integer; override;
Public | procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle; APalette: HPALETTE); override;
Public | procedure LoadFromStream(Stream: TStream); override;
Public | procedure MirrorHorz;
Public | procedure MirrorVert;
Public | procedure SaveToClipboardFormat(var AFormat: Word; var AData: THandle; var APalette: HPALETTE); override;
Public | procedure SaveToStream(Stream: TStream); override;
Protected | procedure SetHeight(Value: Integer); override;
Public | procedure SetSize(AWidth, AHeight: Integer); reintroduce;
Protected | procedure SetTransparent(Value: Boolean); override;
Protected | procedure SetWidth(Value: Integer); override;
Protected | procedure UpdateHandle; dynamic;
Protected | procedure UpdatePixels; dynamic;

Description

Public constructor Create; override;

Creates the instance.

Public constructor CreateFromRes(const ResName: string);

Creates the instance from application resources. For Lazarus 'BMP' type is taken, for Delphi RT_RCDATA is taken.

Public destructor Destroy; override;

Destroys the instance.

Public procedure AlphaDrawTo(ACanvas: TCanvas; X, Y: Integer);

Paints alpha bitmap onto Canvas at position given by X, Y. The alpha bitmap is combined with the background already drawn on Canvas using alpha channel stored in the alpha bitmap.

Public procedure AlphaFill(Alpha: Byte; IfEmpty: Boolean = False); overload;

Fills the alpha channel with Alpha. If the optional IfEmpty parameter is True, the alpha channel won't be modified unless it has zero value for all pixels.

Public procedure AlphaFill(Alpha: Byte; BlendColor: TColor; Gradient, Translucent: Boolean); overload;

Fills the alpha channel according to given parameters. Currently it is used internally by TKDragWindow.

Public procedure AlphaStretchDrawTo(ACanvas: TCanvas; const ARect: TRect);

Paints alpha bitmap onto Canvas at position given by ARect. The alpha bitmap is combined with the background already drawn on Canvas using alpha channel stored in the alpha bitmap.

Public procedure CombinePixel(X, Y: Integer; Color: TKColorRec);

Combines the pixel at given location with the given color.

Public procedure CopyFrom(ABitmap: TKAlphaBitmap);

Takes dimensions and pixels from ABitmap.

Public procedure CopyFromRotated(ABitmap: TKAlphaBitmap);

Takes 90°-rotated dimensions and pixels from ABitmap.

Protected procedure Draw(ACanvas: TCanvas; const ARect: TRect); override;

Paints itself to ACanvas at location ARect.

Public procedure DrawFrom(ACanvas: TCanvas; const ARect: TRect);

Copies a location specified by ARect from ACanvas to bitmap.

Public procedure DrawTo(ACanvas: TCanvas; const ARect: TRect);

Calls Draw.

Protected function GetEmpty: Boolean; override;

Returns True if bitmap is empty.

Protected function GetHeight: Integer; override;

Returns the bitmap height.

Protected function GetTransparent: Boolean; override;

Returns True. Treat alpha bitmap as transparent because of the possible alpha channel.

Protected function GetWidth: Integer; override;

Returns the bitmap width.

Public procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle; APalette: HPALETTE); override;

Does nothing.

Public procedure LoadFromStream(Stream: TStream); override;

Loads the bitmap from a stream.

Public procedure MirrorHorz;

Mirrors the bitmap pixels horizontally.

Public procedure MirrorVert;

Mirrors the bitmap pixels vertically.

Public procedure SaveToClipboardFormat(var AFormat: Word; var AData: THandle; var APalette: HPALETTE); override;

Does nothing.

Public procedure SaveToStream(Stream: TStream); override;

Saves the bitmap to a stream.

Protected procedure SetHeight(Value: Integer); override;

Specifies new bitmap height.

Public procedure SetSize(AWidth, AHeight: Integer); reintroduce;

Specifies the bitmap size.

Protected procedure SetTransparent(Value: Boolean); override;

Does nothing. Bitmap is never transparent.

Protected procedure SetWidth(Value: Integer); override;

Specifies new bitmap width.

Protected procedure UpdateHandle; dynamic;

Updates the bitmap handle from bitmap pixels.

Protected procedure UpdatePixels; dynamic;

Updates the pixels from bitmap handle.

Properties

Overview

Public | property Canvas: TCanvas;
Public | property DirectCopy: Boolean;
Public | property Handle: HBITMAP;
Public | property Pixel[X, Y: Integer]: TKColorRec;
Public | property Pixels: PKColorRecs;
Public | property PixelsChanged: Boolean;
Public | property ScanLine[Index: Integer]: PKColorRecs;

Description

Public property Canvas: TCanvas;

Returns the bitmap memory canvas.

Public property DirectCopy: Boolean;

Temporary flag. Use when copying data directly from another TGraphic to TKAlphaBitmap.

Public property Handle: HBITMAP;

Returns the bitmap handle.

Public property Pixel[X, Y: Integer]: TKColorRec;

Specifies the pixel color. Does range checking.

Public property Pixels: PKColorRecs;

Returns the pointer to bitmap pixels.

Public property PixelsChanged: Boolean;

Set this property to True if you have modified the bitmap pixels.

Public property ScanLine[Index: Integer]: PKColorRecs;

Returns the pointer to a bitmap scan line.


KHexEditor help: KGraphics: Class TKDragWindow

Class TKDragWindow

Unit

KGraphics

Declaration

type TKDragWindow = class(TObject)

Description

Encapsulates the drag window

Drag window is top level window used for dragging with mouse. It displays some portion of associated control. It can be translucent under Windows.

Methods

Overview

Public | constructor Create;
Public | destructor Destroy; override;
Public | procedure Hide;
Public | procedure Move(const NewPos: TPoint);
Public | procedure Show(IniCtrl: TCustomControl; const ARect: TRect; const InitialPos, CurrentPos: TPoint; MasterAlpha: Byte; Gradient: Boolean);

Description

Public constructor Create;

Creates the instance.

Public destructor Destroy; override;

Destroys the instance.

Public procedure Hide;

Hides the drag window.

Public procedure Move(const NewPos: TPoint);

Moves the drag window to a new location.

Public procedure Show(IniCtrl: TCustomControl; const ARect: TRect; const InitialPos, CurrentPos: TPoint; MasterAlpha: Byte; Gradient: Boolean);

Shows the drag window on screen. Takes a rectangular part as set by ARect from IniCtrl's Canvas and displays it at position InitialPos. MasterAlpha and Gradient are used to premaster the copied image with a specific fading effect.

Properties

Overview

Public | property Active: Boolean;
Public | property Bitmap: TKAlphaBitmap;
Public | property BitmapFilled: Boolean;

Description

Public property Active: Boolean;

Returns True if the drag window is shown.

Public property Bitmap: TKAlphaBitmap;

Returns the pointer to the bitmap that holds the copied control image.

Public property BitmapFilled: Boolean;

Returns True if the control already copied itself to the bitmap.


KHexEditor help: KGraphics: Class TKGraphicHint

Class TKGraphicHint

Unit

KGraphics

Declaration

type TKGraphicHint = class(TKHintWindow)

Description

Hierarchy

TKHintWindow

Methods

Overview

Public | constructor Create(AOwner: TComponent); override;
Protected | procedure Paint; override;

Description

Public constructor Create(AOwner: TComponent); override;

Protected procedure Paint; override;

Overriden method. Paints the hint.

Properties

Overview

Public property Graphic: TGraphic;

Description

Public property Graphic: TGraphic;


KHexEditor help: KGraphics: Class TKHintWindow

Class TKHintWindow

Unit

KGraphics

Declaration

type TKHintWindow = class(THintWindow)

Description

Base class for KControls hints

This class extends the standard THintWindow class. It adds functionality common to all hints used in KControls.

Methods

Overview

Public | constructor Create(AOwner: TComponent); override;
Public | procedure ShowAt(const Origin: TPoint);

Description

Public constructor Create(AOwner: TComponent); override;

Creates the instance.

Public procedure ShowAt(const Origin: TPoint);

Shows the hint at given position. This is an IDE independent implementation.

Properties

Overview

Public property Extent: TPoint;

Description

Public property Extent: TPoint;

Returns the extent of the hint.


KHexEditor help: KGraphics: Class TKTextHint

Class TKTextHint

Unit

KGraphics

Declaration

type TKTextHint = class(TKHintWindow)

Description

Hint window to display formatted text

This class implements the textual hint window. The text is displayed .

Hierarchy

TKHintWindow

Methods

Overview

Public | constructor Create(AOwner: TComponent); override;
Protected | procedure Paint; override;

Description

Public constructor Create(AOwner: TComponent); override;

Creates the instance.

Protected procedure Paint; override;

Overriden method. Paints the hint.

Properties

Overview

Public property Text: WideString;

Description

Public property Text: WideString;


KHexEditor help: KHexEditor

Unit KHexEditor

Description

This unit contains the TKHexEditor component and all supporting classes

This unit provides a powerfull hexadecimal editor component TKHexEditor with following major features:

  • advanced editing capabilities
  • advanced rendering styles
  • clipboard operations
  • virtually unlimited undo/redo operations
  • key mapping functionality
  • fast search/replace function
  • print/preview function
Copyright © 2006 Tomas Krysl (tk@tkweb.eu)

License:
This code is distributed as a freeware. You are free to use it as part of your application for any purpose including freeware, commercial and shareware applications. The origin of this source code must not be misrepresented; you must not claim your authorship. You may modify this code solely for your own purpose. Please feel free to contact the author if you think your changes might be useful for other users. You may distribute only the original package. The author accepts no liability for any damage that may result from using this code.

Classes, Interfaces and Objects

Name | Description
Class TKCustomHexEditor | Hexadecimal editor base component
Class TKHexEditor | Hexadecimal editor design-time component
Class TKHexEditorChangeList | Change (undo/redo item) list manager
Class TKHexEditorColors | Container for all colors used by TKCustomHexEditor class

Functions and Procedures

Overview

function BinaryToDigits(Buffer: PBytes; SelStart, SelEnd: TKHexEditorSelection): AnsiString;
function BinaryToText(Buffer: PBytes; SelStart, SelEnd: Integer; CharMapping: PKEditCharMapping): AnsiString;
function BinStrToBinary(const S: AnsiString): AnsiString;
function DigitsToBinStr(var S: AnsiString; Convert: Boolean = True): Boolean;
function DigitToBin(Value: AnsiChar): Integer;
function GetColorSpec(Index: TKHexEditorColorIndex): TKHexEditorColorSpec;
function MakeSelection(Index, Digit: Integer): TKHexEditorSelection;
function ReplaceDigit(Value, Digit, Pos: Integer): Integer;

Description

function BinaryToDigits(Buffer: PBytes; SelStart, SelEnd: TKHexEditorSelection): AnsiString;

Converts binary data into hexadecimal digit string.

    Parameters:
  • Buffer - binary data - intended for Buffer
  • SelStart, SelEnd - specifies which part of the buffer is about to be converted. SelStart.Index must be lower or equal to SelEnd.Index - intended for GetRealSelStart and GetRealSelEnd.

function BinaryToText(Buffer: PBytes; SelStart, SelEnd: Integer; CharMapping: PKEditCharMapping): AnsiString;

Converts binary data into text using given character mapping.

    Parameters:
  • Buffer - binary data - intended for Buffer
  • SelStart, SelEnd - specifies which part of the buffer is about to be converted. SelStart must be lower or equal to SelEnd. These parameters are integers since no digit selections are necessary.
  • CharMapping - required character mapping scheme

function BinStrToBinary(const S: AnsiString): AnsiString;

Converts a binary value string into binary data. If the binary value string is not divisible by 2, it will be right padded with zero. Example: '#A#F#0#1#D#C#0#5#3' is converted into '#AF#01#DC#05#30'.

function DigitsToBinStr(var S: AnsiString; Convert: Boolean = True): Boolean;

Examines/converts hexadecimal digit string to binary value string. Returns True if the digit string is valid.

    Parameters:
  • S - hexadecimal digit string (e.g. 'AF01 DC05 3'). White spaces will be ignored. When Convert is True, the converted binary value string will be returned via this parameter (in this exammple '#A#F#0#1#D#C#0#5#3').
  • Convert - the digit string will be converted if True, otherwise it will be examined only.

function DigitToBin(Value: AnsiChar): Integer;

Converts a hexadecimal digit character ('0'..'F') to binary value

function GetColorSpec(Index: TKHexEditorColorIndex): TKHexEditorColorSpec;

Returns the instance-independent color specification for the given color index

function MakeSelection(Index, Digit: Integer): TKHexEditorSelection;

Creates a selection structure from given Index and Digit parameters

function ReplaceDigit(Value, Digit, Pos: Integer): Integer;

Replaces a hexadecimal digit in the given binary value. Returns the original value with a replaced digit.

    Parameters:
  • Value - original binary value
  • Digit - digit value (0..15)
  • Pos - digit position (order)
Example: Value = $A18D, Digit = $C, Pos = 3: Result = $AC8D

Types

Overview

PKHexEditorChangeItem = ^TKHexEditorChangeItem;
TKHexEditorAreaDimensions = record Address, AddressOut, Digits, DigitsIn, DigitsOut, Text, TextIn, TotalHorz, TotalVert: Integer; end;
TKHexEditorChangeItem = record Data: AnsiString; EditArea: TKHexEditorArea; Group: Cardinal; GroupReason: TKHexEditorChangeReason; Inserted: Boolean; ItemReason: TKHexEditorChangeReason; SelEnd: TKHexEditorSelection; SelStart: TKHexEditorSelection; end;
TKHexEditorColorData = record Index: TKHexEditorColorIndex; Color: TColor; Default: TColor; Name: string; end;
TKHexEditorColorIndex = Integer;
TKHexEditorColorSpec = record Def: TColor; Name: string; end;
TKHexEditorDrawStyles = set of TKHexEditorDrawStyle;
TKHexEditorPaintData = record Canvas: TCanvas; PaintRect: TRect; TopLine, BottomLine, LeftChar, CharWidth, CharHeight, CharSpacing: Integer; Printing, PaintAll, PaintColors, PaintSelection, CaretShown: Boolean; end;
TKHexEditorSelection = record Index: Integer; Digit: Integer; end;
TKHexEditorSelText = record AsBinaryRaw, AsBinaryMapped, AsDigits, AsDigitsByteAligned: AnsiString; end;
TKHexEditorStates = set of TKHexEditorState;
TKHexEditorUndoChangeEvent = procedure(Sender: TObject; ItemReason: TKHexEditorChangeReason) of object;

Description

PKHexEditorChangeItem = ^TKHexEditorChangeItem;

Pointer to TKHexEditorChangeItem

TKHexEditorAreaDimensions = record Address, AddressOut, Digits, DigitsIn, DigitsOut, Text, TextIn, TotalHorz, TotalVert: Integer; end;

Contains dimensions of all areas in characters

    Members:
  • Address - address area width
  • AddressOut - address area leadout
  • Digits - digits area width
  • DigitsIn - digits area leadin
  • DigitsOut - digits area leadout
  • Text - text area width
  • TextIn - text area leadin
  • TotalHorz - total width of all defined areas
  • TotalVert - total number of lines

TKHexEditorChangeItem = record Data: AnsiString; EditArea: TKHexEditorArea; Group: Cardinal; GroupReason: TKHexEditorChangeReason; Inserted: Boolean; ItemReason: TKHexEditorChangeReason; SelEnd: TKHexEditorSelection; SelStart: TKHexEditorSelection; end;

Declares the undo/redo item description structure used by the TKHexEditorChangeList class

    Members:
  • Data - characters (binary or digit string) needed to execute this item
  • EditArea - active edit area at the time this item was recorded
  • Group - identifies the undo/redo group. Some editor modifications produce a sequence of 2 or more undo items. This sequence is called undo/redo group and is always interpreted as a single undo/redo item. Moreover, if there is eoGroupUndo in Options, a single ecUndo or ecRedo command manipulates all following undo groups of the same kind (reason) as if they were a single undo/redo item.
  • GroupReason - reason (kind) of this undo group
  • ItemReason - reason (kind) of this item
  • SelEnd - end of the selection at the time this item was recorded
  • SelStart - start of the selection at the time this item was recorded

TKHexEditorColorData = record Index: TKHexEditorColorIndex; Color: TColor; Default: TColor; Name: string; end;

Declares the color description structure returned by ColorData property

    Members:
  • Index - color index
  • Color - current color value
  • Default - default color value
  • Name - color name

TKHexEditorColorIndex = Integer;

Declares possible indexes e.g. for the Color property.

TKHexEditorColorSpec = record Def: TColor; Name: string; end;

Declares TKHexEditorColors color item description

    Members:
  • Def - default color value
  • Name - color name (can be localized)

TKHexEditorDrawStyles = set of TKHexEditorDrawStyle;

Drawing styles can be arbitrary combined

TKHexEditorPaintData = record Canvas: TCanvas; PaintRect: TRect; TopLine, BottomLine, LeftChar, CharWidth, CharHeight, CharSpacing: Integer; Printing, PaintAll, PaintColors, PaintSelection, CaretShown: Boolean; end;

Declares the paint data structure for the PaintLines method

    Members:
  • Canvas - destination canvas
  • PainRect - bounding rectangle for painted lines (no clipping necessary, this is performed by window/page client area)
  • TopLine - first line painted (vertical scroll offset)
  • BottomLine - last line painted
  • LeftChar - first character painted (horizontal scroll offset)
  • CharWidth - character width in pixels for supplied canvas
  • CharHeight - character height in pixels for supplied canvas
  • CharSpacing - inter-character spacing in pixels for supplied canvas
  • Printing - determines whether normal painting or page printing should be performed
  • PaintAll - when Printing is True, specifies whether all data or selection only should be painted, this applies only to the first and/or last painted line
  • PaintColors - when Printing is True, specifies whether to paint with colors or grayscale
  • PaintSelection - when Printing is True, specifies whether to indicate the selection

TKHexEditorSelection = record Index: Integer; Digit: Integer; end;

Declares the selection structure

    Members:
  • Index - byte index
  • Digit - digit index

TKHexEditorSelText = record AsBinaryRaw, AsBinaryMapped, AsDigits, AsDigitsByteAligned: AnsiString; end;

Declares the structure for the SelText property

    Members:
  • AsBinaryRaw - selected data as binary characters not mapped
  • AsBinaryMapped - selected data as binary characters mapped
  • AsDigits - selected data as hexadecimal digits
  • AsDigitsByteAligned - selected data as hexadecimal digits without regarding cross-byte selections

TKHexEditorStates = set of TKHexEditorState;

Hex editor states can be arbitrary combined

TKHexEditorUndoChangeEvent = procedure(Sender: TObject; ItemReason: TKHexEditorChangeReason) of object;

Declares OnChange event handler

    Parameters:
  • Sender - identifies the event caller
  • ItemReason - specifies the undo/redo reason

Enumerations

TKHexEditorAddressMode

Declares possible values for the AddressMode property

eamDec | Address will be shown in decimal format
eamHex | Address will be shown in hexadecimal format
TKHexEditorArea

Declares possible values e.g. for the EditArea property

eaNone | No area is selected, e.g. when clicked outside of visible text
eaAddress | Address area selected/used
eaDigits | Digits area selected/used
eaText | Text area selected/used
TKHexEditorChangeReason

Declares possible values for the ItemReason member of the TKHexEditorChangeItem structure

crCaretPos | Save caret position only
crDeleteChar | Save inserted character to be able to delete it
crDeleteDigits | Save inserted hexadecimal digits to be able to delete them
crDeleteString | Save inserted binary string to be able to delete it
crInsertChar | Save deleted character to be able to insert it
crInsertDigits | Save deleted hexadecimal digits to be able to insert them
crInsertString | Save deleted binary string to be able to insert it
TKHexEditorColorScheme

Declares possible values for the ColorScheme property

ecsNormal | GetColor returns normal color currently defined for each item
ecsGrayed | GetColor returns gray for text and line colors and white for background colors
ecsBright | GetColor returns brighter version of normal color
ecsGrayScale | GetColor returns grayscaled color versions
TKHexEditorDisabledDrawStyle

Declares possible values for the DisabledDrawStyle property

eddBright | The lines will be painted with brighter colors when editor is disabled
eddGrayed | The lines will be painted with gray text and white background when editor is disabled
eddNormal | The lines will be painted normally when editor is disabled
TKHexEditorDrawStyle

Declares drawing styles - possible values for the DrawStyles property

edAddress | Show adress area
edDigits | Show digits area
edText | Show text area
edHorzLines | Show horizontal leading lines
edInactiveCaret | Show caret position when editor is inactive (has no input focus)
edSeparators | Show vertical area separating lines
edVertLines | Show vertical leading lines (digits area only)
edSingleBkGnd | BkGnd is used for all areas if included
TKHexEditorState

Declares hex editor states - possible values for the States property (protected)

elCaretVisible | Caret is visible
elCaretUpdate | Caret is being updated
elIgnoreNextChar | Ignore following WM_CHAR message
elModified | Buffer modified
elMouseCapture | Mouse captured
elOverwrite | Overwrite mode active
elReadOnly | Read only editor

Constants

Overview

cAddressBkgndDef = clWindow;
cAddressCursorDef = crHandPoint;
cAddressModeDef = eamHex;
cAddressOffsetDef = 0;
cAddressPrefixDef = '0x';
cAddressSizeDef = 8;
cAddressSizeMax = 10;
cAddressSizeMin = 2;
cAddressTextDef = clWindowText;
cAreaSpacingDef = 1;
cAreaSpacingMax = 20;
cAreaSpacingMin = 1;
cBkGndDef = clWindow;
cCharSpacingDef = 0;
cCharSpacingMax = 100;
cCharSpacingMin = 0;
cDigitBkGndDef = clWindow;
cDigitGroupingDef = 2;
cDigitGroupingMax = 8;
cDigitGroupingMin = 1;
cDigitTextEvenDef = clMaroon;
cDigitTextOddDef = clRed;
cDisabledDrawStyleDef = eddBright;
cDrawStylesDef = [edAddress, edDigits, edText, edInactiveCaret, edSeparators];
cFontNameDef = 'Courier';
cFontSizeDef = 11;
cFontSizeMax = 100;
cFontSizeMin = 8;
cFontStyleDef = [fsBold];
cHeight = 300;
cHorzLinesDef = clWindowText;
ciAddressBkGnd = TKHexEditorColorIndex(1);
ciAddressText = TKHexEditorColorIndex(0);
ciBkGnd = TKHexEditorColorIndex(2);
ciDigitBkGnd = TKHexEditorColorIndex(5);
ciDigitTextEven = TKHexEditorColorIndex(3);
ciDigitTextOdd = TKHexEditorColorIndex(4);
ciHexEditorColorsMax = ciVertLines;
ciHorzLines = TKHexEditorColorIndex(6);
ciInactiveCaretBkGnd = TKHexEditorColorIndex(7);
ciInactiveCaretSelBkGnd = TKHexEditorColorIndex(8);
ciInactiveCaretSelText = TKHexEditorColorIndex(9);
ciInactiveCaretText = TKHexEditorColorIndex(10);
ciLinesHighLight = TKHexEditorColorIndex(11);
cInactiveCaretBkGndDef = clBlack;
cInactiveCaretSelBkGndDef = clBlack;
cInactiveCaretSelTextDef = clYellow;
cInactiveCaretTextDef = clYellow;
cInvalidIndex = -1;
ciSelBkGnd = TKHexEditorColorIndex(12);
ciSelBkGndFocused = TKHexEditorColorIndex(13);
ciSelText = TKHexEditorColorIndex(14);
ciSelTextFocused = TKHexEditorColorIndex(15);
ciSeparators = TKHexEditorColorIndex(16);
ciTextBkGnd = TKHexEditorColorIndex(18);
ciTextText = TKHexEditorColorIndex(17);
ciVertLines = TKHexEditorColorIndex(19);
cLineHeightPercentDef = 130;
cLineHeightPercentMax = 1000;
cLineHeightPercentMin = 10;
cLinesHighLightDef = clHighLightText;
cLineSizeDef = 16;
cLineSizeMax = 128;
cLineSizeMin = 1;
cScrollSpeedDef = 100;
cScrollSpeedMax = 1000;
cScrollSpeedMin = 50;
cSelBkGndDef = clGrayText;
cSelBkGndFocusedDef = clHighlight;
cSelTextDef = clHighlightText;
cSelTextFocusedDef = clHighlightText;
cSeparatorsDef = clWindowText;
cTextBkgndDef = clWindow;
cTextTextDef = clWindowText;
cUndoLimitDef = 1000;
cUndoLimitMax = 10000;
cUndoLimitMin = 100;
cVertLinesDef = clWindowText;
cWidth = 400;

Description

cAddressBkgndDef = clWindow;

Default value for the AddressBkGnd color property

cAddressCursorDef = crHandPoint;

Default value for the AddressCursor property

cAddressModeDef = eamHex;

Default value for the AddressMode property

cAddressOffsetDef = 0;

Default value for the AddressOffset property

cAddressPrefixDef = '0x';

Default value for the AddressPrefix property

cAddressSizeDef = 8;

Default value for the AddressSize property

cAddressSizeMax = 10;

Maximum for the AddressSize property

cAddressSizeMin = 2;

Minimum for the AddressSize property

cAddressTextDef = clWindowText;

Default value for the AddressText color property

cAreaSpacingDef = 1;

Default value for the AreaSpacing property

cAreaSpacingMax = 20;

Maximum for the AreaSpacing property

cAreaSpacingMin = 1;

Minimum for the AreaSpacing property

cBkGndDef = clWindow;

Default value for the BkGnd color property

cCharSpacingDef = 0;

Default value for the CharSpacing property

cCharSpacingMax = 100;

Maximum for the CharSpacing property

cCharSpacingMin = 0;

Minimum for the CharSpacing property

cDigitBkGndDef = clWindow;

Default value for the DigitBkGnd color property

cDigitGroupingDef = 2;

Default value for the DigitGrouping property

cDigitGroupingMax = 8;

Maximum for the DigitGrouping property

cDigitGroupingMin = 1;

Minimum for the DigitGrouping property

cDigitTextEvenDef = clMaroon;

Default value for the DigitTextEven color property

cDigitTextOddDef = clRed;

Default value for the DigitTextOdd color property

cDisabledDrawStyleDef = eddBright;

Default value for the DisabledDrawStyle property

cDrawStylesDef = [edAddress, edDigits, edText, edInactiveCaret, edSeparators];

Default value for the DrawStyles property

cFontNameDef = 'Courier';

Default value for the Font.Name property

cFontSizeDef = 11;

Default value for the Font.Size property

cFontSizeMax = 100;

Maximum for the Font.Size property

cFontSizeMin = 8;

Minimum for the Font.Size property

cFontStyleDef = [fsBold];

Default value for the Font.Style property

cHeight = 300;

Default value for the Height property

cHorzLinesDef = clWindowText;

Default value for the HorzLines color property

ciAddressBkGnd = TKHexEditorColorIndex(1);

Index for the AddressBkGnd color property

ciAddressText = TKHexEditorColorIndex(0);

Index for the AddressText color property

ciBkGnd = TKHexEditorColorIndex(2);

Index for the BkGnd color property

ciDigitBkGnd = TKHexEditorColorIndex(5);

Index for the DigitBkGnd color property

ciDigitTextEven = TKHexEditorColorIndex(3);

Index for the DigitTextEven color property

ciDigitTextOdd = TKHexEditorColorIndex(4);

Index for the DigitTextOdd color property

ciHexEditorColorsMax = ciVertLines;

Maximum color array index

ciHorzLines = TKHexEditorColorIndex(6);

Index for the HorzLines color property

ciInactiveCaretBkGnd = TKHexEditorColorIndex(7);

Index for the InactiveCaretBkGnd color property

ciInactiveCaretSelBkGnd = TKHexEditorColorIndex(8);

Index for the InactiveCaretSelBkGnd color property

ciInactiveCaretSelText = TKHexEditorColorIndex(9);

Index for the InactiveCaretSelText color property

ciInactiveCaretText = TKHexEditorColorIndex(10);

Index for the InactiveCaretText color property

ciLinesHighLight = TKHexEditorColorIndex(11);

Index for the LinesHighLight color property

cInactiveCaretBkGndDef = clBlack;

Default value for the InactiveCaretBkGnd color property

cInactiveCaretSelBkGndDef = clBlack;

Default value for the InactiveCaretSelBkGnd color property

cInactiveCaretSelTextDef = clYellow;

Default value for the InactiveCaretSelText color property

cInactiveCaretTextDef = clYellow;

Default value for the InactiveCaretText color property

cInvalidIndex = -1;

Declares the Index member of the TKHexEditorSelection record invalid

ciSelBkGnd = TKHexEditorColorIndex(12);

Index for the SelBkGnd color property

ciSelBkGndFocused = TKHexEditorColorIndex(13);

Index for the SelBkGndFocused color property

ciSelText = TKHexEditorColorIndex(14);

Index for the SelText color property

ciSelTextFocused = TKHexEditorColorIndex(15);

Index for the SelTextFocused color property

ciSeparators = TKHexEditorColorIndex(16);

Index for the Separators color property

ciTextBkGnd = TKHexEditorColorIndex(18);

Index for the TextBkgnd color property

ciTextText = TKHexEditorColorIndex(17);

Index for the TextText color property

ciVertLines = TKHexEditorColorIndex(19);

Index for the VertLines color property

cLineHeightPercentDef = 130;

Default value for the LineHeightPercent property

cLineHeightPercentMax = 1000;

Maximum for the LineHeightPercent property

cLineHeightPercentMin = 10;

Minimum for the LineHeightPercent property

cLinesHighLightDef = clHighLightText;

Default value for the LinesHighLight color property

cLineSizeDef = 16;

Default value for the LineSize property

cLineSizeMax = 128;

Maximum for the LineSize property

cLineSizeMin = 1;

Minimum for the LineSize property

cScrollSpeedDef = 100;

Default value for the ScrollSpeed property

cScrollSpeedMax = 1000;

Maximum for the ScrollSpeed property

cScrollSpeedMin = 50;

Minimum for the ScrollSpeed property

cSelBkGndDef = clGrayText;

Default value for the SelBkGnd color property

cSelBkGndFocusedDef = clHighlight;

Default value for the SelBkGndFocused color property

cSelTextDef = clHighlightText;

Default value for the SelText color property

cSelTextFocusedDef = clHighlightText;

Default value for the SelTextFocused color property

cSeparatorsDef = clWindowText;

Default value for the Separators color property

cTextBkgndDef = clWindow;

Default value for the TextBkgnd color property

cTextTextDef = clWindowText;

Default value for the TextText color property

cUndoLimitDef = 1000;

Default value for the UndoLimit property

cUndoLimitMax = 10000;

Maximum for the UndoLimit property

cUndoLimitMin = 100;

Minimum for the UndoLimit property

cVertLinesDef = clWindowText;

Default value for the VertLines color property

cWidth = 400;

Default value for the Width property

Author

Tomas Krysl (tk@tkweb.eu)

Created

12 Oct 2005

Last Modified

20 Jun 2010


KHexEditor help: KHexEditor: Class TKCustomHexEditor

Class TKCustomHexEditor

Unit

KHexEditor

Declaration

type TKCustomHexEditor = class(TKCustomControl)

Description

Hexadecimal editor base component

Hierarchy

TKCustomControl

Methods

Overview

Public | constructor Create(AOwner: TComponent); override;
Public | destructor Destroy; override;
Protected | procedure AddUndoByte(ItemReason: TKHexEditorChangeReason; Data: Byte; Inserted: Boolean = True);
Protected | procedure AddUndoBytes(ItemReason: TKHexEditorChangeReason; Data: PBytes; Length: Integer; Inserted: Boolean = True);
Protected | procedure AddUndoCaretPos(Force: Boolean = True);
Protected | procedure AddUndoString(ItemReason: TKHexEditorChangeReason; const S: AnsiString; Inserted: Boolean = True);
Public | procedure Append(At: Integer; const Data: AnsiString); overload; virtual;
Public | procedure Append(At: Integer; Data: TDataSize); overload; virtual;
Public | procedure Assign(Source: TPersistent); override;
Protected | procedure BeginUndoGroup(GroupReason: TKHexEditorChangeReason);
Protected | procedure BufferChanged;
Protected | function CanScroll(Command: TKEditCommand): Boolean; virtual;
Public | function CaretInView: Boolean;
Public | procedure Clear;
Protected | procedure ClearChar(At: Integer);
Protected | procedure ClearDigitSelection;
Protected | procedure ClearString(At, Size: Integer);
Public | procedure ClearUndo;
Public | function CommandEnabled(Command: TKEditCommand): Boolean; virtual;
Protected | procedure CreateParams(var Params: TCreateParams); override;
Protected | procedure CreateWnd; override;
Protected | procedure DestroyWnd; override;
Protected | procedure DoChange; virtual;
Protected | function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;
Protected | procedure EditAreaChanged; virtual;
Protected | procedure EndUndoGroup;
Public | function ExecuteCommand(Command: TKEditCommand; Data: Pointer = nil): Boolean; virtual;
Protected | procedure FontChange(Sender: TObject); virtual;
Public | function GetAreaDimensions: TKHexEditorAreaDimensions; virtual;
Public | function GetCharMapping: TKEditCharMapping;
Public | function GetClientHeightChars: Integer; virtual;
Public | function GetClientWidthChars: Integer; virtual;
Public | function GetKeyMapping: TKEditKeyMapping;
Public | function GetMaxLeftChar(Extent: Integer = 0): Integer; virtual;
Public | function GetMaxTopLine(Extent: Integer = 0): Integer; virtual;
Public | function GetModifiedClientRect: TRect; virtual;
Protected | function GetPageHorz: Integer; virtual;
Public | function GetRealSelEnd: TKHexEditorSelection;
Public | function GetRealSelStart: TKHexEditorSelection;
Protected | function HasFocus: Boolean; virtual;
Protected | procedure HideEditorCaret; virtual;
Protected | procedure InsertChar(At: Integer; Value: Byte);
Protected | procedure InsertString(At: Integer; const Value: AnsiString; Size: Integer);
Protected | function InternalGetSelAvail: Boolean; override;
Protected | procedure InternalMoveLeft; virtual;
Protected | procedure InternalMoveRight; virtual;
Protected | procedure KeyDown(var Key: Word; Shift: TShiftState); override;
Protected | procedure KeyPress(var Key: Char); override;
Public | procedure LoadFromFile(const FileName: TFileName);
Public | procedure LoadFromStream(Stream: TStream);
Protected | procedure MeasurePages(var Info: TKPrintMeasureInfo); override;
Protected | procedure ModifyScrollBar(ScrollBar, ScrollCode, Delta: Integer; UpdateNeeded: Boolean);
Protected | procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
Protected | procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
Protected | procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
Protected | procedure PaintLines(const Data: TKHexEditorPaintData); virtual;
Protected | procedure PaintPage; override;
Protected | procedure PaintToCanvas(ACanvas: TCanvas); override;
Public | procedure PaintToCanvasEx(ACanvas: TCanvas; ARect: TRect; ALeftChar, ATopLine: Integer);
Public | function PointToSel(P: TPoint; OutOfArea: Boolean; var Area: TKHexEditorArea): TKHexEditorSelection; virtual;
Protected | procedure SafeSetFocus;
Public | procedure SaveToFile(const FileName: TFileName);
Public | procedure SaveToStream(Stream: TStream);
Protected | procedure ScrollBy(HChars, VChars: Integer; UpdateNeeded: Boolean);
Protected | procedure ScrollTo(Point: TPoint; Timed, AlwaysScroll: Boolean); virtual;
Public | function SelAvail: Boolean;
Protected | procedure SelectionChanged(StartEqualEnd: Boolean; ScrollToView: Boolean = True);
Public | function SelectionValid(Value: TKHexEditorSelection; Area: TKHexEditorArea): Boolean; virtual;
Public | function SelToPoint(Value: TKHexEditorSelection; Area: TKHexEditorArea): TPoint; virtual;
Public | procedure SetCharMapping(const Value: TKEditCharMapping);
Public | procedure SetKeyMapping(const Value: TKEditKeyMapping);
Protected | function SetMouseCursor(X, Y: Integer): Boolean; override;
Protected | procedure ShowEditorCaret; virtual;
Protected | procedure UndoChange(Sender: TObject; ItemReason: TKHexEditorChangeReason);
Protected | procedure UpdateCharMetrics; virtual;
Protected | procedure UpdateEditorCaret(Recreate: Boolean = False); virtual;
Protected | procedure UpdateMouseCursor; virtual;
Protected | procedure UpdateScrollRange; virtual;
Protected | procedure UpdateSelEnd(Point: TPoint; ClipToClient: Boolean); virtual;
Protected | procedure UpdateSize; override;
Public | procedure ValidateSelection(var Value: TKHexEditorSelection; Area: TKHexEditorArea); virtual;

Description

Public constructor Create(AOwner: TComponent); override;

Performs necessary initializations - default values to properties, create undo/redo list managers

Public destructor Destroy; override;

Destroy instance, undo/redo list managers, dispose buffer...

Protected procedure AddUndoByte(ItemReason: TKHexEditorChangeReason; Data: Byte; Inserted: Boolean = True);

Inserts a single byte change into undo list.

    Parameters:
  • ItemReason - specifies the undo/redo item reason - most likely crInsertChar or crDeleteChar.
  • Data - specifies the data byte needed to restore the original buffer state
  • Inserted - for the urInsert* items, specifies the current InsertMode status.

Protected procedure AddUndoBytes(ItemReason: TKHexEditorChangeReason; Data: PBytes; Length: Integer; Inserted: Boolean = True);

Inserts a byte array change into undo list.

    Parameters:
  • ItemReason - specifies the undo/redo item reason - crInsert* or crDelete*.
  • Data - specifies the data bytes needed to restore the original buffer state
  • Inserted - for the urInsert* items, specifies the current InsertMode status.

Protected procedure AddUndoCaretPos(Force: Boolean = True);

Inserts a single crCaretPos item into undo list. Unless Force is set to True, this change will be inserted only if previous undo item is not crCaretPos.

Protected procedure AddUndoString(ItemReason: TKHexEditorChangeReason; const S: AnsiString; Inserted: Boolean = True);

Inserts a string change into undo list. Has the same functionality as AddUndoBytes only Data is supplied as a string.

Public procedure Append(At: Integer; const Data: AnsiString); overload; virtual;

Appends data at current position. Use TKHexEditor.Data.Size for At parameter to append at the end of the buffer.

Public procedure Append(At: Integer; Data: TDataSize); overload; virtual;

Appends data at current position. Use TKHexEditor.Data.Size for At parameter to append at the end of the buffer.

Public procedure Assign(Source: TPersistent); override;

Takes property values from another TKCustomHexEditor class

Protected procedure BeginUndoGroup(GroupReason: TKHexEditorChangeReason);

Begins a new undo group. Use the GroupReason parameter to label it.

Protected procedure BufferChanged;

Performs necessary adjustments when the buffer is modified programatically (not by user)

Protected function CanScroll(Command: TKEditCommand): Boolean; virtual;

Determines whether an ecScroll* command can be executed

Public function CaretInView: Boolean;

Determines whether the caret is visible

Public procedure Clear;

Clears entire data buffer. Unlike ecClearAll this method clears everything inclusive undo a redo lists.

Protected procedure ClearChar(At: Integer);

Clears a character at position At. Doesn't perform any succesive adjustments.

Protected procedure ClearDigitSelection;

Clears a the digit fields both in SelStart and SelEnd. Doesn't perform any succesive adjustments.

Protected procedure ClearString(At, Size: Integer);

Clears a string of the Size length at position At. Doesn't perform any succesive adjustments.

Public procedure ClearUndo;

Clears undo (and redo) list

Public function CommandEnabled(Command: TKEditCommand): Boolean; virtual;

Determines whether given command can be executed at this time. Use this function in TAction.OnUpdate events.

    Parameters:
  • Command - specifies the command to inspect

Protected procedure CreateParams(var Params: TCreateParams); override;

Overriden method - defines additional styles for the hex editor window (scrollbars etc.)

Protected procedure CreateWnd; override;

Overriden method - adjusts file drag&drop functionality

Protected procedure DestroyWnd; override;

Overriden method - adjusts file drag&drop functionality

Protected procedure DoChange; virtual;

Calls the OnChange event

Protected function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;

Overriden method - handles mouse wheel messages

Protected procedure EditAreaChanged; virtual;

Validates the EditArea property after it has been modified

Protected procedure EndUndoGroup;

Closes the undo group created by BeginUndoGroup

Public function ExecuteCommand(Command: TKEditCommand; Data: Pointer = nil): Boolean; virtual;

Executes given command. This function first calls CommandEnabled to assure given command can be executed.

    Parameters:
  • Command - specifies the command to execute
  • Data - specifies the data needed for the command

Protected procedure FontChange(Sender: TObject); virtual;

Ensures that font pitch is always fpFixed and Font.Size is not too small or big

Public function GetAreaDimensions: TKHexEditorAreaDimensions; virtual;

Returns dimensions of all 3 possible areas according to current area definition

Public function GetCharMapping: TKEditCharMapping;

Returns current character mapping.

Public function GetClientHeightChars: Integer; virtual;

Returns number of characters that vertically fit into client window

Public function GetClientWidthChars: Integer; virtual;

Returns number of characters that horizontally fit into client window

Public function GetKeyMapping: TKEditKeyMapping;

Returns the current key stroke mapping scheme.

Public function GetMaxLeftChar(Extent: Integer = 0): Integer; virtual;

Returns current maximum value for the LeftChar property

    Parameters:
  • Extent - specify TKHexEditorAreaDimensions.TotalHorz here, otherwise the function calculates it itself

Public function GetMaxTopLine(Extent: Integer = 0): Integer; virtual;

Returns current maximum value for the TopLine property

    Parameters:
  • Extent - specify TKHexEditorAreaDimensions.TotalVert here, otherwise the function calculates it itself

Public function GetModifiedClientRect: TRect; virtual;

Returns modified client rect - a window client rect aligned to character width and character height

Protected function GetPageHorz: Integer; virtual;

Returns the horizontal page extent for the current edit area. This function is used by the ecPageLeft and ecPageRight commands.

Public function GetRealSelEnd: TKHexEditorSelection;

Returns "real" selection end - with always higher index value than selection start value

Public function GetRealSelStart: TKHexEditorSelection;

Returns "real" selection start - with always lower index value than selection end value

Protected function HasFocus: Boolean; virtual;

Determines if the editor has input focus.

Protected procedure HideEditorCaret; virtual;

Hides the caret.

Protected procedure InsertChar(At: Integer; Value: Byte);

Inserts a character at specified position. Doesn't perform any succesive adjustments.

    Parameters:
  • At - position where the character should be inserted.
  • Value - character (data byte)

Protected procedure InsertString(At: Integer; const Value: AnsiString; Size: Integer);

Inserts a string at specified position. Doesn't perform any succesive adjustments.

    Parameters:
  • At - position where the string should be inserted.
  • Value - data byte string
  • Size - length of the data byte string

Protected function InternalGetSelAvail: Boolean; override;

Returns True if the control has a selection.

Protected procedure InternalMoveLeft; virtual;

Moves the caret one position left. Doesn't perform any succesive adjustments.

Protected procedure InternalMoveRight; virtual;

Moves the caret one position right. Doesn't perform any succesive adjustments.

Protected procedure KeyDown(var Key: Word; Shift: TShiftState); override;

Overriden method - processes virtual key strokes according to current TKCustomHexEditor.KeyMapping

Protected procedure KeyPress(var Key: Char); override;

Overriden method - processes character key strokes - data editing

Public procedure LoadFromFile(const FileName: TFileName);

Loads data from a file

Public procedure LoadFromStream(Stream: TStream);

Loads data from a stream - stream position remains untouched

Protected procedure MeasurePages(var Info: TKPrintMeasureInfo); override;

Updates information about printed shape.

Protected procedure ModifyScrollBar(ScrollBar, ScrollCode, Delta: Integer; UpdateNeeded: Boolean);

Processes scrollbar messages.

    Parameters:
  • ScrollBar - scrollbar type from OS
  • ScrollCode - scrollbar action from OS
  • Delta - scrollbar position change
  • UpdateNeeded - set to True if you want to invalidate and update caret position

Protected procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;

Overriden method - updates caret position/selection

Protected procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;

Overriden method - updates caret position/selection and initializes scrolling when needed.

Protected procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;

Overriden method - releases mouse capture acquired by MouseDown

Protected procedure PaintLines(const Data: TKHexEditorPaintData); virtual;

Paints/prints hex editor outline. This function must retain its reentrancy.

    Parameters:
  • Data - paint settings

Protected procedure PaintPage; override;

Paints a page to a printer/preview canvas.

Protected procedure PaintToCanvas(ACanvas: TCanvas); override;

Overriden method - calls PaintLines for drawing the hex editor outline into window client area

Public procedure PaintToCanvasEx(ACanvas: TCanvas; ARect: TRect; ALeftChar, ATopLine: Integer);

Paints the editor outline to another canvas

    Parameters:
  • ACanvas - canvas to paint the outline to
  • ARect - given rectangle in the canvas
  • ALeftChar - first left visible character
  • ATopLine - first top visible line

Public function PointToSel(P: TPoint; OutOfArea: Boolean; var Area: TKHexEditorArea): TKHexEditorSelection; virtual;

Converts window coordinates into a selection

    Parameters:
  • P - window client coordinates
  • OutOfArea - uses the Area parameter to compute selection for this area even if the supplied coordinates are outside of the area outline
  • Area output parameter if OutOfArea = False, otherwise input parameter

Protected procedure SafeSetFocus;

Grants the input focus to the control when possible and the control has had none before

Public procedure SaveToFile(const FileName: TFileName);

Saves data into a file

Public procedure SaveToStream(Stream: TStream);

Saves data into a stream - stream position remains untouched

Protected procedure ScrollBy(HChars, VChars: Integer; UpdateNeeded: Boolean);

Scrolls the hex editor window horizontaly by HChars characters and/or vertically by VChars characters

Protected procedure ScrollTo(Point: TPoint; Timed, AlwaysScroll: Boolean); virtual;

Scrolls the hex editor window to ensure data under defined (mouse) coordinates are visible

    Parameters:
  • Point - (mouse) coordinates
  • Timed - set to True to continue scroll via a timer. The scrolling will continue until the mouse cursor is outside of the modified client rect (GetModifiedClientRect).
  • AlwaysScroll - set to True to disable new line overscrolling

Public function SelAvail: Boolean;

Determines whether a seletion (not digit selection) is available

Protected procedure SelectionChanged(StartEqualEnd: Boolean; ScrollToView: Boolean = True);

Performs necessary adjustments after a selection property changed.

    Parameters:
  • StartEqualEnd - forces SelStart equal to SelEnd
  • ScrollToView - forces scrolling if SelEnd (caret) became invisible

Public function SelectionValid(Value: TKHexEditorSelection; Area: TKHexEditorArea): Boolean; virtual;

Determines whether a given selection is valid for given area

    Parameters:
  • Value - selection to examine
  • Area - area for which the selection must be examined

Public function SelToPoint(Value: TKHexEditorSelection; Area: TKHexEditorArea): TPoint; virtual;

Converts a selection into window coordinates

    Parameters:
  • Value - selection to convert
  • Area - the same selection delivers another coordinates for each area

Public procedure SetCharMapping(const Value: TKEditCharMapping);

Specifies character mapping. The main purpose of this is to avoid non-printable characters in the text area and in AsText copies. Avoid non-printable characters when delivering a new character mapping.

Public procedure SetKeyMapping(const Value: TKEditKeyMapping);

Specifies the current key stroke mapping scheme

Protected function SetMouseCursor(X, Y: Integer): Boolean; override;

Updates mouse cursor according to the state determined from current mouse position. Returns True if cursor has been changed.

Protected procedure ShowEditorCaret; virtual;

Shows the caret.

Protected procedure UndoChange(Sender: TObject; ItemReason: TKHexEditorChangeReason);

Calls the DoChange method

Protected procedure UpdateCharMetrics; virtual;

Updates font based dimensions

Protected procedure UpdateEditorCaret(Recreate: Boolean = False); virtual;

Updates caret position, shows/hides caret according to the input focus

    Parameters:
  • Recreate - set to True to recreate the caret after it has already been created and displayed

Protected procedure UpdateMouseCursor; virtual;

Updates mouse cursor

Protected procedure UpdateScrollRange; virtual;

Updates the scrolling range

Protected procedure UpdateSelEnd(Point: TPoint; ClipToClient: Boolean); virtual;

Updates selection according to the supplied coordinates.

    Parameters:
  • Point - specifies the coordinates
  • ClipToClient - specifies whether the coordinates should be clipped to modified client rectangle (GetModifiedClientRect) first

Protected procedure UpdateSize; override;

Updates the control size.

Public procedure ValidateSelection(var Value: TKHexEditorSelection; Area: TKHexEditorArea); virtual;

Validates a selection for given area

    Parameters:
  • Value - selection to validate
  • Area - area for which the selection must be validated

Properties

Overview

Public | property AddressCursor: TCursor;
Public | property AddressMode: TKHexEditorAddressMode;
Public | property AddressOffset: Integer;
Public | property AddressPrefix: string;
Public | property AddressSize: Integer;
Public | property AreaSpacing: Integer;
Protected | property Buffer: PBytes;
Public | property CaretPos: TKHexEditorSelection;
Public | property CaretVisible: Boolean;
Public | property CharHeight: Integer;
Public | property CharSpacing: Integer;
Public | property CharWidth: Integer;
Public | property ClipboardFormat: Word;
Public | property Colors: TKHexEditorColors;
Public | property CommandKey[Index: TKEditCommand]: TKEditKey;
Public | property Data: TDataSize;
Public | property DigitGrouping: Integer;
Public | property DisabledDrawStyle: TKHexEditorDisabledDrawStyle;
Public | property DrawStyles: TKHexEditorDrawStyles;
Public | property EditArea: TKHexEditorArea;
Public | property Empty: Boolean;
Public | property FirstVisibleIndex: Integer;
Public | property InsertMode: Boolean;
Public | property LastVisibleIndex: Integer;
Public | property LeftChar: Integer;
Public | property LineCount: Integer;
Public | property LineHeightPercent: Integer;
Public | property Lines[Index: Integer]: TDataSize;
Public | property LineSize: Integer;
Public | property Modified: Boolean;
Public | property OnChange: TNotifyEvent;
Public | property OnDropFiles: TKEditDropFilesEvent;
Public | property OnReplaceText: TKEditReplaceTextEvent;
Public | property Options: TKEditOptions;
Public | property ReadOnly: Boolean;
Protected | property RedoList: TKHexEditorChangeList;
Public | property ScrollBars: TScrollStyle;
Public | property ScrollSpeed: Cardinal;
Public | property SelEnd: TKHexEditorSelection;
Public | property SelLength: TKHexEditorSelection;
Public | property SelStart: TKHexEditorSelection;
Public | property SelText: TKHexEditorSelText;
Protected | property Size: Integer;
Protected | property States: TKHexEditorStates;
Public | property TopLine: Integer;
Public | property UndoLimit: Integer;
Protected | property UndoList: TKHexEditorChangeList;

Description

Public property AddressCursor: TCursor;

Specifies the address area mouse cursor. Other areas have crIBeam - should not be needed to modify that

Public property AddressMode: TKHexEditorAddressMode;

Specifies the radix of addresses

Public property AddressOffset: Integer;

Specifies the address offset

Public property AddressPrefix: string;

Specifies the address number prefix i.e. 0x or $ - modify together with AddressMode

Public property AddressSize: Integer;

Specifies the number of address digits - up to 10 for decimal addresses

Public property AreaSpacing: Integer;

Defines space between neighbour areas

Protected property Buffer: PBytes;

Data buffer - made accessible for descendant classes

Public property CaretPos: TKHexEditorSelection;

Returns current caret position = selection end

Public property CaretVisible: Boolean;

Returns True if caret is visible

Public property CharHeight: Integer;

Returns current character height = not equal to font character height

Public property CharSpacing: Integer;

Defines additional inter-character spacing

Public property CharWidth: Integer;

Returns current character width = not necessarily equal to font character width

Public property ClipboardFormat: Word;

Returns the binary data clipboard format

Public property Colors: TKHexEditorColors;

Makes it possible to take all color properties from another TKCustomHexEditor class

Public property CommandKey[Index: TKEditCommand]: TKEditKey;

Specifies a new key stroke combination for given command

Public property Data: TDataSize;

This property provides direct access to the data buffer

Public property DigitGrouping: Integer;

Specifies the byte grouping in the digits area

Public property DisabledDrawStyle: TKHexEditorDisabledDrawStyle;

Specifies the style how the outline is drawn when editor is disabled

Public property DrawStyles: TKHexEditorDrawStyles;

Defines areas to paint, whether to paint horizontal and vertical trailing lines, area separator lines and caret mark when the editor has no input focus

Public property EditArea: TKHexEditorArea;

Specifies the current area for editing

Public property Empty: Boolean;

Returns True if data buffer is empty

Public property FirstVisibleIndex: Integer;

Returns the first visible index

Public property InsertMode: Boolean;

Returns True if insert mode is on

Public property LastVisibleIndex: Integer;

Returns the last visible index

Public property LeftChar: Integer;

Specifies the horizontal scroll position

Public property LineCount: Integer;

Determines the number of lines

Public property LineHeightPercent: Integer;

Specifies the line height. 100% is the current font height

Public property Lines[Index: Integer]: TDataSize;

Allows to modify/add data lines. If greater than LineSize, the Size member of the supplied TDataSize structure will be always trimmed to LineSize. If Index points to last incomplete line or even higher, last line will be extended/completed, i.e new data will be added to the buffer

Public property LineSize: Integer;

Specifies the size (length) of a single line

Public property Modified: Boolean;

Returns True if the buffer was modified - eoUndoAfterSave taken into account

Public property OnChange: TNotifyEvent;

When assigned, this event will be invoked at each buffer change, made either by the user or programmatically by public functions

Public property OnDropFiles: TKEditDropFilesEvent;

When assigned, this event will be invoked when the user drops any files onto the window

Public property OnReplaceText: TKEditReplaceTextEvent;

When assigned, this event will be invoked at each prompt-forced search match

Public property Options: TKEditOptions;

Specifies the editor options that do not affect painting

Public property ReadOnly: Boolean;

Specifies whether the editor has to be read only editor

Protected property RedoList: TKHexEditorChangeList;

Redo list manager - made accessible for descendant classes

Public property ScrollBars: TScrollStyle;

Defines visible scrollbars - horizontal, vertical or both

Public property ScrollSpeed: Cardinal;

Specifies how fast the scrolling by timer should be

Public property SelEnd: TKHexEditorSelection;

Specifies the current selection end

Public property SelLength: TKHexEditorSelection;

Specifies the current selection length. SelStart remains unchanged, SelEnd will be updated accordingly. To mark a selection, either set both SelStart and SelEnd properties or both SelStart and SelLength properties

Public property SelStart: TKHexEditorSelection;

Specifies the current selection start

Public property SelText: TKHexEditorSelText;

Returns selected text in many different formats

Protected property Size: Integer;

Data buffer size - made accessible for descendant classes

Protected property States: TKHexEditorStates;

States of this class - made accessible for descendant classes

Public property TopLine: Integer;

Specifies the vertical scroll position

Public property UndoLimit: Integer;

Specifies the maximum number of undo items. Please note this value affects the undo item limit, not undo group limit.

Protected property UndoList: TKHexEditorChangeList;

Undo list manager - made accessible for descendant classes


KHexEditor help: KHexEditor: Class TKHexEditor

Class TKHexEditor

Unit

KHexEditor

Declaration

type TKHexEditor = class(TKCustomHexEditor)

Description

Hexadecimal editor design-time component

Hierarchy

TKCustomHexEditor > TKCustomControl

Properties

Overview

Published | property AddressCursor;
Published | property AddressMode;
Published | property AddressOffset;
Published | property AddressPrefix;
Published | property AddressSize;
Published | property Align;
Published | property Anchors;
Published | property BorderStyle;
Published | property BorderWidth;
Published | property CharSpacing;
Published | property Colors;
Published | property Constraints;
Published | property Ctl3D;
Published | property DigitGrouping;
Published | property DisabledDrawStyle;
Published | property DragCursor;
Published | property DragKind;
Published | property DragMode;
Published | property DrawStyles;
Published | property EditArea;
Published | property Enabled;
Published | property Font;
Published | property Height;
Published | property LineHeightPercent;
Published | property LineSize;
Published | property OnChange;
Published | property OnClick;
Published | property OnContextPopup;
Published | property OnDblClick;
Published | property OnDockDrop;
Published | property OnDockOver;
Published | property OnDragDrop;
Published | property OnDragOver;
Published | property OnDropFiles;
Published | property OnEndDock;
Published | property OnEndDrag;
Published | property OnEnter;
Published | property OnExit;
Published | property OnGetSiteInfo;
Published | property OnKeyDown;
Published | property OnKeyPress;
Published | property OnKeyUp;
Published | property OnMouseDown;
Published | property OnMouseMove;
Published | property OnMouseUp;
Published | property OnMouseWheel;
Published | property OnMouseWheelDown;
Published | property OnMouseWheelUp;
Published | property OnPrintNotify;
Published | property OnPrintPaint;
Published | property OnReplaceText;
Published | property OnResize;
Published | property OnStartDock;
Published | property OnStartDrag;
Published | property OnUnDock;
Published | property Options;
Published | property ParentShowHint;
Published | property PopupMenu;
Published | property ReadOnly;
Published | property ScrollBars;
Published | property ScrollSpeed;
Published | property ShowHint;
Published | property TabOrder;
Published | property TabStop;
Published | property UndoLimit;
Published | property Visible;
Published | property Width;

Description

Published property AddressCursor;

See TKCustomHexEditor.AddressCursor for details

Published property AddressMode;

See TKCustomHexEditor.AddressMode for details

Published property AddressOffset;

See TKCustomHexEditor.AddressOffset for details

Published property AddressPrefix;

See TKCustomHexEditor.AddressPrefix for details

Published property AddressSize;

See TKCustomHexEditor.AddressSize for details

Published property Align;

Inherited property - see Delphi help

Published property Anchors;

Inherited property - see Delphi help

Published property BorderStyle;

See TKCustomControl.BorderStyle for details

Published property BorderWidth;

Inherited property - see Delphi help

Published property CharSpacing;

See TKCustomHexEditor.CharSpacing for details

Published property Colors;

See TKCustomHexEditor.Colors for details

Published property Constraints;

Inherited property - see Delphi help

Published property Ctl3D;

Inherited property - see Delphi help.

Published property DigitGrouping;

See TKCustomHexEditor.DigitGrouping for details

Published property DisabledDrawStyle;

See TKCustomHexEditor.DisabledDrawStyle for details

Published property DragCursor;

Inherited property - see Delphi help

Published property DragKind;

Inherited property - see Delphi help

Published property DragMode;

Inherited property - see Delphi help

Published property DrawStyles;

See TKCustomHexEditor.DrawStyles for details

Published property EditArea;

See TKCustomHexEditor.EditArea for details

Published property Enabled;

Inherited property - see Delphi help

Published property Font;

Inherited property - see Delphi help. Font pitch must always remain fpFixed - specify fixed fonts only. Font.Size will also be trimmed if too small or big

Published property Height;

Inherited property - see Delphi help

Published property LineHeightPercent;

See TKCustomHexEditor.LineHeightPercent for details

Published property LineSize;

See TKCustomHexEditor.LineSize for details

Published property OnChange;

See TKCustomHexEditor.OnChange for details

Published property OnClick;

Inherited property - see Delphi help

Published property OnContextPopup;

Inherited property - see Delphi help

Published property OnDblClick;

Inherited property - see Delphi help

Published property OnDockDrop;

Inherited property - see Delphi help

Published property OnDockOver;

Inherited property - see Delphi help

Published property OnDragDrop;

Inherited property - see Delphi help

Published property OnDragOver;

Inherited property - see Delphi help

Published property OnDropFiles;

See TKCustomHexEditor.OnDropFiles for details

Published property OnEndDock;

Inherited property - see Delphi help

Published property OnEndDrag;

Inherited property - see Delphi help

Published property OnEnter;

Inherited property - see Delphi help

Published property OnExit;

Inherited property - see Delphi help

Published property OnGetSiteInfo;

Inherited property - see Delphi help

Published property OnKeyDown;

Inherited property - see Delphi help

Published property OnKeyPress;

Inherited property - see Delphi help

Published property OnKeyUp;

Inherited property - see Delphi help

Published property OnMouseDown;

Inherited property - see Delphi help

Published property OnMouseMove;

Inherited property - see Delphi help

Published property OnMouseUp;

Inherited property - see Delphi help

Published property OnMouseWheel;

Inherited property - see Delphi help

Published property OnMouseWheelDown;

Inherited property - see Delphi help

Published property OnMouseWheelUp;

Inherited property - see Delphi help

Published property OnPrintNotify;

See TKCustomControl.OnPrintNotify for details

Published property OnPrintPaint;

See TKCustomControl.OnPrintPaint for details

Published property OnReplaceText;

See TKCustomHexEditor.OnReplaceText for details

Published property OnResize;

Inherited property - see Delphi help

Published property OnStartDock;

Inherited property - see Delphi help

Published property OnStartDrag;

Inherited property - see Delphi help

Published property OnUnDock;

Inherited property - see Delphi help

Published property Options;

See TKCustomHexEditor.Options for details

Published property ParentShowHint;

Inherited property - see Delphi help

Published property PopupMenu;

Inherited property - see Delphi help

Published property ReadOnly;

See TKCustomHexEditor.ReadOnly for details

Published property ScrollBars;

See TKCustomHexEditor.ScrollBars for details

Published property ScrollSpeed;

See TKCustomHexEditor.ScrollSpeed for details

Published property ShowHint;

Inherited property - see Delphi help

Published property TabOrder;

Inherited property - see Delphi help

Published property TabStop;

Inherited property - see Delphi help

Published property UndoLimit;

See TKCustomHexEditor.UndoLimit for details

Published property Visible;

Inherited property - see Delphi help

Published property Width;

Inherited property - see Delphi help


KHexEditor help: KHexEditor: Class TKHexEditorChangeList

Class TKHexEditorChangeList

Unit

KHexEditor

Declaration

type TKHexEditorChangeList = class(TList)

Description

Change (undo/redo item) list manager

Methods

Overview

Public | constructor Create(AEditor: TKCustomHexEditor; RedoList: TKHexEditorChangeList);
Public | procedure AddChange(ItemReason: TKHexEditorChangeReason; const Data: AnsiString = ''; Inserted: Boolean = True); virtual;
Public | procedure BeginGroup(GroupReason: TKHexEditorChangeReason); virtual;
Public | function CanPeek: Boolean;
Public | procedure Clear; override;
Public | procedure EndGroup; virtual;
Protected | procedure Notify(Ptr: Pointer; Action: TListNotification); override;
Public | function PeekItem: PKHexEditorChangeItem;
Public | procedure PokeItem;
Public | procedure SetGroupData(Group: Integer; GroupReason: TKHexEditorChangeReason);

Description

Public constructor Create(AEditor: TKCustomHexEditor; RedoList: TKHexEditorChangeList);

Performs necessary initializations

    Parameters:
  • AEditor - identifies the undo/redo list owner
  • RedoList - when this instance is used as undo list, specify a redo list to allow clear it at each valid AddChange call

Public procedure AddChange(ItemReason: TKHexEditorChangeReason; const Data: AnsiString = ''; Inserted: Boolean = True); virtual;

Inserts a undo/redo item

    Parameters:
  • ItemReason - specifies the undo/redo item reason. The change list doesn't allow to insert succesive crCaretPos items unless Inserted is True
  • Data - specifies the item data. Some items (crCaretPos) don't need to supply any data
  • Inserted - for the urInsert* items, specifies whether the item was recorded with InsertMode on (True) or off (False). See ItemReason for crCaretPos behavior.

Public procedure BeginGroup(GroupReason: TKHexEditorChangeReason); virtual;

Tells the undo list a new undo/redo group is about to be created. Each BeginGroup call must have a corresponding EndGroup call (use try-finally). BeginGroup calls may be nested, however, only the first call will create an undo/redo group. Use the GroupReason parameter to specify the reason of this group.

Public function CanPeek: Boolean;

Informs whether there are any undo/redo items available - i.e. CanUndo/CanRedo

Public procedure Clear; override;

Clears the entire list - overriden to execute some adjustments

Public procedure EndGroup; virtual;

Completes the undo/redo group. See BeginGroup for details

Protected procedure Notify(Ptr: Pointer; Action: TListNotification); override;

Redefined to properly destroy the items

Public function PeekItem: PKHexEditorChangeItem;

Returns the topmost item to handle or inspect it

Public procedure PokeItem;

If there is no reason to handle an item returned by PeekItem, it has to be poked back with this function to become active for next undo/redo command

Public procedure SetGroupData(Group: Integer; GroupReason: TKHexEditorChangeReason);

For redo list only - each undo command creates a redo command with the same group information - see source

Properties

Overview

Public | property Limit: Integer;
Public | property Modified: Boolean;
Public | property OnChange: TKHexEditorUndoChangeEvent;

Description

Public property Limit: Integer;

Specifies maximum number of items - not groups

Public property Modified: Boolean;

For undo list only - returns True if undo list contains some items with regard to the eoUndoAfterSave option

Public property OnChange: TKHexEditorUndoChangeEvent;

Allows to call TKCustomHexEditor.OnChange event


KHexEditor help: KHexEditor: Class TKHexEditorColors

Class TKHexEditorColors

Unit

KHexEditor

Declaration

type TKHexEditorColors = class(TPersistent)

Description

Container for all colors used by TKCustomHexEditor class

This container allows to group many colors into one item in object inspector. Colors are accessible via published properties or several public Color* properties.

Methods

Overview

Public | constructor Create(AOwner: TKCustomHexEditor);
Public | procedure Assign(Source: TPersistent); override;
Public | procedure ClearBrightColors;
Public | procedure Initialize; virtual;

Description

Public constructor Create(AOwner: TKCustomHexEditor);

Performs necessary initializations

Public procedure Assign(Source: TPersistent); override;

Takes property values from another TKHexEditorColors class

Public procedure ClearBrightColors;

Clears cached brighter colors

Public procedure Initialize; virtual;

Initializes the color array.

Properties

Overview

Published | property AddressBkGnd: TColor;
Published | property AddressText: TColor;
Published | property BkGnd: TColor;
Public | property Color[Index: TKHexEditorColorIndex]: TColor;
Public | property ColorData[Index: TKHexEditorColorIndex]: TKHexEditorColorData;
Public | property ColorName[Index: TKHexEditorColorIndex]: string;
Public | property Colors: TKColorArray;
Public | property ColorScheme: TKHexEditorColorScheme;
Published | property DigitBkGnd: TColor;
Published | property DigitTextEven: TColor;
Published | property DigitTextOdd: TColor;
Published | property HorzLines: TColor;
Published | property InactiveCaretBkGnd: TColor;
Published | property InactiveCaretSelBkGnd: TColor;
Published | property InactiveCaretSelText: TColor;
Published | property InactiveCaretText: TColor;
Published | property LinesHighLight: TColor;
Published | property SelBkGnd: TColor;
Published | property SelBkGndFocused: TColor;
Published | property SelText: TColor;
Published | property SelTextFocused: TColor;
Published | property Separators: TColor;
Public | property SingleBkGnd: Boolean;
Published | property TextBkgnd: TColor;
Published | property TextText: TColor;
Published | property VertLines: TColor;

Description

Published property AddressBkGnd: TColor;

Address area background color

Published property AddressText: TColor;

Address area text color

Published property BkGnd: TColor;

Hex editor client area background

Public property Color[Index: TKHexEditorColorIndex]: TColor;

Returns always normal color - regardless of the ColorScheme setting

Public property ColorData[Index: TKHexEditorColorIndex]: TKHexEditorColorData;

Returns always a complete color description

Public property ColorName[Index: TKHexEditorColorIndex]: string;

Returns (localizable) color name

Public property Colors: TKColorArray;

Returns array of normal colors

Public property ColorScheme: TKHexEditorColorScheme;

Specifies color scheme for reading of published properties - see GetColor in source code

Published property DigitBkGnd: TColor;

Digits area background color

Published property DigitTextEven: TColor;

Digits area text color - even digit group

Published property DigitTextOdd: TColor;

Digits area text color - odd digit group

Published property HorzLines: TColor;

Color of the horizontal leading lines

Published property InactiveCaretBkGnd: TColor;

Inactive (hex editor without focus) caret background color - caret mark is not part of a selection

Published property InactiveCaretSelBkGnd: TColor;

Inactive (hex editor without focus) caret background color - caret mark is part of a selection

Published property InactiveCaretSelText: TColor;

Inactive (hex editor without focus) caret text color - caret mark is part of a selection

Published property InactiveCaretText: TColor;

Inactive (hex editor without focus) caret text color - caret mark is not part of a selection

Published property LinesHighLight: TColor;

Color of horizontal leading lines involved into a selection

Published property SelBkGnd: TColor;

Selection background - inactive edit area

Published property SelBkGndFocused: TColor;

Selection background - active edit area

Published property SelText: TColor;

Selection text - inactive edit area

Published property SelTextFocused: TColor;

Selection text - active edit area

Published property Separators: TColor;

Color of the vertical area separating lines

Public property SingleBkGnd: Boolean;

BkGnd is used for all areas if True - edSingleBkGnd forward

Published property TextBkgnd: TColor;

Text area background color

Published property TextText: TColor;

Text area text color

Published property VertLines: TColor;

Color of the vertical leading lines


KHexEditor help: KWideWinProcs

Unit KWideWinProcs

Description

This unit contains Unicode equivalents of ANSI Win32 API functions not supported in Win9X without Unicode Layer for Win9X

Copyright © 2008 Tomas Krysl (tk@tkweb.eu)

License:
This code is distributed as a freeware. You are free to use it as part of your application for any purpose including freeware, commercial and shareware applications. The origin of this source code must not be misrepresented; you must not claim your authorship. You may modify this code solely for your own purpose. Please feel free to contact the author if you think your changes might be useful for other users. You may distribute only the original package. The author accepts no liability for any damage that may result from using this code.

Author

Tomas Krysl (tk@tkweb.eu)

Created

10 Jun 2008

Last Modified

14 Oct 2009


KHexEditor help: Class Hierarchy

Class Hierarchy

  • TComponent
    • TKPrintPreviewDialog
    • TKPrintSetupDialog
  • TCustomControl
    • TKCustomControl
      • TKCustomHexEditor
        • TKHexEditor
      • TKPrintPreview
  • TGraphic
    • TKAlphaBitmap
  • THintWindow
    • TKHintWindow
      • TKGraphicHint
      • TKTextHint
  • TList
    • TKHexEditorChangeList
  • TObject
    • TKDragWindow
  • TPersistent
    • TKHexEditorColors
    • TKPreviewColors
    • TKPrintPageSetup


KHexEditor help: All Classes, Interfaces and Objects

All Classes, Interfaces and Objects

Name | Unit | Description
TKAlphaBitmap | KGraphics | A simple platform independent encapsulation for a 32bpp bitmap with alpha channel with the ability to modify it's pixels directly.
TKCustomControl | KControls | Base class for all visible controls in KControls.
TKCustomHexEditor | KHexEditor | Hexadecimal editor base component
TKDragWindow | KGraphics | Encapsulates the drag window
TKGraphicHint | KGraphics |
TKHexEditor | KHexEditor | Hexadecimal editor design-time component
TKHexEditorChangeList | KHexEditor | Change (undo/redo item) list manager
TKHexEditorColors | KHexEditor | Container for all colors used by TKCustomHexEditor class
TKHintWindow | KGraphics | Base class for KControls hints
TKPreviewColors | KControls | Container for all colors used by TKPrintPreview class
TKPrintPageSetup | KControls | Class to specify the print job parameters
TKPrintPreview | KControls | Print preview control for the TKCustomControl component
TKPrintPreviewDialog | KDialogs | Encapsulates the print preview dialog
TKPrintSetupDialog | KDialogs | Encapsulates the print preview dialog
TKTextHint | KGraphics | Hint window to display formatted text


KHexEditor help: All Types

All Types

Name | Unit | Description
PBytes | KFunctions | Pointer for TBytes.
PCardinals | KFunctions | Pointer for TCardinals.
PChars | KFunctions | Pointer for TChars.
PDataSize | KFunctions | Pointer for TDataSize
PDoubles | KFunctions | Pointer for TDoubles.
PExtendeds | KFunctions | Pointer for TExtendeds.
PInt64s | KFunctions | Pointer for TInt64s.
PIntegers | KFunctions | Pointer for TIntegers.
PKColorRec | KGraphics | Pointer to TKColorRec.
PKColorRecs | KGraphics | Dynamic array for TKColorRecs.
PKHexEditorChangeItem | KHexEditor | Pointer to TKHexEditorChangeItem
PLongInts | KFunctions | Pointer for TLongInts.
PLongWords | KFunctions | Pointer for TLongWords.
PShortInts | KFunctions | Pointer for TShortInts.
PSingles | KFunctions | Pointer for TSingles.
PSmallInts | KFunctions | Pointer for TSmallInts.
PWords | KFunctions | Pointer for TWords.
TBytes | KFunctions | Static array for Byte.
TCardinals | KFunctions | Static array for Cardinal.
TChars | KFunctions | Static array for Char.
TDataSize | KFunctions | Useful structure to handle general data and size as a single item
TDoubles | KFunctions | Static array for Double.
TDynBytes | KFunctions | Dynamic array for Byte.
TDynCardinals | KFunctions | Dynamic array for Cardinal.
TDynChars | KFunctions | Dynamic array for Char.
TDynDoubles | KFunctions | Dynamic array for Double.
TDynExtendeds | KFunctions | Dynamic array for Extended.
TDynInt64s | KFunctions | Dynamic array for Int64.
TDynIntegers | KFunctions | Dynamic array for Integer.
TDynLongInts | KFunctions | Dynamic array for LongInt.
TDynLongWords | KFunctions | Dynamic array for LongWord.
TDynShortInts | KFunctions | Dynamic array for ShortInt.
TDynSingles | KFunctions | Dynamic array for Single.
TDynSmallInts | KFunctions | Dynamic array for SmallInt.
TDynWords | KFunctions | Dynamic array for Word.
TExtendeds | KFunctions | Static array for Extended.
TInt64s | KFunctions | Static array for Int64.
TIntegers | KFunctions | Static array for Integer.
TKColorArray | KControls | This array serves as storage place for all colors.
TKColorRec | KGraphics | Declares RGB + Alpha channel color description allowing both to access single channels and the whole color item.
TKColorRecs | KGraphics | Dynamic array for TKColorRec.
TKCurrencyFormat | KFunctions | Defines a currency format settings for FormatCurrency.
TKDynColorRecs | KGraphics | Dynamic array for TKColorRec.
TKHexEditorAreaDimensions | KHexEditor | Contains dimensions of all areas in characters
TKHexEditorChangeItem | KHexEditor | Declares the undo/redo item description structure used by the TKHexEditorChangeList class
TKHexEditorColorData | KHexEditor | Declares the color description structure returned by ColorData property
TKHexEditorColorIndex | KHexEditor | Declares possible indexes e.g. for the Color property.
TKHexEditorColorSpec | KHexEditor | Declares TKHexEditorColors color item description
TKHexEditorDrawStyles | KHexEditor | Drawing styles can be arbitrary combined
TKHexEditorPaintData | KHexEditor | Declares the paint data structure for the PaintLines method
TKHexEditorSelection | KHexEditor | Declares the selection structure
TKHexEditorSelText | KHexEditor | Declares the structure for the SelText property
TKHexEditorStates | KHexEditor | Hex editor states can be arbitrary combined
TKHexEditorUndoChangeEvent | KHexEditor | Declares OnChange event handler
TKImageHeaderString | KGraphics | String type for ImageByType function.
TKPreviewChangedEvent | KControls | Declares OnChanged event handler
TKPreviewColorIndex | KControls | Declares possible indexes e.g. for the Color property.
TKPrintMeasureInfo | KControls | Declares the information structure for the MeasurePages method
TKPrintNotifyEvent | KControls | Declares OnPrintNotify event handler
TKPrintOptions | KControls | Print options can be arbitrary combined.
TKPrintPaintEvent | KControls | Declares OnPrintPaint event handler
TKSysCharSet | KFunctions | Set type for CharInSetEx.
TKTextAttributes | KGraphics | Set type for TKTextAttribute enumeration.
TKTextHAlign | KGraphics | For backward compatibility.
TKTextVAlign | KGraphics | For backward compatibility.
TLongInts | KFunctions | Static array for LongInt.
TLongWords | KFunctions | Static array for LongWord.
TShortInts | KFunctions | Static array for ShortInt.
TSingles | KFunctions | Static array for Single.
TSmallInts | KFunctions | Static array for SmallInt.
TWords | KFunctions | Static array for Word.


KHexEditor help: All Enumerations

All Enumerations

Name | Unit | Description
TKBrightMode | KGraphics | Declares possible values for the Style parameter of the BrightColor function.
TKHAlign | KGraphics | Declares possible values for the HAlign parameter in the DrawAlignedText function.
TKHexEditorAddressMode | KHexEditor | Declares possible values for the AddressMode property
TKHexEditorArea | KHexEditor | Declares possible values e.g. for the EditArea property
TKHexEditorChangeReason | KHexEditor | Declares possible values for the ItemReason member of the TKHexEditorChangeItem structure
TKHexEditorColorScheme | KHexEditor | Declares possible values for the ColorScheme property
TKHexEditorDisabledDrawStyle | KHexEditor | Declares possible values for the DisabledDrawStyle property
TKHexEditorDrawStyle | KHexEditor | Declares drawing styles - possible values for the DrawStyles property
TKHexEditorState | KHexEditor | Declares hex editor states - possible values for the States property (protected)
TKPreviewScaleMode | KControls | Declares possible values for the ScaleMode property
TKPrintOption | KControls | Declares print options - possible values for the Options property.
TKPrintRange | KControls | Declares possible values for the Range property.
TKPrintStatus | KControls | Declares possible values for the Status parameter in the TKPrintNotifyEvent event
TKPrintUnits | KControls | Declares measurement units for KControls printing system.
TKStretchMode | KGraphics | Declares possible values for the StretchMode parameter in the ExcludeShapeFromBaseRect function.
TKTextAttribute | KGraphics | Declares possible values for the Attributes parameter in the DrawAlignedText function.
TKVAlign | KGraphics | Declares possible values for the VAlign parameter in the DrawAlignedText function.


KHexEditor help: All Variables

All Variables

None


KHexEditor help: All Constants

All Constants

Name | Unit | Description
cAddressBkgndDef | KHexEditor | Default value for the AddressBkGnd color property
cAddressCursorDef | KHexEditor | Default value for the AddressCursor property
cAddressModeDef | KHexEditor | Default value for the AddressMode property
cAddressOffsetDef | KHexEditor | Default value for the AddressOffset property
cAddressPrefixDef | KHexEditor | Default value for the AddressPrefix property
cAddressSizeDef | KHexEditor | Default value for the AddressSize property
cAddressSizeMax | KHexEditor | Maximum for the AddressSize property
cAddressSizeMin | KHexEditor | Minimum for the AddressSize property
cAddressTextDef | KHexEditor | Default value for the AddressText color property
cAreaSpacingDef | KHexEditor | Default value for the AreaSpacing property
cAreaSpacingMax | KHexEditor | Maximum for the AreaSpacing property
cAreaSpacingMin | KHexEditor | Minimum for the AreaSpacing property
cBkGndDef | KHexEditor | Default value for the BkGnd color property
cBkGndDef | KControls | Default value for the BkGnd color property.
cBorderDef | KControls | Default value for the Border color property.
cBorderStyleDef | KControls | Default value for the BorderStyle property.
cCharSpacingDef | KHexEditor | Default value for the CharSpacing property
cCharSpacingMax | KHexEditor | Maximum for the CharSpacing property
cCharSpacingMin | KHexEditor | Minimum for the CharSpacing property
cCheckBoxFrameSize | KFunctions | Checkbox frame size in logical screen units.
cCopiesDef | KControls | Default value for the Copies property
cCopiesMax | KControls | Maximum for the Copies property
cCopiesMin | KControls | Minimum for the Copies property
cCR | KFunctions | Carriage return character.
cDigitBkGndDef | KHexEditor | Default value for the DigitBkGnd color property
cDigitGroupingDef | KHexEditor | Default value for the DigitGrouping property
cDigitGroupingMax | KHexEditor | Maximum for the DigitGrouping property
cDigitGroupingMin | KHexEditor | Minimum for the DigitGrouping property
cDigitTextEvenDef | KHexEditor | Default value for the DigitTextEven color property
cDigitTextOddDef | KHexEditor | Default value for the DigitTextOdd color property
cDisabledDrawStyleDef | KHexEditor | Default value for the DisabledDrawStyle property
cDrawStylesDef | KHexEditor | Default value for the DrawStyles property
cEllipsis | KFunctions | Text ellipsis string.
cFontNameDef | KHexEditor | Default value for the Font.Name property
cFontSizeDef | KHexEditor | Default value for the Font.Size property
cFontSizeMax | KHexEditor | Maximum for the Font.Size property
cFontSizeMin | KHexEditor | Minimum for the Font.Size property
cFontStyleDef | KHexEditor | Default value for the Font.Style property
cHeight | KHexEditor | Default value for the Height property
cHorzLinesDef | KHexEditor | Default value for the HorzLines color property
ciAddressBkGnd | KHexEditor | Index for the AddressBkGnd color property
ciAddressText | KHexEditor | Index for the AddressText color property
ciBkGnd | KControls | Index for the BkGnd property.
ciBkGnd | KHexEditor | Index for the BkGnd color property
ciBorder | KControls | Index for the Border property.
ciDigitBkGnd | KHexEditor | Index for the DigitBkGnd color property
ciDigitTextEven | KHexEditor | Index for the DigitTextEven color property
ciDigitTextOdd | KHexEditor | Index for the DigitTextOdd color property
ciHexEditorColorsMax | KHexEditor | Maximum color array index
ciHorzLines | KHexEditor | Index for the HorzLines color property
ciInactiveCaretBkGnd | KHexEditor | Index for the InactiveCaretBkGnd color property
ciInactiveCaretSelBkGnd | KHexEditor | Index for the InactiveCaretSelBkGnd color property
ciInactiveCaretSelText | KHexEditor | Index for the InactiveCaretSelText color property
ciInactiveCaretText | KHexEditor | Index for the InactiveCaretText color property
ciLinesHighLight | KHexEditor | Index for the LinesHighLight color property
cInactiveCaretBkGndDef | KHexEditor | Default value for the InactiveCaretBkGnd color property
cInactiveCaretSelBkGndDef | KHexEditor | Default value for the InactiveCaretSelBkGnd color property
cInactiveCaretSelTextDef | KHexEditor | Default value for the InactiveCaretSelText color property
cInactiveCaretTextDef | KHexEditor | Default value for the InactiveCaretText color property
cInvalidIndex | KHexEditor | Declares the Index member of the TKHexEditorSelection record invalid
ciPaper | KControls | Index for the Paper property.
ciPreviewColorsMax | KControls | Maximum color array index
ciSelBkGnd | KHexEditor | Index for the SelBkGnd color property
ciSelBkGndFocused | KHexEditor | Index for the SelBkGndFocused color property
ciSelectedBorder | KControls | Index for the SelectedBorder property.
ciSelText | KHexEditor | Index for the SelText color property
ciSelTextFocused | KHexEditor | Index for the SelTextFocused color property
ciSeparators | KHexEditor | Index for the Separators color property
ciTextBkGnd | KHexEditor | Index for the TextBkgnd color property
ciTextText | KHexEditor | Index for the TextText color property
ciVertLines | KHexEditor | Index for the VertLines color property
cLF | KFunctions | Line feed character.
cLineBreaks | KFunctions | Set of line break characters.
cLineHeightPercentDef | KHexEditor | Default value for the LineHeightPercent property
cLineHeightPercentMax | KHexEditor | Maximum for the LineHeightPercent property
cLineHeightPercentMin | KHexEditor | Minimum for the LineHeightPercent property
cLinesHighLightDef | KHexEditor | Default value for the LinesHighLight color property
cLineSizeDef | KHexEditor | Default value for the LineSize property
cLineSizeMax | KHexEditor | Maximum for the LineSize property
cLineSizeMin | KHexEditor | Minimum for the LineSize property
cMarginBottomDef | KControls | Default value for the MarginBottom property
cMarginLeftDef | KControls | Default value for the MarginLeft property
cMarginRightDef | KControls | Default value for the MarginRight property
cMarginTopDef | KControls | Default value for the MarginTop property
cOptionsDef | KControls | Default value for the Options property.
cPaperDef | KControls | Default value for the Paper color property.
cPF_Dragging | KControls | Internal flag for TKPrintPreview.
cPF_UpdateRange | KControls | Internal flag for TKPrintPreview.
cRangeDef | KControls | Default value for the Options property.
crDragHandFree | KFunctions | Constant for uncaptured dragging cursor.
crDragHandGrip | KFunctions | Constant for captured dragging cursor.
crHResize | KFunctions | Constant for horizontal resize cursor.
crVResize | KFunctions | Constant for vertical resize cursor.
cScaleDef | KControls | Minimum for the Scale property
cScaleMax | KControls | Default value for the Scale property
cScaleMin | KControls | Maximum for the Scale property
cScrollDelta | KControls | Constant for control scrollbars. It means: Use given Delta to update scrollbar.
cScrollNoAction | KControls | Constant for control scrollbars. It means: Leave that scrollbar untouched.
cScrollSpeedDef | KHexEditor | Default value for the ScrollSpeed property
cScrollSpeedMax | KHexEditor | Maximum for the ScrollSpeed property
cScrollSpeedMin | KHexEditor | Minimum for the ScrollSpeed property
cSelBkGndDef | KHexEditor | Default value for the SelBkGnd color property
cSelBkGndFocusedDef | KHexEditor | Default value for the SelBkGndFocused color property
cSelectedBorderDef | KControls | Default value for the SelectedBorder color property.
cSelTextDef | KHexEditor | Default value for the SelText color property
cSelTextFocusedDef | KHexEditor | Default value for the SelTextFocused color property
cSeparatorsDef | KHexEditor | Default value for the Separators color property
cTextBkgndDef | KHexEditor | Default value for the TextBkgnd color property
cTextTextDef | KHexEditor | Default value for the TextText color property
cUndoLimitDef | KHexEditor | Default value for the UndoLimit property
cUndoLimitMax | KHexEditor | Maximum for the UndoLimit property
cUndoLimitMin | KHexEditor | Minimum for the UndoLimit property
cUnitsDef | KControls | Default value for the Units property.
cVertLinesDef | KHexEditor | Default value for the VertLines color property
cWidth | KHexEditor | Default value for the Width property
cWordBreaks | KFunctions | Set of word break characters.
KM_BASE | KFunctions | Base for custom messages used by KControls suite.
KM_LATEUPDATE | KFunctions | Custom message.
MNGHeader | KGraphics |
PNGHeader | KGraphics | PNG Support


KHexEditor help: All Functions and Procedures

All Functions and Procedures

Name | Unit | Description
AdjustDecimalSeparator | KFunctions | Replaces possible decimal separators in S with DecimalSeparator variable.
AnsiStringToWideChar | KFunctions | Converts an AnsiString into a PWideChar string. If CodePage is not set the current system code page for ANSI-UTFx translations will be used.
AsciiToInt | KFunctions | Converts a binary string into integer with custom alignment (given by Digits).
BCDToInt | KFunctions | Converts a BCD number into integer value.
BinaryToDigits KHexEditor Converts binary data into hexadecimal digit string.
    Parameters:
  • Buffer - binary data - intended for Buffer
  • SelStart, SelEnd - specifies which part of the buffer is about to be converted. SelStart.Index must be lower or equal to SelEnd.Index - intended for GetRealSelStart and GetRealSelEnd.
BinaryToText KHexEditor Converts binary data into text using given character mapping.
    Parameters:
  • Buffer - binary data - intended for Buffer
  • SelStart, SelEnd - specifies which part of the buffer is about to be converted. SelStart must be lower or equal to SelEnd. These parameters are integers since no digit selections are necessary.
  • CharMapping - required character mapping scheme
BinStrToBinary | KHexEditor | Converts a binary value string into binary data. If the binary value string is not divisible by 2, it will be right padded with zero. Example: '#A#F#0#1#D#C#0#5#3' is converted into '#AF#01#DC#05#30'.
BinStrToInt | KFunctions | Converts a binary digit string into integer with custom alignment (given by Digits) and sign of a value represented by the string (given by Signed). Code returns either zero for a successful conversion or the position of first bad character.
BlendLine | KGraphics | Draws Src to Dest with per pixel weighting by alpha channel saved in Src.
BrightColor KGraphics Calculates a brighter color of given color based on the HSL color space.
    Parameters:
  • Color - input color.
  • Percent - percentage of luminosity to bright the color (0 to 1).
  • Mode - identifies how the Percent parameter should be interpreted.
CallTrackMouseEvent | KFunctions | Under Windows this function calls the WinAPI TrackMouseEvent. Under other OSes the implementation is still missing.
CanvasGetScale | KGraphics | Returns current canvas window/wiewport scaling.
CanvasResetScale | KGraphics | Selects the default window/wiewport scaling to given canvas for both axes.
CanvasScaled | KGraphics | Returns True if the ACanvas's device context has been mapped to anything else than MM_TEXT.
CanvasSetOffset | KGraphics | Selects the wiewport offset to given canvas for both axes.
CanvasSetScale | KGraphics | Selects the window/wiewport scaling to given canvas for both axes.
CharInSetEx | KFunctions | Compiler independent Delphi2009-like CharInSet function for ANSI characters.
CharInSetEx | KFunctions | Compiler independent Delphi2009-like CharInSet function for Unicode characters.
ColorToGrayScale | KGraphics | Makes a grayscale representation of the given color.
CompareIntegers | KFunctions | Compares two Integers. Returns 1 if I1 > I2, -1 if I1 < I2 and 0 if I1 = I2.
CompareWideChars | KFunctions | Compares two PWideChar strings. Returns 1 if W1 > W2, -1 if W1 < W2 and 0 if W1 = W2. The strings will be compared using the default user locale unless another locale has been specified in Locale.
CompareWideStrings | KFunctions | Compares two WideString strings. Returns 1 if W1 > W2, -1 if W1 < W2 and 0 if W1 = W2. The strings will be compared using the default user locale unless another locale has been specified in Locale.
CopyBitmap | KGraphics | Calls BitBlt.
CreateEmptyRgn | KGraphics | Creates an empty rectangular region.
DecStrToInt | KFunctions | Converts a decimal digit string into integer. Code returns either zero for a successful conversion or the position of first bad character. Equals to Val.
DigitsToBinStr KHexEditor Examines/converts hexadecimal digit string to binary value string. Returns True if the digit string is valid.
    Parameters:
  • S - hexadecimal digit string (e.g. 'AF01 DC05 3'). White spaces will be ignored. When Convert is True, the converted binary value string will be returned via this parameter (in this exammple '#A#F#0#1#D#C#0#5#3').
  • Convert - the digit string will be converted if True, otherwise it will be examined only.
DigitToBin | KHexEditor | Converts a hexadecimal digit character ('0'..'F') to binary value
DivDown | KFunctions | Performs integer division. If there is a nonzero remainder, the result will be decremented.
DivUp | KFunctions | Performs integer division. If there is a nonzero remainder, the result will be incremented.
DrawAlignedText | KGraphics | Draws Text to the Canvas at location given by ARect. HAlign and VAlign specify horizontal resp. vertical alignment of the text within ARect. HPadding and VPadding specify horizontal (both on left and right side) and vertical (both on top and bottom side) padding of the Text from ARect. BackColor specifies the fill color for brush gaps if a non solid Brush is defined in Canvas. Attributes specift various text output attributes.
DrawEdges | KGraphics | Simulates WinAPI DrawEdge with customizable colors.
DrawFilledRectangle | KGraphics | Draws a rectangle to Canvas. The rectangle coordinates are given by Rect. The rectangle is filled by Brush. If Brush is not solid, its gaps are filled with BackColor. If BackColor is clNone these gaps are not filled and the Brush appears transparent.
Error | KFunctions | Raises a general exception with associated message Msg.
Exchange | KFunctions | Swaps values of two Cardinal variables.
Exchange | KFunctions | Swaps values of two Int64 variables.
Exchange | KFunctions | Swaps values of two Single variables.
Exchange | KFunctions | Swaps values of two Char variables.
Exchange | KFunctions | Swaps values of two Double variables.
Exchange | KFunctions | Swaps values of two Extended variables.
Exchange | KFunctions | Swaps values of two ShortInt variables.
Exchange | KFunctions | Swaps values of two SmallInt variables.
Exchange | KFunctions | Swaps values of two Integer variables.
Exchange | KFunctions | Swaps values of two Byte variables.
Exchange | KFunctions | Swaps values of two Word variables.
ExcludeShapeFromBaseRect | KGraphics | This helper function excludes a rectangular area occupied by a shape from BaseRect and calculates the shape area rectangles Bounds and Interior. The shape area is specified by the shape extent (ShapeWidth and ShapeHeight), padding (HPadding and VPadding) and stretching mode (StretchMode). The returned Bounds includes (possibly stretched) shape + padding, and Interior includes only the (possibly stretched) shape. HAlign specifies the horizontal alignment of shape area within BaseRect. VAlign specifies the vertical alignment of shape area within BaseRect. The shape area is always excluded horizontally from BaseRect, as needed by cell data calculations in KGrid.
ExtSelectClipRect | KGraphics | Selects ARect into device context. Returns previous clipping region.
ExtSelectClipRectEx | KGraphics | Selects ARect into device context. Combines with CurRgn and returns previous clipping region. Both regions have to be created first.
FillAroundRect | KGraphics | Fills the area specified by the difference Boundary - Interior on ACanvas with current Brush. If Brush is not solid, its gaps are filled with BackColor. If BackColor is clNone these gaps are not filled and the Brush appears transparent.
FillMessage | KFunctions | Fills the message record.
FinalizePrevRgn | KGraphics | Selects the region into given device context and deletes the region.
FormatCurrency | KFunctions | Formats the given currency value with to specified parameters. Not thread safe.
GDICheck | KGraphics | Raises an exception if GDI resource has not been created.
GetAppVersion | KFunctions | Returns the module version for given module. Works under WinX only.
GetColorSpec | KHexEditor | Returns the instance-independent color specification for the given color index
GetControlText | KFunctions | Returns the Text property of any TWinControl instance as WideString (up to Delphi 2007) or string (Delphi 2009, Lazarus).
GetFontHeight | KGraphics | Determine the height (ascent + descent) of the font currently selected into given DC.
GetShiftState | KFunctions | Returns current status of Shift, Alt and Ctrl keys.
HexStrToInt | KFunctions | Converts a hexadecimal digit string into integer with custom alignment (given by Digits) and sign of a value represented by the string (given by Signed). Code returns either zero for a successful conversion or the position of first bad character.
ImageByType | KGraphics | Creates a TGraphic instance according to the image file header. Currently supported images are BMP, PNG, MNG, JPG, ICO.
InchesToValue KControls Converts a value given in inches into a value given in specified units.
    Parameters:
  • Units - measurement units for the output value
  • Value - input value to convert
IntersectClipRectIndirect | KGraphics | Calls the IntersectClipRect function.
IntPowerInt KFunctions
IntToAscii | KFunctions | Converts an integer into binary string with custom alignment (given by Digits).
IntToBCD | KFunctions | Converts an integer value into BCD number.
IntToBinStr | KFunctions | Converts an integer into binary digit string with custom alignment (given by Digits) and suffix.
IntToDecStr | KFunctions | Converts an integer into decimal digit string. Equals to IntToStr.
IntToHexStr | KFunctions | Converts an integer into hexadecimal digit string with custom alignment (given by Digits), prefix and suffix. Digits represented by alphabetical characters can be either in lower or upper case.
IsBrightColor | KGraphics | Determines if given color has lightness > 0.5.
LoadCustomCursor | KGraphics | Loads a custom mouse cursor.
MakeColorRec | KGraphics | Builds a TKColorRec structure.
MakeSelection | KHexEditor | Creates a selection structure from given Index and Digit parameters
MinMax | KFunctions | Returns a clipped Extended value so that it lies between Min and Max
MinMax | KFunctions | Returns a clipped Single value so that it lies between Min and Max
MinMax | KFunctions | Returns a clipped Double value so that it lies between Min and Max
MinMax | KFunctions | Returns a clipped ShortInt value so that it lies between Min and Max
MinMax | KFunctions | Returns a clipped Int64 value so that it lies between Min and Max
MinMax | KFunctions | Returns a clipped SmallInt value so that it lies between Min and Max
MinMax | KFunctions | Returns a clipped Integer value so that it lies between Min and Max
PixelFormatFromBpp | KGraphics | Returns a pixel format that matches Bpp.
RectInRegion | KGraphics | In Lazarus this WinAPI function is missing.
ReplaceDigit KHexEditor Replaces a hexadecimal digit in the given binary value. Returns the original value with a replaced digit.
    Parameters:
  • Value - original binary value
  • Digit - digit value (0..15)
  • Pos - digit position (order)
Example: Value = $A18D, Digit = $C, Pos = 3: Result = $AC8D
SafeStretchDraw | KGraphics | Paints an image so that it fits in ARect. Performs double buffering and fills the background with current brush for mapped device contexts.
SelectClipRect | KGraphics | Selects ARect as new clipping region into the device context.
SetControlClipRect | KFunctions | Under Windows this function calls the WinAPI SetWindowRgn. Under other OSes the implementation is still missing.
SetControlText | KFunctions | Modifies the Text property of any TWinControl instance. The value is given as WideString (up to Delphi 2007) or string (Delphi 2009, Lazarus).
StretchBitmap | KGraphics | Calls StretchBlt.
StringCharBegin | KFunctions | Returns the index for given string where character at given index begins. Takes MBCS (UTF8 in Lazarus) into account.
StringLength | KFunctions | Returns the number of characters in a string. Under Delphi it equals Length, under Lazarus it equals UTF8Length.
StringNextCharIndex | KFunctions | Returns next character index for given string and character index. Takes MBCS (UTF8 in Lazarus) into account.
StrNextCharIndex | KFunctions | Returns next character index for given null terminated string and character index. Takes MBCS (UTF8 in Lazarus) into account.
SwitchRGBToBGR | KGraphics | Swaps the color format from RGB to BGR and vice versa.
TranslateRectToDevice | KGraphics | Subtracts the current device context offset to ARect.
TrimWhiteSpaces | KFunctions | Trims characters specified by ASet from the beginning and end of AText. New text length is returned by ALen.
TrimWhiteSpaces | KFunctions | Trims characters specified by ASet from the beginning and end of AText.
ValueToInches KControls Converts value given in specified units into a value given in inches.
    Parameters:
  • Units - measurement units for the input value
  • Value - input value to convert
WideCharToAnsiString | KFunctions | Converts a PWideChar string into AnsiString. If CodePage is not set the current system code page for ANSI-UTFx translations will be used.


KHexEditor help: All Identifiers

All Identifiers

Name | Unit | Description
AdjustDecimalSeparator | KFunctions | Replaces possible decimal separators in S with DecimalSeparator variable.
AnsiStringToWideChar | KFunctions | Converts an AnsiString into a PWideChar string. If CodePage is not set the current system code page for ANSI-UTFx translations will be used.
AsciiToInt | KFunctions | Converts a binary string into integer with custom alignment (given by Digits).
BCDToInt | KFunctions | Converts a BCD number into integer value.
BinaryToDigits KHexEditor Converts binary data into hexadecimal digit string.
    Parameters:
  • Buffer - binary data - intended for Buffer
  • SelStart, SelEnd - specifies which part of the buffer is about to be converted. SelStart.Index must be lower or equal to SelEnd.Index - intended for GetRealSelStart and GetRealSelEnd.
BinaryToText KHexEditor Converts binary data into text using given character mapping.
    Parameters:
  • Buffer - binary data - intended for Buffer
  • SelStart, SelEnd - specifies which part of the buffer is about to be converted. SelStart must be lower or equal to SelEnd. These parameters are integers since no digit selections are necessary.
  • CharMapping - required character mapping scheme
BinStrToBinary | KHexEditor | Converts a binary value string into binary data. If the binary value string is not divisible by 2, it will be right padded with zero. Example: '#A#F#0#1#D#C#0#5#3' is converted into '#AF#01#DC#05#30'.
BinStrToInt | KFunctions | Converts a binary digit string into integer with custom alignment (given by Digits) and sign of a value represented by the string (given by Signed). Code returns either zero for a successful conversion or the position of first bad character.
BlendLine | KGraphics | Draws Src to Dest with per pixel weighting by alpha channel saved in Src.
BrightColor KGraphics Calculates a brighter color of given color based on the HSL color space.
    Parameters:
  • Color - input color.
  • Percent - percentage of luminosity to bright the color (0 to 1).
  • Mode - identifies how the Percent parameter should be interpreted.
cAddressBkgndDef | KHexEditor | Default value for the AddressBkGnd color property
cAddressCursorDef | KHexEditor | Default value for the AddressCursor property
cAddressModeDef | KHexEditor | Default value for the AddressMode property
cAddressOffsetDef | KHexEditor | Default value for the AddressOffset property
cAddressPrefixDef | KHexEditor | Default value for the AddressPrefix property
cAddressSizeDef | KHexEditor | Default value for the AddressSize property
cAddressSizeMax | KHexEditor | Maximum for the AddressSize property
cAddressSizeMin | KHexEditor | Minimum for the AddressSize property
cAddressTextDef | KHexEditor | Default value for the AddressText color property
CallTrackMouseEvent | KFunctions | Under Windows this function calls the WinAPI TrackMouseEvent. Under other OSes the implementation is still missing.
CanvasGetScale | KGraphics | Returns current canvas window/wiewport scaling.
CanvasResetScale | KGraphics | Selects the default window/wiewport scaling to given canvas for both axes.
CanvasScaled | KGraphics | Returns True if the ACanvas's device context has been mapped to anything else than MM_TEXT.
CanvasSetOffset | KGraphics | Selects the wiewport offset to given canvas for both axes.
CanvasSetScale | KGraphics | Selects the window/wiewport scaling to given canvas for both axes.
cAreaSpacingDef | KHexEditor | Default value for the AreaSpacing property
cAreaSpacingMax | KHexEditor | Maximum for the AreaSpacing property
cAreaSpacingMin | KHexEditor | Minimum for the AreaSpacing property
cBkGndDef | KControls | Default value for the BkGnd color property.
cBkGndDef | KHexEditor | Default value for the BkGnd color property
cBorderDef | KControls | Default value for the Border color property.
cBorderStyleDef | KControls | Default value for the BorderStyle property.
cCharSpacingDef | KHexEditor | Default value for the CharSpacing property
cCharSpacingMax | KHexEditor | Maximum for the CharSpacing property
cCharSpacingMin | KHexEditor | Minimum for the CharSpacing property
cCheckBoxFrameSize | KFunctions | Checkbox frame size in logical screen units.
cCopiesDef | KControls | Default value for the Copies property
cCopiesMax | KControls | Maximum for the Copies property
cCopiesMin | KControls | Minimum for the Copies property
cCR | KFunctions | Carriage return character.
cDigitBkGndDef | KHexEditor | Default value for the DigitBkGnd color property
cDigitGroupingDef | KHexEditor | Default value for the DigitGrouping property
cDigitGroupingMax | KHexEditor | Maximum for the DigitGrouping property
cDigitGroupingMin | KHexEditor | Minimum for the DigitGrouping property
cDigitTextEvenDef | KHexEditor | Default value for the DigitTextEven color property
cDigitTextOddDef | KHexEditor | Default value for the DigitTextOdd color property
cDisabledDrawStyleDef | KHexEditor | Default value for the DisabledDrawStyle property
cDrawStylesDef | KHexEditor | Default value for the DrawStyles property
cEllipsis | KFunctions | Text ellipsis string.
cFontNameDef | KHexEditor | Default value for the Font.Name property
cFontSizeDef | KHexEditor | Default value for the Font.Size property
cFontSizeMax | KHexEditor | Maximum for the Font.Size property
cFontSizeMin | KHexEditor | Minimum for the Font.Size property
cFontStyleDef | KHexEditor | Default value for the Font.Style property
CharInSetEx | KFunctions | Compiler independent Delphi2009-like CharInSet function for Unicode characters.
CharInSetEx | KFunctions | Compiler independent Delphi2009-like CharInSet function for ANSI characters.
cHeight | KHexEditor | Default value for the Height property
cHorzLinesDef | KHexEditor | Default value for the HorzLines color property
ciAddressBkGnd | KHexEditor | Index for the AddressBkGnd color property
ciAddressText | KHexEditor | Index for the AddressText color property
ciBkGnd | KHexEditor | Index for the BkGnd color property
ciBkGnd | KControls | Index for the BkGnd property.
ciBorder | KControls | Index for the Border property.
ciDigitBkGnd | KHexEditor | Index for the DigitBkGnd color property
ciDigitTextEven | KHexEditor | Index for the DigitTextEven color property
ciDigitTextOdd | KHexEditor | Index for the DigitTextOdd color property
ciHexEditorColorsMax | KHexEditor | Maximum color array index
ciHorzLines | KHexEditor | Index for the HorzLines color property
ciInactiveCaretBkGnd | KHexEditor | Index for the InactiveCaretBkGnd color property
ciInactiveCaretSelBkGnd | KHexEditor | Index for the InactiveCaretSelBkGnd color property
ciInactiveCaretSelText | KHexEditor | Index for the InactiveCaretSelText color property
ciInactiveCaretText | KHexEditor | Index for the InactiveCaretText color property
ciLinesHighLight | KHexEditor | Index for the LinesHighLight color property
cInactiveCaretBkGndDef | KHexEditor | Default value for the InactiveCaretBkGnd color property
cInactiveCaretSelBkGndDef | KHexEditor | Default value for the InactiveCaretSelBkGnd color property
cInactiveCaretSelTextDef | KHexEditor | Default value for the InactiveCaretSelText color property
cInactiveCaretTextDef | KHexEditor | Default value for the InactiveCaretText color property
cInvalidIndex | KHexEditor | Declares the Index member of the TKHexEditorSelection record invalid
ciPaper | KControls | Index for the Paper property.
ciPreviewColorsMax | KControls | Maximum color array index
ciSelBkGnd | KHexEditor | Index for the SelBkGnd color property
ciSelBkGndFocused | KHexEditor | Index for the SelBkGndFocused color property
ciSelectedBorder | KControls | Index for the SelectedBorder property.
ciSelText | KHexEditor | Index for the SelText color property
ciSelTextFocused | KHexEditor | Index for the SelTextFocused color property
ciSeparators | KHexEditor | Index for the Separators color property
ciTextBkGnd | KHexEditor | Index for the TextBkgnd color property
ciTextText | KHexEditor | Index for the TextText color property
ciVertLines | KHexEditor | Index for the VertLines color property
cLF | KFunctions | Line feed character.
cLineBreaks | KFunctions | Set of line break characters.
cLineHeightPercentDef | KHexEditor | Default value for the LineHeightPercent property
cLineHeightPercentMax | KHexEditor | Maximum for the LineHeightPercent property
cLineHeightPercentMin | KHexEditor | Minimum for the LineHeightPercent property
cLinesHighLightDef | KHexEditor | Default value for the LinesHighLight color property
cLineSizeDef | KHexEditor | Default value for the LineSize property
cLineSizeMax | KHexEditor | Maximum for the LineSize property
cLineSizeMin | KHexEditor | Minimum for the LineSize property
cMarginBottomDef | KControls | Default value for the MarginBottom property
cMarginLeftDef | KControls | Default value for the MarginLeft property
cMarginRightDef | KControls | Default value for the MarginRight property
cMarginTopDef | KControls | Default value for the MarginTop property
ColorToGrayScale | KGraphics | Makes a grayscale representation of the given color.
CompareIntegers | KFunctions | Compares two Integers. Returns 1 if I1 > I2, -1 if I1 < I2 and 0 if I1 = I2.
CompareWideChars | KFunctions | Compares two PWideChar strings. Returns 1 if W1 > W2, -1 if W1 < W2 and 0 if W1 = W2. The strings will be compared using the default user locale unless another locale has been specified in Locale.
CompareWideStrings | KFunctions | Compares two WideString strings. Returns 1 if W1 > W2, -1 if W1 < W2 and 0 if W1 = W2. The strings will be compared using the default user locale unless another locale has been specified in Locale.
cOptionsDef | KControls | Default value for the Options property.
CopyBitmap | KGraphics | Calls BitBlt.
cPaperDef | KControls | Default value for the Paper color property.
cPF_Dragging | KControls | Internal flag for TKPrintPreview.
cPF_UpdateRange | KControls | Internal flag for TKPrintPreview.
cRangeDef | KControls | Default value for the Options property.
crDragHandFree | KFunctions | Constant for uncaptured dragging cursor.
crDragHandGrip | KFunctions | Constant for captured dragging cursor.
CreateEmptyRgn | KGraphics | Creates an empty rectangular region.
crHResize | KFunctions | Constant for horizontal resize cursor.
crVResize | KFunctions | Constant for vertical resize cursor.
cScaleDef | KControls | Minimum for the Scale property
cScaleMax | KControls | Default value for the Scale property
cScaleMin | KControls | Maximum for the Scale property
cScrollDelta | KControls | Constant for control scrollbars. It means: Use given Delta to update scrollbar.
cScrollNoAction | KControls | Constant for control scrollbars. It means: Leave that scrollbar untouched.
cScrollSpeedDef | KHexEditor | Default value for the ScrollSpeed property
cScrollSpeedMax | KHexEditor | Maximum for the ScrollSpeed property
cScrollSpeedMin | KHexEditor | Minimum for the ScrollSpeed property
cSelBkGndDef | KHexEditor | Default value for the SelBkGnd color property
cSelBkGndFocusedDef | KHexEditor | Default value for the SelBkGndFocused color property
cSelectedBorderDef | KControls | Default value for the SelectedBorder color property.
cSelTextDef | KHexEditor | Default value for the SelText color property
cSelTextFocusedDef | KHexEditor | Default value for the SelTextFocused color property
cSeparatorsDef | KHexEditor | Default value for the Separators color property
cTextBkgndDef | KHexEditor | Default value for the TextBkgnd color property
cTextTextDef | KHexEditor | Default value for the TextText color property
cUndoLimitDef | KHexEditor | Default value for the UndoLimit property
cUndoLimitMax | KHexEditor | Maximum for the UndoLimit property
cUndoLimitMin | KHexEditor | Minimum for the UndoLimit property
cUnitsDef | KControls | Default value for the Units property.
cVertLinesDef | KHexEditor | Default value for the VertLines color property
cWidth | KHexEditor | Default value for the Width property
cWordBreaks | KFunctions | Set of word break characters.
DecStrToInt | KFunctions | Converts a decimal digit string into integer. Code returns either zero for a successful conversion or the position of first bad character. Equals to Val.
DigitsToBinStr KHexEditor Examines/converts hexadecimal digit string to binary value string. Returns True if the digit string is valid.
    Parameters:
  • S - hexadecimal digit string (e.g. 'AF01 DC05 3'). White spaces will be ignored. When Convert is True, the converted binary value string will be returned via this parameter (in this exammple '#A#F#0#1#D#C#0#5#3').
  • Convert - the digit string will be converted if True, otherwise it will be examined only.
DigitToBin | KHexEditor | Converts a hexadecimal digit character ('0'..'F') to binary value
DivDown | KFunctions | Performs integer division. If there is a nonzero remainder, the result will be decremented.
DivUp | KFunctions | Performs integer division. If there is a nonzero remainder, the result will be incremented.
DrawAlignedText | KGraphics | Draws Text to the Canvas at location given by ARect. HAlign and VAlign specify horizontal resp. vertical alignment of the text within ARect. HPadding and VPadding specify horizontal (both on left and right side) and vertical (both on top and bottom side) padding of the Text from ARect. BackColor specifies the fill color for brush gaps if a non solid Brush is defined in Canvas. Attributes specift various text output attributes.
DrawEdges | KGraphics | Simulates WinAPI DrawEdge with customizable colors.
DrawFilledRectangle | KGraphics | Draws a rectangle to Canvas. The rectangle coordinates are given by Rect. The rectangle is filled by Brush. If Brush is not solid, its gaps are filled with BackColor. If BackColor is clNone these gaps are not filled and the Brush appears transparent.
Error | KFunctions | Raises a general exception with associated message Msg.
Exchange | KFunctions | Swaps values of two Char variables.
Exchange | KFunctions | Swaps values of two Integer variables.
Exchange | KFunctions | Swaps values of two Single variables.
Exchange | KFunctions | Swaps values of two Double variables.
Exchange | KFunctions | Swaps values of two Extended variables.
Exchange | KFunctions | Swaps values of two Cardinal variables.
Exchange | KFunctions | Swaps values of two Byte variables.
Exchange | KFunctions | Swaps values of two SmallInt variables.
Exchange | KFunctions | Swaps values of two Word variables.
Exchange | KFunctions | Swaps values of two Int64 variables.
Exchange | KFunctions | Swaps values of two ShortInt variables.
ExcludeShapeFromBaseRect | KGraphics | This helper function excludes a rectangular area occupied by a shape from BaseRect and calculates the shape area rectangles Bounds and Interior. The shape area is specified by the shape extent (ShapeWidth and ShapeHeight), padding (HPadding and VPadding) and stretching mode (StretchMode). The returned Bounds includes (possibly stretched) shape + padding, and Interior includes only the (possibly stretched) shape. HAlign specifies the horizontal alignment of shape area within BaseRect. VAlign specifies the vertical alignment of shape area within BaseRect. The shape area is always excluded horizontally from BaseRect, as needed by cell data calculations in KGrid.
ExtSelectClipRect | KGraphics | Selects ARect into device context. Returns previous clipping region.
ExtSelectClipRectEx | KGraphics | Selects ARect into device context. Combines with CurRgn and returns previous clipping region. Both regions have to be created first.
FillAroundRect | KGraphics | Fills the area specified by the difference Boundary - Interior on ACanvas with current Brush. If Brush is not solid, its gaps are filled with BackColor. If BackColor is clNone these gaps are not filled and the Brush appears transparent.
FillMessage | KFunctions | Fills the message record.
FinalizePrevRgn | KGraphics | Selects the region into given device context and deletes the region.
FormatCurrency | KFunctions | Formats the given currency value with to specified parameters. Not thread safe.
GDICheck | KGraphics | Raises an exception if GDI resource has not been created.
GetAppVersion | KFunctions | Returns the module version for given module. Works under WinX only.
GetColorSpec | KHexEditor | Returns the instance-independent color specification for the given color index
GetControlText | KFunctions | Returns the Text property of any TWinControl instance as WideString (up to Delphi 2007) or string (Delphi 2009, Lazarus).
GetFontHeight | KGraphics | Determine the height (ascent + descent) of the font currently selected into given DC.
GetShiftState | KFunctions | Returns current status of Shift, Alt and Ctrl keys.
HexStrToInt | KFunctions | Converts a hexadecimal digit string into integer with custom alignment (given by Digits) and sign of a value represented by the string (given by Signed). Code returns either zero for a successful conversion or the position of first bad character.
ImageByType | KGraphics | Creates a TGraphic instance according to the image file header. Currently supported images are BMP, PNG, MNG, JPG, ICO.
InchesToValue KControls Converts a value given in inches into a value given in specified units.
    Parameters:
  • Units - measurement units for the output value
  • Value - input value to convert
IntersectClipRectIndirect | KGraphics | Calls the IntersectClipRect function.
IntPowerInt KFunctions
IntToAscii | KFunctions | Converts an integer into binary string with custom alignment (given by Digits).
IntToBCD | KFunctions | Converts an integer value into BCD number.
IntToBinStr | KFunctions | Converts an integer into binary digit string with custom alignment (given by Digits) and suffix.
IntToDecStr | KFunctions | Converts an integer into decimal digit string. Equals to IntToStr.
IntToHexStr | KFunctions | Converts an integer into hexadecimal digit string with custom alignment (given by Digits), prefix and suffix. Digits represented by alphabetical characters can be either in lower or upper case.
IsBrightColor | KGraphics | Determines if given color has lightness > 0.5.
KM_BASE | KFunctions | Base for custom messages used by KControls suite.
KM_LATEUPDATE | KFunctions | Custom message.
LoadCustomCursor | KGraphics | Loads a custom mouse cursor.
MakeColorRec | KGraphics | Builds a TKColorRec structure.
MakeSelection | KHexEditor | Creates a selection structure from given Index and Digit parameters
MinMax | KFunctions | Returns a clipped SmallInt value so that it lies between Min and Max
MinMax | KFunctions | Returns a clipped Double value so that it lies between Min and Max
MinMax | KFunctions | Returns a clipped Single value so that it lies between Min and Max
MinMax | KFunctions | Returns a clipped Extended value so that it lies between Min and Max
MinMax | KFunctions | Returns a clipped Int64 value so that it lies between Min and Max
MinMax | KFunctions | Returns a clipped ShortInt value so that it lies between Min and Max
MinMax | KFunctions | Returns a clipped Integer value so that it lies between Min and Max
MNGHeader KGraphics
PBytes | KFunctions | Pointer for TBytes.
PCardinals | KFunctions | Pointer for TCardinals.
PChars | KFunctions | Pointer for TChars.
PDataSize | KFunctions | Pointer for TDataSize
PDoubles | KFunctions | Pointer for TDoubles.
PExtendeds | KFunctions | Pointer for TExtendeds.
PInt64s | KFunctions | Pointer for TInt64s.
PIntegers | KFunctions | Pointer for TIntegers.
PixelFormatFromBpp | KGraphics | Returns a pixel format that matches Bpp.
PKColorRec | KGraphics | Pointer to TKColorRec.
PKColorRecs | KGraphics | Dynamic array for TKColorRecs.
PKHexEditorChangeItem | KHexEditor | Pointer to TKHexEditorChangeItem
PLongInts | KFunctions | Pointer for TLongInts.
PLongWords | KFunctions | Pointer for TLongWords.
PNGHeader | KGraphics | PNG Support
PShortInts | KFunctions | Pointer for TShortInts.
PSingles | KFunctions | Pointer for TSingles.
PSmallInts | KFunctions | Pointer for TSmallInts.
PWords | KFunctions | Pointer for TWords.
RectInRegion | KGraphics | In Lazarus this WinAPI function is missing.
ReplaceDigit KHexEditor Replaces a hexadecimal digit in the given binary value. Returns the original value with a replaced digit.
    Parameters:
  • Value - original binary value
  • Digit - digit value (0..15)
  • Pos - digit position (order)
Example: Value = $A18D, Digit = $C, Pos = 3: Result = $AC8D
SafeStretchDraw | KGraphics | Paints an image so that it fits in ARect. Performs double buffering and fills the background with current brush for mapped device contexts.
SelectClipRect | KGraphics | Selects ARect as new clipping region into the device context.
SetControlClipRect | KFunctions | Under Windows this function calls the WinAPI SetWindowRgn. Under other OSes the implementation is still missing.
SetControlText | KFunctions | Modifies the Text property of any TWinControl instance. The value is given as WideString (up to Delphi 2007) or string (Delphi 2009, Lazarus).
StretchBitmap | KGraphics | Calls StretchBlt.
StringCharBegin | KFunctions | Returns the index for given string where character at given index begins. Takes MBCS (UTF8 in Lazarus) into account.
StringLength | KFunctions | Returns the number of characters in a string. Under Delphi it equals Length, under Lazarus it equals UTF8Length.
StringNextCharIndex | KFunctions | Returns next character index for given string and character index. Takes MBCS (UTF8 in Lazarus) into account.
StrNextCharIndex | KFunctions | Returns next character index for given null terminated string and character index. Takes MBCS (UTF8 in Lazarus) into account.
SwitchRGBToBGR | KGraphics | Swaps the color format from RGB to BGR and vice versa.
TBytes | KFunctions | Static array for Byte.
TCardinals | KFunctions | Static array for Cardinal.
TChars | KFunctions | Static array for Char.
TDataSize | KFunctions | Useful structure to handle general data and size as a single item
TDoubles | KFunctions | Static array for Double.
TDynBytes | KFunctions | Dynamic array for Byte.
TDynCardinals | KFunctions | Dynamic array for Cardinal.
TDynChars | KFunctions | Dynamic array for Char.
TDynDoubles | KFunctions | Dynamic array for Double.
TDynExtendeds | KFunctions | Dynamic array for Extended.
TDynInt64s | KFunctions | Dynamic array for Int64.
TDynIntegers | KFunctions | Dynamic array for Integer.
TDynLongInts | KFunctions | Dynamic array for LongInt.
TDynLongWords | KFunctions | Dynamic array for LongWord.
TDynShortInts | KFunctions | Dynamic array for ShortInt.
TDynSingles | KFunctions | Dynamic array for Single.
TDynSmallInts | KFunctions | Dynamic array for SmallInt.
TDynWords | KFunctions | Dynamic array for Word.
TExtendeds | KFunctions | Static array for Extended.
TInt64s | KFunctions | Static array for Int64.
TIntegers | KFunctions | Static array for Integer.
TKAlphaBitmap | KGraphics | A simple platform independent encapsulation for a 32bpp bitmap with alpha channel with the ability to modify it's pixels directly.
TKBrightMode | KGraphics | Declares possible values for the Style parameter of the BrightColor function.
TKColorArray | KControls | This array serves as storage place for all colors.
TKColorRec | KGraphics | Declares RGB + Alpha channel color description allowing both to access single channels and the whole color item.
TKColorRecs | KGraphics | Dynamic array for TKColorRec.
TKCurrencyFormat | KFunctions | Defines a currency format settings for FormatCurrency.
TKCustomControl | KControls | Base class for all visible controls in KControls.
TKCustomHexEditor | KHexEditor | Hexadecimal editor base component
TKDragWindow | KGraphics | Encapsulates the drag window
TKDynColorRecs | KGraphics | Dynamic array for TKColorRec.
TKGraphicHint KGraphics
TKHAlign | KGraphics | Declares possible values for the HAlign parameter in the DrawAlignedText function.
TKHexEditor | KHexEditor | Hexadecimal editor design-time component
TKHexEditorAddressMode | KHexEditor | Declares possible values for the AddressMode property
TKHexEditorArea | KHexEditor | Declares possible values e.g. for the EditArea property
TKHexEditorAreaDimensions | KHexEditor | Contains dimensions of all areas in characters
TKHexEditorChangeItem | KHexEditor | Declares the undo/redo item description structure used by the TKHexEditorChangeList class
TKHexEditorChangeList | KHexEditor | Change (undo/redo item) list manager
TKHexEditorChangeReason | KHexEditor | Declares possible values for the ItemReason member of the TKHexEditorChangeItem structure
TKHexEditorColorData | KHexEditor | Declares the color description structure returned by ColorData property
TKHexEditorColorIndex | KHexEditor | Declares possible indexes e.g. for the Color property.
TKHexEditorColors | KHexEditor | Container for all colors used by TKCustomHexEditor class
TKHexEditorColorScheme | KHexEditor | Declares possible values for the ColorScheme property
TKHexEditorColorSpec | KHexEditor | Declares TKHexEditorColors color item description
TKHexEditorDisabledDrawStyle | KHexEditor | Declares possible values for the DisabledDrawStyle property
TKHexEditorDrawStyle | KHexEditor | Declares drawing styles - possible values for the DrawStyles property
TKHexEditorDrawStyles | KHexEditor | Drawing styles can be arbitrary combined
TKHexEditorPaintData | KHexEditor | Declares the paint data structure for the PaintLines method
TKHexEditorSelection | KHexEditor | Declares the selection structure
TKHexEditorSelText | KHexEditor | Declares the structure for the SelText property
TKHexEditorState | KHexEditor | Declares hex editor states - possible values for the States property (protected)
TKHexEditorStates | KHexEditor | Hex editor states can be arbitrary combined
TKHexEditorUndoChangeEvent | KHexEditor | Declares OnChange event handler
TKHintWindow | KGraphics | Base class for KControls hints
TKImageHeaderString | KGraphics | String type for ImageByType function.
TKPreviewChangedEvent | KControls | Declares OnChanged event handler
TKPreviewColorIndex | KControls | Declares possible indexes e.g. for the Color property.
TKPreviewColors | KControls | Container for all colors used by TKPrintPreview class
TKPreviewScaleMode | KControls | Declares possible values for the ScaleMode property
TKPrintMeasureInfo | KControls | Declares the information structure for the MeasurePages method
TKPrintNotifyEvent | KControls | Declares OnPrintNotify event handler
TKPrintOption | KControls | Declares print options - possible values for the Options property.
TKPrintOptions | KControls | Print options can be arbitrary combined.
TKPrintPageSetup | KControls | Class to specify the print job parameters
TKPrintPaintEvent | KControls | Declares OnPrintPaint event handler
TKPrintPreview | KControls | Print preview control for the TKCustomControl component
TKPrintPreviewDialog | KDialogs | Encapsulates the print preview dialog
TKPrintRange | KControls | Declares possible values for the Range property.
TKPrintSetupDialog | KDialogs | Encapsulates the print preview dialog
TKPrintStatus | KControls | Declares possible values for the Status parameter in the TKPrintNotifyEvent event
TKPrintUnits | KControls | Declares measurement units for KControls printing system.
TKStretchMode | KGraphics | Declares possible values for the StretchMode parameter in the ExcludeShapeFromBaseRect function.
TKSysCharSet | KFunctions | Set type for CharInSetEx.
TKTextAttribute | KGraphics | Declares possible values for the Attributes parameter in the DrawAlignedText function.
TKTextAttributes | KGraphics | Set type for TKTextAttribute enumeration.
TKTextHAlign | KGraphics | For backward compatibility.
TKTextHint | KGraphics | Hint window to display formatted text
TKTextVAlign | KGraphics | For backward compatibility.
TKVAlign | KGraphics | Declares possible values for the VAlign parameter in the DrawAlignedText function.
TLongInts | KFunctions | Static array for LongInt.
TLongWords | KFunctions | Static array for LongWord.
TranslateRectToDevice | KGraphics | Subtracts the current device context offset to ARect.
TrimWhiteSpaces | KFunctions | Trims characters specified by ASet from the beginning and end of AText.
TrimWhiteSpaces | KFunctions | Trims characters specified by ASet from the beginning and end of AText. New text length is returned by ALen.
TShortInts | KFunctions | Static array for ShortInt.
TSingles | KFunctions | Static array for Single.
TSmallInts | KFunctions | Static array for SmallInt.
TWords | KFunctions | Static array for Word.
ValueToInches KControls Converts value given in specified units into a value given in inches.
    Parameters:
  • Units - measurement units for the input value
  • Value - input value to convert
WideCharToAnsiString | KFunctions | Converts a PWideChar string into AnsiString. If CodePage is not set the current system code page for ANSI-UTFx translations will be used.


KHexEditor help: Legend

Legend

Private | Private
Protected | Protected
Public | Public
Published | Published