KControls help: All Units

All Units

Name | Description
KControls | This unit contains the base class for all visible controls.
KDBGrids | This unit contains the TKDBGrid component and all supporting classes
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.
KGrids | This unit contains the TKGrid component and all supporting classes
KHexEditor | This unit contains the TKHexEditor component and all supporting classes
KIcon | This unit provides an advanced Windows icon management i.e. replacement for the Graphics.TIcon component
Generated by DIPasDoc 0.8.9 on 07. XII. 2010 15:19:48


KControls 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


KControls 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.


KControls 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.


KControls 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.


KControls 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.


KControls help: KDBGrids

Unit KDBGrids

Description

This unit contains the TKDBGrid component and all supporting classes

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

This unit provides a data aware control for TKGrid. Note: I am still a newbie to Delphi/Lazarus database solutions. If anything is totally wrong here please feel free to send a patch or hint to me. 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. However, 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 TKCustomDBGrid | KGrid data aware base component
Class TKDBGrid | KDBGrid design-time component
Class TKDBGridCell | Base cell class for TKDBGrid
Class TKDBGridCellPainter | Cell painter class used by TKCustomDBGrid class
Class TKDBGridCol | Column class for TKCustomDBGrid
Class TKDBGridColors | Container for all colors used by TKCustomDBGrid class
Class TKDBGridDataLink | Data link override for TKCustomDBGrid

Types

Overview

TKDBCustomGrid = TKCustomDBGrid;
TKDBGridColClass = of TKDBGridCol;
TKDBGridOptions = set of TKDBGridOption;

Description

TKDBCustomGrid = TKCustomDBGrid;

For backward compatibility.

TKDBGridColClass = of TKDBGridCol;

Metaclass for TKDBGridCol

.

TKDBGridOptions = set of TKDBGridOption;

Set type for TKDBGridOption enumeration.

Enumerations

TKDBGridOption

Declares possible values for the DBOptions property.

dboAutoMoveRecord | Automatically moves current record to edited or selected row.
dboAutoSizeBooleanCells | Forces the cells with boolean fields to be automatically adjusted to checkbox frame size.
dboAutoSizeImageCells | Forces the cells with image fields to be automatically adjusted to image size.
dboColNamesToHeader | Forces the column names to be assigned to fixed cells in the first fixed row.
dboDontClearFixedCells | Does not clear fixed cell texts if table is closed.
dboImageHint | For all BLOB/image columns, images will be displayed in original size in the cell hint window.
dboImagesWritable | Images loaded from database can be modified by user and thus will be saved into database if this option is included.
dboIndexFixedCol | Forces the row indexes to be assigned to fixed cells in the first fixed column.
dboIndicateActiveRecord | Indicates the active record row.

Constants

Overview

cActiveRecordDef = clCream;
cDBOptionsDef = [dboAutoMoveRecord, dboAutoSizeBooleanCells, dboColNamesToHeader, dboIndexFixedCol, dboIndicateActiveRecord];
cDefaultImageSet = [ftBlob, ftGraphic];
cDefaultStringSet = [ftString, ftSmallInt, ftInteger, ftWord, ftBoolean, ftFloat, ftCurrency, ftBCD, ftDate, ftTime, ftDateTime, ftAutoInc, ftMemo, ftFmtMemo, ftFixedChar, ftWideString, ftLargeInt, ftGuid, ftTimeStamp, ftFmtBCD , ftWideMemo ];
cGF_DBDataUpdating = $00010000;
cGF_DBInternalChanging = $00020000;
ciActiveRecord = TKGridColorIndex(ciGridColorsMax + 1);
ciDBGridColorsMax = ciActiveRecord;

Description

cActiveRecordDef = clCream;

Default value for the ActiveRecord property.

cDBOptionsDef = [dboAutoMoveRecord, dboAutoSizeBooleanCells, dboColNamesToHeader, dboIndexFixedCol, dboIndicateActiveRecord];

Default value for the DBOptions property.

cDefaultImageSet = [ftBlob, ftGraphic];

Used by default to distinguish image field type.

cDefaultStringSet = [ftString, ftSmallInt, ftInteger, ftWord, ftBoolean, ftFloat, ftCurrency, ftBCD, ftDate, ftTime, ftDateTime, ftAutoInc, ftMemo, ftFmtMemo, ftFixedChar, ftWideString, ftLargeInt, ftGuid, ftTimeStamp, ftFmtBCD , ftWideMemo ];

Used by default to distinguish string field type.

cGF_DBDataUpdating = $00010000;

This internal flag is set if grid is being updated.

cGF_DBInternalChanging = $00020000;

This internal flag is set if data record is being changed.

ciActiveRecord = TKGridColorIndex(ciGridColorsMax + 1);

Index for the ActiveRecord property.

ciDBGridColorsMax = ciActiveRecord;

Maximum color array index

Author

Tomas Krysl (tk@tkweb.eu)

Created

20 Sep 2009

Last Modified

20 Jun 2010


KControls help: KDBGrids: Class TKCustomDBGrid

Class TKCustomDBGrid

Unit

KDBGrids

Declaration

type TKCustomDBGrid = class(TKCustomGrid)

Description

KGrid data aware base component

This is the class that you use as the ancestor for your TKCustomDBGrid overrides.

Hierarchy

TKCustomGrid > TKCustomControl

Fields

 | Name | Description
Protected | FDataLink | This field represents the internal data link.

Methods

Overview

Public | constructor Create(AOwner: TComponent); override;
Public | destructor Destroy; override;
Public | procedure BeforeCellUpdate(ACol, ARow: Integer); dynamic;
Protected | function BeginRowDrag(var Origin: Integer; const MousePt: TPoint): Boolean; override;
Protected | procedure Changed; override;
Public | procedure ClearCol(ACol: Integer); override;
Public | procedure ClearGrid; override;
Public | procedure ClearRow(ARow: Integer); override;
Protected | procedure ColMoved(FromIndex, ToIndex: Integer); override;
Public | procedure Commit; dynamic;
Protected | function CustomSortRows(ByCol: Integer; var SortMode: TKGridSortMode): Boolean; override;
Protected | procedure DataChanged; dynamic;
Protected | procedure DataSetScrolled; dynamic;
Public | procedure DefaultEditorCreate(ACol, ARow: Integer; var AEditor: TWinControl); override;
Public | procedure DefaultEditorDataFromGrid(AEditor: TWinControl; ACol, ARow: Integer; var AssignText: Boolean); override;
Public | procedure DefaultEditorDataToGrid(AEditor: TWinControl; ACol, ARow: Integer; var AssignText: Boolean); override;
Public | procedure DefaultEditorResize(AEditor: TWinControl; ACol, ARow: Integer; var ARect: TRect); override;
Public | procedure DefaultEditorSelect(AEditor: TWinControl; ACol, ARow: Integer; SelectAll, CaretToLeft, SelectedByMouse: Boolean); override;
Public | procedure DefaultMouseCellHint(ACol, ARow: Integer; AShow: Boolean); override;
Public | procedure DeleteCols(At, Count: Integer); override;
Public | procedure DeleteRow(At: Integer); override;
Public | procedure DeleteRows(At, Count: Integer); override;
Protected | function EditorCreate(ACol, ARow: Integer): TWinControl; override;
Public | procedure InsertCols(At, Count: Integer); override;
Public | procedure InsertRow(At: Integer); override;
Public | procedure InsertRows(At, Count: Integer); override;
Public | function InsertSortedCol(out ByRow, ACol: Integer): Boolean; override;
Public | function InsertSortedRow(out ByCol, ARow: Integer): Boolean; override;
Protected | procedure InternalSetActiveRecord(Value: Integer); dynamic;
Protected | procedure InternalSetColCount(Value: Integer); override;
Protected | procedure InternalSetFixedCols(Value: Integer); override;
Protected | procedure InternalSetFixedRows(Value: Integer); override;
Protected | procedure InternalSetRowCount(Value: Integer); override;
Protected | function InternalUpdateVirtualGrid: Boolean; override;
Public | procedure MoveRow(FromIndex, ToIndex: Integer); override;
Protected | procedure RecordChanged; dynamic;
Protected | function SelectCell(ACol, ARow: Integer): Boolean; override;
Protected | procedure TopLeftChanged; override;
Protected | procedure UpdateData; dynamic;
Protected | procedure UpdateSize; override;

Description

Public constructor Create(AOwner: TComponent); override;

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

Public destructor Destroy; override;

Destroys the instance along with all allocated column, row and cell data, destroys the data link.

Public procedure BeforeCellUpdate(ACol, ARow: Integer); dynamic;

Notifies the grid that a cell has been modified.

Protected function BeginRowDrag(var Origin: Integer; const MousePt: TPoint): Boolean; override;

Does nothing. Row moving not supported.

Protected procedure Changed; override;

Extends TKCustomGrid behavior. Sets the data set into edited state and informs the data link about cell change.

Public procedure ClearCol(ACol: Integer); override;

Does nothing. Clearing entire column is not supported.

Public procedure ClearGrid; override;

Does nothing. Clearing entire grid is not supported.

Public procedure ClearRow(ARow: Integer); override;

Does nothing. Clearing entire row is not supported.

Protected procedure ColMoved(FromIndex, ToIndex: Integer); override;

Extends TKCustomGrid behavior. Updates the grid if column has been moved.

Public procedure Commit; dynamic;

Writes any modified data in the current record into database.

Protected function CustomSortRows(ByCol: Integer; var SortMode: TKGridSortMode): Boolean; override;

Extends TKCustomGrid behavior. Calls the event if data set is active etc.

Protected procedure DataChanged; dynamic;

Fills the grid with data from database and/or updates the grid.

Protected procedure DataSetScrolled; dynamic;

Called if current record has been moved.

Public procedure DefaultEditorCreate(ACol, ARow: Integer; var AEditor: TWinControl); override;

Provides default behavior for the OnEditorCreate event.

Public procedure DefaultEditorDataFromGrid(AEditor: TWinControl; ACol, ARow: Integer; var AssignText: Boolean); override;

Provides default behavior for the OnEditorDataFromGrid event.

Public procedure DefaultEditorDataToGrid(AEditor: TWinControl; ACol, ARow: Integer; var AssignText: Boolean); override;

Provides default behavior for the OnEditorDataToGrid event.

Public procedure DefaultEditorResize(AEditor: TWinControl; ACol, ARow: Integer; var ARect: TRect); override;

Provides default behavior for the OnEditorResize event.

Public procedure DefaultEditorSelect(AEditor: TWinControl; ACol, ARow: Integer; SelectAll, CaretToLeft, SelectedByMouse: Boolean); override;

Provides default behavior for the OnEditorSelect event.

Public procedure DefaultMouseCellHint(ACol, ARow: Integer; AShow: Boolean); override;

Provides default cell hint behavior.

Public procedure DeleteCols(At, Count: Integer); override;

Does nothing. Deleting columns not supported.

Public procedure DeleteRow(At: Integer); override;

Forces the data set to delete record at location At.

Public procedure DeleteRows(At, Count: Integer); override;

Does nothing. Deleting more rows not supported.

Protected function EditorCreate(ACol, ARow: Integer): TWinControl; override;

Extends TKCustomGrid behavior. Does not allow to edit if data set is writable or closed etc.

Public procedure InsertCols(At, Count: Integer); override;

Does nothing. Inserting columns not supported.

Public procedure InsertRow(At: Integer); override;

Forces the data set to insert new record at location At.

Public procedure InsertRows(At, Count: Integer); override;

Does nothing. Inserting more rows not supported.

Public function InsertSortedCol(out ByRow, ACol: Integer): Boolean; override;

Does nothing. Inserting sorted columns not supported.

Public function InsertSortedRow(out ByCol, ARow: Integer): Boolean; override;

Does nothing. Inserting sorted rows not supported.

Protected procedure InternalSetActiveRecord(Value: Integer); dynamic;

Moves to another record if initiated by the grid.

Protected procedure InternalSetColCount(Value: Integer); override;

Used internally to set column count.

Protected procedure InternalSetFixedCols(Value: Integer); override;

Used internally to set fixed column count.

Protected procedure InternalSetFixedRows(Value: Integer); override;

Used internally to set fixed row count.

Protected procedure InternalSetRowCount(Value: Integer); override;

Used internally to set row count.

Protected function InternalUpdateVirtualGrid: Boolean; override;

Allows to decide whether the goVirtualGrid option can be modified. Returns always False as no virtual grid possible in TKDBGrid.

Public procedure MoveRow(FromIndex, ToIndex: Integer); override;

Does nothing. Row moving not supported.

Protected procedure RecordChanged; dynamic;

Called if current record has been modified.

Protected function SelectCell(ACol, ARow: Integer): Boolean; override;

Extends TKCustomGrid behavior. Forces the previous modified record to be written into database.

Protected procedure TopLeftChanged; override;

Extends TKCustomGrid behavior. Updates the grid if top row or left column has been changed.

Protected procedure UpdateData; dynamic;

Called if unsaved data is about to be saved into database.

Protected procedure UpdateSize; override;

Extends TKCustomGrid Behavior. Updates the grid if control size has been changed.

Properties

Overview

Public | property DataSource: TDataSource;
Public | property DBOptions: TKDBGridOptions;

Description

Public property DataSource: TDataSource;

Specifies the data source.

Public property DBOptions: TKDBGridOptions;

Specifies various display and behavioral properties of TKDGGrid.


KControls help: KDBGrids: Class TKDBGrid

Class TKDBGrid

Unit

KDBGrids

Declaration

type TKDBGrid = class(TKCustomDBGrid)

Description

KDBGrid design-time component

This is the class you use both on run-time and design-time.

Hierarchy

TKCustomDBGrid > TKCustomGrid > TKCustomControl

Properties

Overview

Published | property Align;
Published | property Anchors;
Published | property BorderStyle;
Published | property BorderWidth;
Published | property ColCount;
Published | property Color;
Published | property Colors;
Published | property Constraints;
Published | property Ctl3D;
Published | property DataSource;
Published | property DBOptions;
Published | property DefaultColWidth;
Published | property DefaultDrawing;
Published | property DefaultRowHeight;
Published | property DisabledDrawStyle;
Published | property DragCursor;
Published | property DragKind;
Published | property DragMode;
Published | property DragStyle;
Published | property Enabled;
Published | property FixedCols;
Published | property FixedRows;
Published | property Font;
Published | property GridLineWidth;
Published | property MinColWidth;
Published | property MinRowHeight;
Published | property MouseCellHintTime;
Published | property MoveDirection;
Published | property OnBeginColDrag;
Published | property OnBeginColSizing;
Published | property OnBeginRowSizing;
Published | property OnCellSpan;
Published | property OnChanged;
Published | property OnCheckColDrag;
Published | property OnClick;
Published | property OnColumnMoved;
Published | property OnColWidthsChanged;
Published | property OnContextPopup;
Published | property OnCustomSortCols;
Published | property OnCustomSortRows;
Published | property OnDblClick;
Published | property OnDockDrop;
Published | property OnDockOver;
Published | property OnDragDrop;
Published | property OnDragOver;
Published | property OnDrawCell;
Published | property OnEditorCreate;
Published | property OnEditorDataFromGrid;
Published | property OnEditorDataToGrid;
Published | property OnEditorDestroy;
Published | property OnEditorKeyPreview;
Published | property OnEditorResize;
Published | property OnEditorSelect;
Published | property OnEndColDrag;
Published | property OnEndColSizing;
Published | property OnEndDock;
Published | property OnEndDrag;
Published | property OnEndRowSizing;
Published | property OnEnter;
Published | property OnExchangeCols;
Published | property OnExchangeRows;
Published | property OnExit;
Published | property OnGetSiteInfo;
Published | property OnKeyDown;
Published | property OnKeyPress;
Published | property OnKeyUp;
Published | property OnMouseCellHint;
Published | property OnMouseClickCell;
Published | property OnMouseDown;
Published | property OnMouseEnterCell;
Published | property OnMouseLeaveCell;
Published | property OnMouseMove;
Published | property OnMouseUp;
Published | property OnMouseWheel;
Published | property OnMouseWheelDown;
Published | property OnMouseWheelUp;
Published | property OnResize;
Published | property OnRowHeightsChanged;
Published | property OnSelectCell;
Published | property OnSelectionExpand;
Published | property OnSizeChanged;
Published | property OnStartDock;
Published | property OnStartDrag;
Published | property OnTopLeftChanged;
Published | property OnUnDock;
Published | property Options;
Published | property ParentColor;
Published | property ParentFont;
Published | property ParentShowHint;
Published | property PopupMenu;
Published | property RangeSelectStyle;
Published | property RowCount;
Published | property ScrollBars;
Published | property ScrollModeHorz;
Published | property ScrollModeVert;
Published | property ScrollSpeed;
Published | property ShowHint;
Published | property SizingStyle;
Published | property SortStyle;
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 TKCustomGrid.BorderStyle for details.

Published property BorderWidth;

Inherited property - see Delphi help.

Published property ColCount;

See TKCustomGrid.ColCount for details.

Published property Color;

See TKCustomGrid.Color for details.

Published property Colors;

See TKCustomGrid.Colors for details.

Published property Constraints;

Inherited property - see Delphi help.

Published property Ctl3D;

Inherited property - see Delphi help.

Published property DataSource;

See TKCustomDBGrid.DataSource for details.

Published property DBOptions;

See TKCustomDBGrid.DBOptions for details.

Published property DefaultColWidth;

See TKCustomGrid.DefaultColWidth for details.

Published property DefaultDrawing;

See TKCustomGrid.DefaultDrawing for details.

Published property DefaultRowHeight;

See TKCustomGrid.DefaultRowHeight for details.

Published property DisabledDrawStyle;

See TKCustomGrid.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 DragStyle;

See TKCustomGrid.DragStyle for details.

Published property Enabled;

Inherited property - see Delphi help.

Published property FixedCols;

See TKCustomGrid.FixedCols for details.

Published property FixedRows;

See TKCustomGrid.FixedRows for details.

Published property Font;

Inherited property - see Delphi help.

Published property GridLineWidth;

See TKCustomGrid.GridLineWidth for details.

Published property MinColWidth;

See TKCustomGrid.MinColWidth for details.

Published property MinRowHeight;

See TKCustomGrid.MinRowHeight for details.

Published property MouseCellHintTime;

See TKCustomGrid.MouseCellHintTime for details.

Published property MoveDirection;

See TKCustomGrid.MoveDirection for details.

Published property OnBeginColDrag;

See TKCustomGrid.OnBeginColDrag for details.

Published property OnBeginColSizing;

See TKCustomGrid.OnBeginColSizing for details.

Published property OnBeginRowSizing;

See TKCustomGrid.OnBeginRowSizing for details.

Published property OnCellSpan;

See TKCustomGrid.OnCellSpan for details.

Published property OnChanged;

See TKCustomGrid.OnChanged for details.

Published property OnCheckColDrag;

See TKCustomGrid.OnCheckColDrag for details.

Published property OnClick;

Inherited property - see Delphi help.

Published property OnColumnMoved;

See TKCustomGrid.OnColumnMoved for details.

Published property OnColWidthsChanged;

See TKCustomGrid.OnColWidthsChanged for details.

Published property OnContextPopup;

Inherited property - see Delphi help.

Published property OnCustomSortCols;

See TKCustomGrid.OnCustomSortCols for details.

Published property OnCustomSortRows;

See TKCustomGrid.OnCustomSortRows for details.

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 OnDrawCell;

See TKCustomGrid.OnDrawCell for details.

Published property OnEditorCreate;

See TKCustomGrid.OnEditorCreate for details.

Published property OnEditorDataFromGrid;

See TKCustomGrid.OnEditorDataFromGrid for details.

Published property OnEditorDataToGrid;

See TKCustomGrid.OnEditorDataToGrid for details.

Published property OnEditorDestroy;

See TKCustomGrid.OnEditorDestroy for details.

Published property OnEditorKeyPreview;

See TKCustomGrid.OnEditorKeyPreview for details.

Published property OnEditorResize;

See TKCustomGrid.OnEditorResize for details.

Published property OnEditorSelect;

See TKCustomGrid.OnEditorSelect for details.

Published property OnEndColDrag;

See TKCustomGrid.OnEndColDrag for details.

Published property OnEndColSizing;

See TKCustomGrid.OnEndColSizing for details.

Published property OnEndDock;

Inherited property - see Delphi help.

Published property OnEndDrag;

Inherited property - see Delphi help.

Published property OnEndRowSizing;

See TKCustomGrid.OnEndRowSizing for details.

Published property OnEnter;

Inherited property - see Delphi help.

Published property OnExchangeCols;

See TKCustomGrid.OnExchangeCols for details.

Published property OnExchangeRows;

See TKCustomGrid.OnExchangeRows for details.

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 OnMouseCellHint;

See TKCustomGrid.OnMouseCellHint for details.

Published property OnMouseClickCell;

See TKCustomGrid.OnMouseClickCell for details.

Published property OnMouseDown;

Inherited property - see Delphi help.

Published property OnMouseEnterCell;

See TKCustomGrid.OnMouseEnterCell for details.

Published property OnMouseLeaveCell;

See TKCustomGrid.OnMouseLeaveCell for details.

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 OnRowHeightsChanged;

See TKCustomGrid.OnRowHeightsChanged for details.

Published property OnSelectCell;

See TKCustomGrid.OnSelectCell for details.

Published property OnSelectionExpand;

See TKCustomGrid.OnSelectionExpand for details.

Published property OnSizeChanged;

See TKCustomGrid.OnSizeChanged for details.

Published property OnStartDock;

Inherited property - see Delphi help.

Published property OnStartDrag;

Inherited property - see Delphi help.

Published property OnTopLeftChanged;

See TKCustomGrid.OnTopLeftChanged for details.

Published property OnUnDock;

Inherited property - see Delphi help.

Published property Options;

See TKCustomGrid.Options for details.

Published property ParentColor;

Inherited property - see Delphi help.

Published property ParentFont;

Inherited property - see Delphi help.

Published property ParentShowHint;

Inherited property - see Delphi help.

Published property PopupMenu;

Inherited property - see Delphi help.

Published property RangeSelectStyle;

See TKCustomGrid.RangeSelectStyle for details.

Published property RowCount;

See TKCustomGrid.RowCount for details.

Published property ScrollBars;

See TKCustomGrid.ScrollBars for details.

Published property ScrollModeHorz;

See TKCustomGrid.ScrollModeHorz for details.

Published property ScrollModeVert;

See TKCustomGrid.ScrollModeVert for details.

Published property ScrollSpeed;

See TKCustomGrid.ScrollSpeed for details.

Published property ShowHint;

Inherited property - see Delphi help.

Published property SizingStyle;

See TKCustomGrid.SizingStyle for details.

Published property SortStyle;

See TKCustomGrid.SortStyle for details.

Published property TabOrder;

Inherited property - see Delphi help.

Published property TabStop;

Inherited property - see Delphi help.

Published property Visible;

Inherited property - see Delphi help.


KControls help: KDBGrids: Class TKDBGridCell

Class TKDBGridCell

Unit

KDBGrids

Declaration

type TKDBGridCell = class(TKDBGridCellAncestor)

Description

Base cell class for TKDBGrid

This is the base cell class. It has always a Text property. Descendants can add other specific data, e.g. BLOB pointers etc.

Methods

Overview

Public | constructor Create(AGrid: TKCustomGrid); override;
Public | procedure ApplyDrawProperties; override;
Protected | procedure BeforeUpdate; override;
Protected | function CreateImageByType(const Header: TKImageHeaderString): TGraphic; virtual;
Protected | procedure FieldFromCell(AField: TField); virtual;
Protected | procedure FieldToCell(AField: TField); virtual;
Protected | procedure ImageFromField(AField: TField);
Protected | procedure ImageToField(AField: TField);
Protected | procedure Initialize; override;
Protected | procedure TextFromField(AField: TField);
Protected | procedure TextToField(AField: TField);

Description

Public constructor Create(AGrid: TKCustomGrid); override;

Creates the instance.

Public procedure ApplyDrawProperties; override;

Applies TKDBGridCell properties to the cell painter.

Protected procedure BeforeUpdate; override;

Calls BeforeCellUpdate.

Protected function CreateImageByType(const Header: TKImageHeaderString): TGraphic; virtual;

Loads appropriate image.

Protected procedure FieldFromCell(AField: TField); virtual;

Assigns cell properties to field data.

Protected procedure FieldToCell(AField: TField); virtual;

Assigns field data to cell properties.

Protected procedure ImageFromField(AField: TField);

Assigns AField buffer to Graphic property.

Protected procedure ImageToField(AField: TField);

Assigns Graphic property to AField buffer.

Protected procedure Initialize; override;

Initializes the cell data.

Protected procedure TextFromField(AField: TField);

Assigns AField buffer to Text property.

Protected procedure TextToField(AField: TField);

Assigns Text property to AField buffer.

Properties

Overview

Public property Graphic: TGraphic;

Description

Public property Graphic: TGraphic;

Returns a pointer to the image read from database.


KControls help: KDBGrids: Class TKDBGridCellPainter

Class TKDBGridCellPainter

Unit

KDBGrids

Declaration

type TKDBGridCellPainter = class(TKGridCellPainter)

Description

Cell painter class used by TKCustomDBGrid class

Overrides some TKGridCellPainter methods for usage with TKCustomDBGrid.

Hierarchy

TKGridCellPainter

Methods

Overview

Public procedure DefaultAttributes; override;

Description

Public procedure DefaultAttributes; override;

Low level method. Prepares default painting attributes. Applies attributes specific for TKDBGrid.


KControls help: KDBGrids: Class TKDBGridCol

Class TKDBGridCol

Unit

KDBGrids

Declaration

type TKDBGridCol = class(TKGridCol)

Description

Column class for TKCustomDBGrid

This column class implements some extra properties for TKCustomDBGrid.

Hierarchy

TKGridCol > TKGridAxisItem

Methods

Overview

Public constructor Create(AGrid: TKCustomGrid); override;

Description

Public constructor Create(AGrid: TKCustomGrid); override;

Creates the instance. Do not create custom instances. All necessary TKDBGridCol instances are created automatically by TKCustomDBGrid.

Properties

Overview

Public | property CurrencyFormat: TKCurrencyFormat;
Public | property DataType: TFieldType;
Public | property Name: WideString;

Description

Public property CurrencyFormat: TKCurrencyFormat;

Specifies the currency formatting settings if the column has currency data type.

Public property DataType: TFieldType;

Returns the field data type. It is assigned automatically by the TKDGGrid's data source.

Public property Name: WideString;

Specifies the database column name. It is assigned automatically by the TKDGGrid's data source.


KControls help: KDBGrids: Class TKDBGridColors

Class TKDBGridColors

Unit

KDBGrids

Declaration

type TKDBGridColors = class(TKGridColors)

Description

Container for all colors used by TKCustomDBGrid class

Adds some extra colors used by TKCustomDBGrid.

Hierarchy

TKGridColors

Methods

Overview

Protected procedure Initialize; override;

Description

Protected procedure Initialize; override;

Initializes the color array.

Properties

Overview

Published property ActiveRecord: TColor;

Description

Published property ActiveRecord: TColor;

Specifies the color used to indicate active record.


KControls help: KDBGrids: Class TKDBGridDataLink

Class TKDBGridDataLink

Unit

KDBGrids

Declaration

type TKDBGridDataLink = class(TDataLink)

Description

Data link override for TKCustomDBGrid

This class overrides TDataLink to extend behavior for TKCustomDBGrid.

Methods

Overview

Public | constructor Create(AGrid: TKCustomDBGrid);
Protected | procedure ActiveChanged; override;
Protected | procedure DataSetChanged; override;
Protected | procedure DataSetScrolled(Distance: Integer); override;
Protected | procedure LayoutChanged; override;
Protected | procedure RecordChanged(Field: TField); override;
Protected | procedure UpdateData; override;

Description

Public constructor Create(AGrid: TKCustomDBGrid);

Creates the instance.

Protected procedure ActiveChanged; override;

Called if data set has been opened or closed.

Protected procedure DataSetChanged; override;

Called if data in the data set has been changed.

Protected procedure DataSetScrolled(Distance: Integer); override;

Called if current record has been moved.

Protected procedure LayoutChanged; override;

Called if data set layout has been modified.

Protected procedure RecordChanged(Field: TField); override;

Called if current record has been modified.

Protected procedure UpdateData; override;

Called if unsaved data is about to be saved into database.

Properties

Overview

Public | property Grid: TKCustomDBGrid;
Public | property Modified: Boolean;

Description

Public property Grid: TKCustomDBGrid;

Specifies the TKCustomDBGrid instance assigned to this TKDBGridDataLink instance.

Public property Modified: Boolean;

Determines if the current record has been modified.


KControls 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


KControls 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.


KControls 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).


KControls 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: Char); overload;
procedure Exchange(var Value1, Value2: Double); overload;
procedure Exchange(var Value1, Value2: Word); overload;
procedure Exchange(var Value1, Value2: Integer); overload;
procedure Exchange(var Value1, Value2: ShortInt); overload;
procedure Exchange(var Value1, Value2: SmallInt); overload;
procedure Exchange(var Value1, Value2: Int64); overload;
procedure Exchange(var Value1, Value2: Cardinal); overload;
procedure Exchange(var Value1, Value2: Byte); overload;
procedure Exchange(var Value1, Value2: Single); 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 GetWindowsFolder(CSIDL: Cardinal; var APath: string): Boolean;
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: Single): Single; overload;
function MinMax(Value, Min, Max: Extended): Extended; overload;
function MinMax(Value, Min, Max: ShortInt): ShortInt; overload;
function MinMax(Value, Min, Max: Int64): Int64; 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: Char); overload;

Swaps values of two Char variables.

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

Swaps values of two Double variables.

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

Swaps values of two Word variables.

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

Swaps values of two Integer variables.

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

Swaps values of two ShortInt variables.

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

Swaps values of two SmallInt variables.

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

Swaps values of two Int64 variables.

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

Swaps values of two Cardinal variables.

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

Swaps values of two Byte variables.

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

Swaps values of two Single 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 GetWindowsFolder(CSIDL: Cardinal; var APath: string): Boolean;

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: Single): Single; overload;

Returns a clipped Single 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: ShortInt): ShortInt; overload;

Returns a clipped ShortInt 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: 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


KControls 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;
TUpdateLayeredWindowProc = function(Handle: THandle; hdcDest: HDC; pptDst: PPoint; _psize: PSize; hdcSrc: HDC; pptSrc: PPoint; crKey: COLORREF; pblend: PBLENDFUNCTION; dwFlags: DWORD): Boolean;

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.

TUpdateLayeredWindowProc = function(Handle: THandle; hdcDest: HDC; pptDst: PPoint; _psize: PSize; hdcSrc: HDC; pptSrc: PPoint; crKey: COLORREF; pblend: PBLENDFUNCTION; dwFlags: DWORD): Boolean;

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


KControls 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.


KControls 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.


KControls 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;


KControls 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.


KControls 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;


KControls help: KGrids

Unit KGrids

Description

This unit contains the TKGrid component and all supporting classes

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

This unit provides an enhanced replacement for components contained in Grids.pas. Major features:

  • 95% compatible with TDraw(String)Grid
  • any TWinControl descendant can be used as inplace editor
  • cell clipping and double buffering
  • cell merging/splitting
  • column/row/grid autosizing
  • cross platform control in Lazarus
  • index mapping - current column/row indexes can be mapped to their initial values
  • last row/column aligning (no scrollbar)
  • printing and previewing
  • row/column hiding with optional visual indication
  • rows, columns and cells are classes
  • several styles possible when moving/sizing cells
  • sorting interface
  • Unicode control
  • various text output attributes (multiline text, end ellipsis etc.)
  • versatile cell painting interface
  • virtual grid option
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 TKCustomGrid | KGrid base component
Class TKGrid | KGrid design-time component
Class TKGridAttrTextCell | Class for a textual cell with custom appearance
Class TKGridAxisItem | Base class to store column or row properties
Class TKGridCell | Base class to store cell properties
Class TKGridCellPainter | Wrapper for a versatile and easily extensible cell painting engine
Class TKGridCol | Class to store column properties
Class TKGridColors | Container for all colors used by TKCustomGrid class
Class TKGridObjectCell | Class for an object cell
Class TKGridRow | Class to store row properties
Class TKGridTextCell | Class for simple textual cell

Functions and Procedures

Overview

function CellInGridRect(ACol, ARow: Integer; const R: TKGridRect): Boolean;
function ColInGridRect(ACol: Integer; const R: TKGridRect): Boolean;
procedure ComboKeyPreview(AGrid: TKCustomGrid; AEditor: TComboBox; ACol, ARow: Integer; var Key: Word; ShiftState: TShiftState; var IsGridKey: Boolean);
procedure ComboSelect(AGrid: TKCustomGrid; AEditor: TComboBox; SelectAll, CaretToLeft: Boolean);
function CompareAxisItems(AxisItems1, AxisItems2: TKGridAxisItems): Boolean;
procedure DefaultDrawCell(AGrid: TKCustomGrid; ACol, ARow: Integer; ARect: TRect; AState: TKGridDrawState; HAlign: TKHAlign; VAlign: TKVAlign; HPadding, VPadding: Integer; const AText: WideString);
procedure DefaultKeyPreview(AGrid: TKCustomGrid; AEditor: TWinControl; ACol, ARow: Integer; var Key: Word; ShiftState: TShiftState; var IsGridKey: Boolean);
procedure DefaultSelect(AGrid: TKCustomGrid; AEditor: TWinControl; ACol, ARow: Integer; SelectAll, CaretToLeft, SelectedByMouse: Boolean);
procedure EditKeyPreview(AGrid: TKCustomGrid; AEditor: TCustomEdit; ACol, ARow: Integer; var Key: Word; ShiftState: TShiftState; var IsGridKey: Boolean);
procedure EditSelect(AGrid: TKCustomGrid; AEditor: TCustomEdit; SelectAll, CaretToLeft: Boolean);
function GridPoint(ACol, ARow: Integer): TKGridCoord;
function GridRect(ACol1, ARow1, ACol2, ARow2: Integer): TKGridRect; overload;
function GridRect(ACell: TKGridCoord): TKGridRect; overload;
function GridRect(ACell1, ACell2: TKGridCoord): TKGridRect; overload;
function GridRectEqual(const GridRect1, GridRect2: TKGridRect): Boolean;
function MakeCellSpan(AColumns, ARows: Integer): TKGridCellSpan;
procedure NormalizeGridRect(var GridRect: TKGridRect);
function RowInGridRect(ARow: Integer; const R: TKGridRect): Boolean;
procedure ScrollBarKeyPreview(AGrid: TKCustomGrid; AEditor: TScrollBar; ACol, ARow: Integer; var Key: Word; ShiftState: TShiftState; var IsGridKey: Boolean);

Description

function CellInGridRect(ACol, ARow: Integer; const R: TKGridRect): Boolean;

Determines if the Cell specified by ACol and ARow lies within grid rectangle R.

function ColInGridRect(ACol: Integer; const R: TKGridRect): Boolean;

Determines if the grid rectangle contains a subset of cells belonging to the column specified by ACol.

procedure ComboKeyPreview(AGrid: TKCustomGrid; AEditor: TComboBox; ACol, ARow: Integer; var Key: Word; ShiftState: TShiftState; var IsGridKey: Boolean);

Obsolete function. Call TKCustomGrid.DefaultComboKeyPreview instead.

procedure ComboSelect(AGrid: TKCustomGrid; AEditor: TComboBox; SelectAll, CaretToLeft: Boolean);

Obsolete function. Call TKCustomGrid.DefaultComboSelect instead.

function CompareAxisItems(AxisItems1, AxisItems2: TKGridAxisItems): Boolean;

Compares two TKGridAxisItems arrays. The function returns True if the arrays are equal in length and all corresponding TKGridAxisItem instances within both arrays have equal property values.

procedure DefaultDrawCell(AGrid: TKCustomGrid; ACol, ARow: Integer; ARect: TRect; AState: TKGridDrawState; HAlign: TKHAlign; VAlign: TKVAlign; HPadding, VPadding: Integer; const AText: WideString);

Obsolete function. Implements default painting for TKCustomGrid cells. Call TKCustomGrid.CellPainter.DefaultDraw instead.

procedure DefaultKeyPreview(AGrid: TKCustomGrid; AEditor: TWinControl; ACol, ARow: Integer; var Key: Word; ShiftState: TShiftState; var IsGridKey: Boolean);

Obsolete function. Call TKCustomGrid.DefaultEditorKeyPreview instead.

procedure DefaultSelect(AGrid: TKCustomGrid; AEditor: TWinControl; ACol, ARow: Integer; SelectAll, CaretToLeft, SelectedByMouse: Boolean);

Obsolete function. Call TKCustomGrid.DefaultEditorSelect instead.

procedure EditKeyPreview(AGrid: TKCustomGrid; AEditor: TCustomEdit; ACol, ARow: Integer; var Key: Word; ShiftState: TShiftState; var IsGridKey: Boolean);

Obsolete function. Call TKCustomGrid.DefaultEditKeyPreview instead.

procedure EditSelect(AGrid: TKCustomGrid; AEditor: TCustomEdit; SelectAll, CaretToLeft: Boolean);

Obsolete function. Call TKCustomGrid.DefaultEditSelect instead.

function GridPoint(ACol, ARow: Integer): TKGridCoord;

Makes a TKGridCoord record from ACol and ARow.

function GridRect(ACol1, ARow1, ACol2, ARow2: Integer): TKGridRect; overload;

Makes a TKGridRect record from ACol1, ARow1, ACol2 and ARow2. All the input parameters will be copied to the corresponding fields of the resulting grid rectangle.

function GridRect(ACell: TKGridCoord): TKGridRect; overload;

Makes a TKGridRect record from ACell. Cell will be copied both to Cell1 and Cell2 fields of the resulting grid rectangle.

function GridRect(ACell1, ACell2: TKGridCoord): TKGridRect; overload;

Makes a TKGridRect record from ACell1 and ACell2. All the input parameters will be copied to the corresponding fields of the resulting grid rectangle.

function GridRectEqual(const GridRect1, GridRect2: TKGridRect): Boolean;

Compares two grid rectangles. Returns True if all the corresponding fields in GridRect1 equal those in GridRect2.

function MakeCellSpan(AColumns, ARows: Integer): TKGridCellSpan;

Makes a TKGridCellSpan record from AColumns and ARows.

procedure NormalizeGridRect(var GridRect: TKGridRect);

Makes Cell1 field of GridRect always top-left cell and Cell2 field always bottom-right cell.

function RowInGridRect(ARow: Integer; const R: TKGridRect): Boolean;

Determines if the grid rectangle contains a subset of cells belonging to the row specified by ARow.

procedure ScrollBarKeyPreview(AGrid: TKCustomGrid; AEditor: TScrollBar; ACol, ARow: Integer; var Key: Word; ShiftState: TShiftState; var IsGridKey: Boolean);

Obsolete function. Call TKCustomGrid.DefaultScrollBarKeyPreview instead.

Types

Overview

TKGridAxisInfo = record InfoMask: TKGridAxisInfoMask; AlignLastCell: Boolean; FixedSelectable: Boolean; CanResize: TKGridCanResizeFunc; CellExtent: TKGridGetExtentFunc; EffectiveSpacing: TKGridGetExtentFunc; FixedCellCount: Integer; FirstGridCell: Integer; FirstGridCellExtent: Integer; ClientExtent: Integer; MinCellExtent: TKGridGetExtentFunc; MaxCellExtent: TKGridGetExtentFunc; TotalCellCount: Integer; ScrollOffset: Integer; FixedBoundary: Integer; GridBoundary: Integer; GridCells: Integer; FullVisBoundary: Integer; FullVisCells: Integer; GridExtent: Int64; end;
TKGridAxisInfoBoth = record Horz, Vert: TKGridAxisInfo; end;
TKGridAxisInfoMask = set of TKGridAxisInfoMaskMembers;
TKGridAxisItemClass = of TKGridAxisItem;
TKGridAxisItems = array of TKGridAxisItem;
TKGridAxisUpdateFlags = set of TKGridAxisUpdateFlag;
TKGridBeginDragEvent = procedure(Sender: TObject; var Origin: Integer; const MousePt: TPoint; var CanBeginDrag: Boolean) of object;
TKGridBeginSizingEvent = procedure(Sender: TObject; var Index, Pos: Integer; var CanBeginSizing: Boolean) of object;
TKGridCanResizeFunc = function(var Index, Pos: Integer): Boolean of object;
TKGridCellClass = of TKGridCell;
TKGridCellEvent = procedure(Sender: TObject; ACol, ARow: Integer) of object;
TKGridCellHintEvent = procedure(Sender: TObject; ACol, ARow: Integer; AShow: Boolean) of object;
TKGridCellPainterClass = of TKGridCellPainter;
TKGridCellRow = array of TKGridCell;
TKGridCells = array of TKGridCellRow;
TKGridCellSpan = record ColSpan: Integer; RowSpan: Integer; end;
TKGridCellSpanEvent = procedure(Sender: TObject; ACol, ARow: Integer; var Span: TKGridCellSpan) of object;
TKGridCheckDragEvent = procedure(Sender: TObject; Origin: Integer; var Destination: Integer; const MousePt: TPoint; var CanDrop: Boolean) of object;
TKGridColClass = of TKGridCol;
TKGridColorIndex = Integer;
TKGridCompareCellInstancesEvent = function(Sender: TObject; Cell1, Cell2: TKGridCell): Integer of object;
TKGridCompareCellsEvent = function(Sender: TObject; Col1, Row1, Col2, Row2: Integer): Integer of object;
TKGridCompareProc = function(ByIndex, Index1, Index2: Integer): Integer of object;
TKGridCoord = record Col: Integer; Row: Integer; end;
TKGridCustomSortEvent = procedure(Sender: TObject; ByIndex: Integer; SortMode: TKGridSortMode; var Sorted: Boolean) of object;
TKGridDrawCellEvent = procedure(Sender: TObject; ACol, ARow: Integer; R: TRect; State: TKGridDrawState) of object;
TKGridDrawState = set of TKGridDrawStateMembers;
TKGridEditorCreateEvent = procedure(Sender: TObject; ACol, ARow: Integer; var AEditor: TWinControl) of object;
TKGridEditorDataEvent = procedure(Sender: TObject; AEditor: TWinControl; ACol, ARow: Integer; var AssignText: Boolean) of object;
TKGridEditorDestroyEvent = procedure(Sender: TObject; var AEditor: TWinControl; ACol, ARow: Integer) of object;
TKGridEditorKeyPreviewEvent = procedure(Sender: TObject; AEditor: TWinControl; ACol, ARow: Integer; var Key: Word; Shift: TShiftState; var IsGridKey: Boolean) of object;
TKGridEditorResizeEvent = procedure(Sender: TObject; AEditor: TWinControl; ACol, ARow: Integer; var ARect: TRect) of object;
TKGridEditorSelectEvent = procedure(Sender: TObject; AEditor: TWinControl; ACol, ARow: Integer; SelectAll, CaretToLeft, SelectedByMouse: Boolean) of object;
TKGridEndDragEvent = procedure(Sender: TObject; Origin: Integer; Destination: Integer; const MousePt: TPoint; var CanEndDrag: Boolean) of object;
TKGridEndSizingEvent = procedure(Sender: TObject; Index, Pos: Integer; var CanEndSizing: Boolean) of object;
TKGridExchangeEvent = procedure(Sender: TObject; Index1, Index2: Integer) of object;
TKGridExchangeProc = procedure(Index1, Index2: Integer) of object;
TKGridExtentEvent = procedure(Sender: TObject; AIndex: Integer) of object;
TKGridGetExtentFunc = function(Index: Integer): Integer of object;
TKGridHCIBitmaps = record HBegin, HCenter, HEnd, VBegin, VCenter, VEnd: TKAlphaBitmap; end;
TKGridMeasureCellEvent = procedure(Sender: TObject; ACol, ARow: Integer; R: TRect; State: TKGridDrawState; Priority: TKGridMeasureCellPriority; var Extent: TPoint) of object;
TKGridMovedEvent = procedure(Sender: TObject; FromIndex, ToIndex: Integer) of object;
TKGridOptions = set of TKGridOption;
TKGridOptionsEx = set of TKGridOptionEx;
TKGridRect = record case Integer of 0: (Col1, Row1, Col2, Row2: Integer); 1: (Cell1, Cell2: TKGridCoord); end;
TKGridRowClass = of TKGridRow;
TKGridSelectCellEvent = procedure(Sender: TObject; ACol, ARow: Integer; var CanSelect: Boolean) of object;
TKGridSelectionExpandEvent = procedure(Sender: TObject; ACol, ARow: Integer; var CanExpand: Boolean) of object;
TKGridSelectionFlags = set of TKGridSelectionFlag;
TKGridSizeChangedEvent = procedure(Sender: TObject; Change: TKGridSizeChange; At, Count: Integer) of object;

Description

TKGridAxisInfo = record InfoMask: TKGridAxisInfoMask; AlignLastCell: Boolean; FixedSelectable: Boolean; CanResize: TKGridCanResizeFunc; CellExtent: TKGridGetExtentFunc; EffectiveSpacing: TKGridGetExtentFunc; FixedCellCount: Integer; FirstGridCell: Integer; FirstGridCellExtent: Integer; ClientExtent: Integer; MinCellExtent: TKGridGetExtentFunc; MaxCellExtent: TKGridGetExtentFunc; TotalCellCount: Integer; ScrollOffset: Integer; FixedBoundary: Integer; GridBoundary: Integer; GridCells: Integer; FullVisBoundary: Integer; FullVisCells: Integer; GridExtent: Int64; end;

Declares a structure returned by the GetAxisInfoHorz or GetAxisInfoVert functions

This structure contains information either about columns or rows, depending on what function returned the structure.

    Members:
  • InfoMask - set of parameters that specify what fields in this structure need to be evaluated.
  • AlignLastCell - specifies if the last cell is aligned to client area extent - see goAlignLastCol or goAlignLastRow for details.
  • FixedSelectable - reflects the gxEditFixedCols or gxEditFixedRows.
  • CanResize - this is the pointer to a function that determines if a column or row can be resized - i.e. either BeginColSizing or BeginRowSizing methods.
  • CellExtent - this is the pointer to a function that evaluates cell width or height - i.e. either GetColWidths or GetColHeights (private members).
  • EffectiveSpacing - specifies the effective space between cells as returned by EffectiveColSpacing or EffectiveRowSpacing.
  • FixedCellCount - specifies the amount of fixed columns or rows - see FixedCols or FixedRows for details.
  • FirstGridCell - specifies the first visible non-fixed cell as given by LeftCol or TopRow.
  • FirstGridCellExtent - specifies the maximum value for the first visible non-fixed cell as given by TKCustomGrid.FTopLeftExtent.
  • ClientExtent - this is either the TControl.ClientWidth or TControl.ClientHeight value.
  • MinCellExtent - specifies the minimum cell extent as given by InternalGetMinColWidth or InternalGetMinRowHeight.
  • MaxCellExtent - specifies the maximum cell extent as given by InternalGetMaxColWidth or InternalGetMaxRowHeight.
  • TotalCellCount - specifies the total cell amount in desired direction as given by ColCount or RowCount.
  • FixedBoundary - specifies the point in pixels where the first non-fixed cell begins.
  • GridBoundary - specifies the grid extent as returned by the GridWidth or GridHeight properties.
  • GridCells - gives the amount of cells that correspond to GridBoundary.
  • FullVisBoundary - specifies the point in pixels where the last fully visible cell ends.
  • FullVisCells - gives the amount of cells that correspond to FullVisBoundary.
  • GridExtent - returns the extent of all cells in the grid.

TKGridAxisInfoBoth = record Horz, Vert: TKGridAxisInfo; end;

Declares a structure returned by the GetAxisInfoBoth function

    Members:
  • Horz - structure as returned by GetAxisInfoHorz.
  • Vert - structure as returned by GetAxisInfoVert.

TKGridAxisInfoMask = set of TKGridAxisInfoMaskMembers;

Set type for TKGridAxisInfoMaskMembers enumeration.

TKGridAxisItemClass = of TKGridAxisItem;

Metaclass for TKGridAxisItem

This type is used internally.

TKGridAxisItems = array of TKGridAxisItem;

Dynamic array type to store TKGridAxisItem instances

There are always two arrays of this type in TKCustomGrid. First of them stores column properties - FCols - and the second stores row properties - FRows.

TKGridAxisUpdateFlags = set of TKGridAxisUpdateFlag;

Set type for TKGridAxisUpdateFlags enumeration.

TKGridBeginDragEvent = procedure(Sender: TObject; var Origin: Integer; const MousePt: TPoint; var CanBeginDrag: Boolean) of object;

Declares event handler e.g. for the OnBeginColDrag event

    Parameters:
  • Sender - identifies the event caller.
  • Origin - row or column index where dragging should be started.
  • MousePt - position of mouse cursor.
  • CanBeginDrag - True by default to allow the dragging to be started.

TKGridBeginSizingEvent = procedure(Sender: TObject; var Index, Pos: Integer; var CanBeginSizing: Boolean) of object;

Declares event handler e.g. for the OnBeginColSizing event

    Parameters:
  • Sender - identifies the event caller.
  • Index - index of a row or column that should be resized.
  • Pos - position of the sizing line (even if it actually doesn't exist in ssUpdate sizing mode).
  • CanBeginSizing - True by default to allow the sizing to be started.

TKGridCanResizeFunc = function(var Index, Pos: Integer): Boolean of object;

Method type for the CanResize field in the TKGridAxisInfo structure.

TKGridCellClass = of TKGridCell;

Metaclass for TKGridCell

This type is used in the CellClass property.

TKGridCellEvent = procedure(Sender: TObject; ACol, ARow: Integer) of object;

Declares event handler for any cell notification events

    Parameters:
  • Sender - identifies the event caller.
  • ACol, ARow - column and row indexes of the corresponding cell.

TKGridCellHintEvent = procedure(Sender: TObject; ACol, ARow: Integer; AShow: Boolean) of object;

Declares event handler for the OnMouseCellHint event

    Parameters:
  • Sender - identifies the event caller.
  • ACol, ARow - column and row indexes of the corresponding cell.
  • AShow - True if hint should be displayed, otherwise False.

TKGridCellPainterClass = of TKGridCellPainter;

Metaclass for TKGridCellPainter

This type is used in the CellPainterClass property.

TKGridCellRow = array of TKGridCell;

Dynamic array type to store row of TKGridCell instances

This one-dimensional array stores cell properties.

TKGridCells = array of TKGridCellRow;

Dynamic array type to store the entire grid of TKGridCell instances

This two-dimensional array stores cell properties - FCells.

TKGridCellSpan = record ColSpan: Integer; RowSpan: Integer; end;

Declares a structure that holds both column and row span of a cell

    Members:
  • ColSpan - column span.
  • RowSpan - row span.

TKGridCellSpanEvent = procedure(Sender: TObject; ACol, ARow: Integer; var Span: TKGridCellSpan) of object;

Declares event handler for the OnCellSpan event

    Parameters:
  • Sender - identifies the event caller.
  • ACol, ARow - column and row indexes of the cell whose span data is to be retrieved.
  • Span - resulting span data for that cell.

TKGridCheckDragEvent = procedure(Sender: TObject; Origin: Integer; var Destination: Integer; const MousePt: TPoint; var CanDrop: Boolean) of object;

Declares event handler e.g. for the OnCheckColDrag event

    Parameters:
  • Sender - identifies the event caller.
  • Origin - row or column index where dragging was started.
  • Destination - row or column index where dragging is about to end at this moment.
  • MousePt - position of mouse cursor.
  • CanDrop - True by default to allow the dropping to Destination.

TKGridColClass = of TKGridCol;

Metaclass for TKGridCol

This type is used in ColClass property.

TKGridColorIndex = Integer;

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

TKGridCompareCellInstancesEvent = function(Sender: TObject; Cell1, Cell2: TKGridCell): Integer of object;

Declares event handler for the OnCompareCellInstances

    Parameters:
  • Sender - identifies the event caller.
  • Cell1 - pointer to the first cell
  • Cell2 - pointer to the second cell
    Returns:
  • Negative value (<0) if the value of the first cell is lower than the value of the second cell.
  • Positive value (>0) if the value of the first cell is greater than the value of the second cell.
  • Zero if values of both cells are the same.

TKGridCompareCellsEvent = function(Sender: TObject; Col1, Row1, Col2, Row2: Integer): Integer of object;

Declares event handler for the OnCompareCells

    Parameters:
  • Sender - identifies the event caller.
  • Col1 - column index of the first cell or cInvalidIndex - see InsertSortedCol.
  • Row1 - row index of the first cell or cInvalidIndex - see InsertSortedRow.
  • Col2 - column index of the second cell.
  • Row2 - row index of the second cell.
    Returns:
  • Negative value (<0) if the value of the first cell is lower than the value of the second cell.
  • Positive value (>0) if the value of the first cell is greater than the value of the second cell.
  • Zero if values of both cells are the same.

TKGridCompareProc = function(ByIndex, Index1, Index2: Integer): Integer of object;

Method type for the Compare parameter e.g. in the InternalQuickSortNR method.

TKGridCoord = record Col: Integer; Row: Integer; end;

Declares a structure that hold both column and row index of a cell

    Members:
  • Col - coordinate or index of a column.
  • Row - coordinate or index of a row.

TKGridCustomSortEvent = procedure(Sender: TObject; ByIndex: Integer; SortMode: TKGridSortMode; var Sorted: Boolean) of object;

Declares event handler for the OnCustomSortCols or OnCustomSortRows events

    Parameters:
  • Sender - identifies the event caller.
  • ByIndex - column or row index to sort rows or columns by.
  • SortMode - the sorting mode to sort rows or columns.
  • Sorted - set to True to avoid default sorting to be called.

TKGridDrawCellEvent = procedure(Sender: TObject; ACol, ARow: Integer; R: TRect; State: TKGridDrawState) of object;

Declares event handler e.g. for the OnDrawCell event

    Parameters:
  • Sender - identifies the event caller.
  • ACol, ARow - column and row indexes of the cell being drawn.
  • R - location of cell on the canvas.
  • State - indicates the state of the cell.

TKGridDrawState = set of TKGridDrawStateMembers;

Set type for TKGridDrawStateMembers enumeration.

TKGridEditorCreateEvent = procedure(Sender: TObject; ACol, ARow: Integer; var AEditor: TWinControl) of object;

Declares event handler for the OnEditorCreate event

    Parameters:
  • Sender - identifies the event caller.
  • ACol, ARow - column and row indexes of the focused cell that is about to become edited cell.
  • AEditor - nil by default to indicate that no inplace editor is wanted for the cell. Assign any TWinControl instance to this Parameter to create a custom inplace editor for the cell. Always create new instance because it is owned by the grid and destroyed automatically if no longer needed.

TKGridEditorDataEvent = procedure(Sender: TObject; AEditor: TWinControl; ACol, ARow: Integer; var AssignText: Boolean) of object;

Declares event handler for the OnEditorDataFromGrid or OnEditorDataToGrid events

    Parameters:
  • Sender - identifies the event caller.
  • AEditor - identifies the inplace editor.
  • ACol, ARow - column and row indexes of the edited cell.
  • AssignText - Allows to automatically set the cell text to or from inplace editor. Set to False to disable this behavior.

TKGridEditorDestroyEvent = procedure(Sender: TObject; var AEditor: TWinControl; ACol, ARow: Integer) of object;

Declares event handler for the OnEditorDestroy event

    Parameters:
  • Sender - identifies the event caller.
  • AEditor - identifies the inplace editor.
  • ACol, ARow - column and row indexes of the edited cell.

TKGridEditorKeyPreviewEvent = procedure(Sender: TObject; AEditor: TWinControl; ACol, ARow: Integer; var Key: Word; Shift: TShiftState; var IsGridKey: Boolean) of object;

Declares event handler for the OnEditorKeyPreview event

    Parameters:
  • Sender - identifies the event caller.
  • AEditor - identifies the inplace editor.
  • ACol, ARow - column and row indexes of the edited cell.
  • Key - key code as passed to OnKeyDown, can be modified.
  • Shift - state of the control keys as passed to OnKeyDown.
  • IsGridKey - True by default to indicate that the key will be handled by the grid. Set to False to let the inplace editor handle the key.

TKGridEditorResizeEvent = procedure(Sender: TObject; AEditor: TWinControl; ACol, ARow: Integer; var ARect: TRect) of object;

Declares event handler for the OnEditorResize event

    Parameters:
  • Sender - identifies the event caller.
  • AEditor - identifies the inplace editor.
  • ACol, ARow - column and row indexes of the edited cell.
  • ARect - initial bounding rectangle of the inplace editor. You can modify it in order to place the editor somewhere else within the cell. The inplace editor is always clipped within the cell.

TKGridEditorSelectEvent = procedure(Sender: TObject; AEditor: TWinControl; ACol, ARow: Integer; SelectAll, CaretToLeft, SelectedByMouse: Boolean) of object;

Declares event handler for the OnEditorSelect event

    Parameters:
  • Sender - identifies the event caller.
  • AEditor - identifies the inplace editor.
  • ACol, ARow - column and row indexes of the edited cell.
  • SelectAll - all the text should be selected in the inplace editor.
  • CaretToLeft - caret should be positioned to the left.
  • SelectedByMouse - the cell has been selected by mouse.

TKGridEndDragEvent = procedure(Sender: TObject; Origin: Integer; Destination: Integer; const MousePt: TPoint; var CanEndDrag: Boolean) of object;

Declares event handler e.g. for the OnEndColDrag event

    Parameters:
  • Sender - identifies the event caller.
  • Origin - row or column index where dragging was started.
  • Destination - row or column index where dragging ends.
  • MousePt - position of mouse cursor.
  • CanEndDrag - True by default to allow the dragging to be ended.

TKGridEndSizingEvent = procedure(Sender: TObject; Index, Pos: Integer; var CanEndSizing: Boolean) of object;

Declares event handler e.g. for the OnEndColSizing event

    Parameters:
  • Sender - identifies the event caller.
  • Index - index of a row or column that is being resized.
  • Pos - current position of the sizing line (even if it actually doesn't exist in ssUpdate sizing mode).
  • CanEndSizing - True by default to allow the resizing to be ended.

TKGridExchangeEvent = procedure(Sender: TObject; Index1, Index2: Integer) of object;

Declares event handler for the OnExchangeCols or OnExchangeRows event

    Parameters:
  • Sender - identifies the event caller.
  • Index1 - index of the first column or row.
  • Index2 - index of the second column or row.

TKGridExchangeProc = procedure(Index1, Index2: Integer) of object;

Method type for the Exchange parameter e.g. in the InternalQuickSortNR method.

TKGridExtentEvent = procedure(Sender: TObject; AIndex: Integer) of object;

Declares event handler for any cell extent notification events

    Parameters:
  • Sender - identifies the event caller.
  • AIndex - column or row index.

TKGridGetExtentFunc = function(Index: Integer): Integer of object;

Method type for the CellExtent field in the TKGridAxisInfo structure.

TKGridHCIBitmaps = record HBegin, HCenter, HEnd, VBegin, VCenter, VEnd: TKAlphaBitmap; end;

Declares a structure for hidden cell indicator glyphs.

TKGridMeasureCellEvent = procedure(Sender: TObject; ACol, ARow: Integer; R: TRect; State: TKGridDrawState; Priority: TKGridMeasureCellPriority; var Extent: TPoint) of object;

Declares event handler e.g. for the OnMeasureCell event

    Parameters:
  • Sender - identifies the event caller.
  • ACol, ARow - column and row indexes of the cell being drawn.
  • R - location of cell on the canvas.
  • State - indicates the state of the cell.
  • Priority - specifies the cell measurement priority.
  • Extent - returns calculated cell extent.

TKGridMovedEvent = procedure(Sender: TObject; FromIndex, ToIndex: Integer) of object;

Declares event handler for the OnColumnMoved or OnRowMoved events

    Parameters:
  • Sender - identifies the event caller.
  • FromIndex - initial position of the column or row being moved.
  • ToIndex - final position of the column or row being moved.

TKGridOptions = set of TKGridOption;

Set type for TKGridOption enumeration.

TKGridOptionsEx = set of TKGridOptionEx;

Set type for TKGridOptionEx enumeration.

TKGridRect = record case Integer of 0: (Col1, Row1, Col2, Row2: Integer); 1: (Cell1, Cell2: TKGridCoord); end;

Declares the type e.g. for the Selection property

Declares the type for grid rectangle. A grid rectangle is a structure of two independent grid points.

    Members:
  • Col1, Row1, Col2, Row2 - rectangle of grid cells given by indexes.
  • Cell1, Cell2 - rectangle of grid cells given e.g. by top-left and bottom-right cells.

TKGridRowClass = of TKGridRow;

Metaclass for TKGridRow

This type is used in RowClass property.

TKGridSelectCellEvent = procedure(Sender: TObject; ACol, ARow: Integer; var CanSelect: Boolean) of object;

Declares event handler for the OnSelectCell event

    Parameters:
  • Sender - identifies the event caller.
  • ACol, ARow - column and row indexes of the cell that is about to be selected.
  • CanSelect - True by default to indicate that the cell can be selected. Set to False to inhibit selecting of this cell.

TKGridSelectionExpandEvent = procedure(Sender: TObject; ACol, ARow: Integer; var CanExpand: Boolean) of object;

Declares event handler for the OnSelectCell event

    Parameters:
  • Sender - identifies the event caller.
  • ACol, ARow - column and row indexes of the cell that is about to expand the current selection.
  • CanExpand - True by default to indicate that the cell can the selection. Set to False to inhibit further selection expanding.

TKGridSelectionFlags = set of TKGridSelectionFlag;

Set type for TKGridSelectionFlag enumeration.

TKGridSizeChangedEvent = procedure(Sender: TObject; Change: TKGridSizeChange; At, Count: Integer) of object;

Declares event handler for the OnSizeChanged event

    Parameters:
  • Sender - identifies the event caller.
  • Change - identifies the change type.
  • At - index where column(s) or row(s) have been inserted or deleted.
  • Count - number of column(s) or row(s) that have been inserted or deleted.

Enumerations

TKGridAxisInfoMaskMembers

Declares possible values for the Mask parameter in the GetAxisInfoHorz or GetAxisInfoVert functions.

aiFixedParams | The FixedBoundary field in the TKGridAxisInfo structure will be evaluated.
aiGridExtent | The GridExtent field in the TKGridAxisInfo structure will be evaluated.
aiGridBoundary | The GridBoundary and GridCells fields in the TKGridAxisInfo structure will be evaluated.
aiFullVisBoundary | The FullVisBoundary and FullVisCells fields in the TKGridAxisInfo structure will be evaluated.
TKGridAxisUpdateFlag

Declares possible values for the Flags parameter in the UpdateAxes method.

afCallEvent | Forces the OnColWidthsChanged and/or OnRowHeightsChanged to be called even if no column width/ row height has been modified by this call of UpdateAxes.
afCheckMinExtent | Ensures all columns/rows have at least the minimum width/height as specified by MinColWidth/MinRowHeight.
TKGridCaptureState

Declares possible values for the State parameter in the SuggestDrag or SuggestSizing functions.

csStart | Suggestion is about to start - e.g. user clicked the movable column by mouse.
csHide | Suggestion is about to temporarily hide - e.g. user drags a column by mouse and the grid needs to be updated.
csShow | Suggestion is about to show again - e.g. user drags a column by mouse and the grid was updated.
csStop | Suggestion is about to stop - e.g. user released the mouse button and the dragged column need to be actually moved.
TKGridColorScheme

Declares possible values for the ColorScheme property.

csNormal | GetColor returns normal color currently defined for each item.
csGrayed | GetColor returns gray for text.
csBright | GetColor returns brighter version of normal color.
csGrayScale | GetColor returns grayscaled color versions.
TKGridDisabledDrawStyle

Declares possible values for the DisabledDrawStyle property.

ddBright | The lines will be painted with brighter colors when control is disabled.
ddGrayed | The lines will be painted with gray text and white background when control is disabled.
ddNormal | The lines will be painted normally when control is disabled.
TKGridDragStyle

Declares possible values for the DragStyle property.

dsLayeredConst | The moved column or row is displayed beneath mouse cursor in a layered window (Win2k+) or white window (other OS) with fading opacity.
dsLayeredFaded | The moved column or row is displayed beneath mouse cursor in a layered window (Win2k+) or white window (other OS) with constant opacity.
dsLine | The moved column or row is not displayed, behavior of original TCustomGrid but line has red color.
dsXORLine | The moved column or row is not displayed, behavior of original TCustomGrid.
TKGridDrawStateMembers

Declares possible values for the State parameter in the TKGridDrawCellEvent event handler or DrawCell method.

gdEdited | The cell has input focus and is currently edited. This is always 1 cell that correspond to Col and Row properties. Painting of the cell is automatically invoked to allow e.g. background filling for inplace editors that don't fill the entire cell area.
gdFixed | The cell is in the fixed region of the grid.
gdFocused | The cell has input focus. This is always 1 cell that correspond to Col and Row properties.
gdMouseDown | Left mouse button is pressed. Cell repainting is automatically invoked when mouse cursor is over the cell and the left button is pressed. The cell is repainter if mouse button is released, either.
gdMouseOver | Mouse cursor is over the cell in goMouseOverCells mode. Cell repainting is automatically invoked when mouse cursor enters or leaves the cell. Furthermore, if EditorMode is True, the inplace editor will be invalidated to allow proper editor underpainting, either.
gdSelected | The cell is currently selected. This includes all cells that appear with different default background color in either goRangeSelect or goRowSelect mode.
gdSorted | The cell belongs to the sorted column or row.
gdColsSortedUp | Applies to the left most fixed column (if any). The cell should paint visual shape like arrow to indicate that the columns are sorted from lowest to highest value, like 'A' to 'Z'.
gdColsSortedDown | Applies to the left most fixed column (if any). The cell should paint visual shape like arrow to indicate that the columns are sorted from highest to lowest value, like 'Z' to 'A'.
gdRowsSortedUp | Applies to the top most fixed row (if any). The cell should paint visual shape like arrow to indicate that the rows are sorted from lowest to highest value, like 'A' to 'Z'.
gdRowsSortedDown | Applies to the top most fixed row (if any). The cell should paint visual shape like arrow to indicate that the rows are sorted from highest to lowest value, like 'Z' to 'A'.
TKGridEditorTransparency

Declares possible values for the EditorTransparency property.

etDefault | The grid decides which inplace editor should be treated as a transparent control. This method works for all standard VCL controls.
etNormal | Current inplace editor should be treated as opaque, i.e. not transparent.
etTransparent | Current inplace editor should be treated as transparent.
TKGridInvisibleCells

Declares possible values for the InvisibleCells parameter in the PointToCell method.

icNone | No invisible cells will be taken into account. Invisible cells are those that are hidden (non-fixed) to the left or top.
icFixedCols | Invisible cells to the left will be taken into account at the expense of the (possible) fixed cells.
icFixedRows | Invisible cells to the top will be taken into account at the expense of the (possible) fixed cells.
icCells | All invisible cells will be taken into account at the expense of the (possible) fixed cells.
TKGridMeasureCellPriority

Declares possible values for the Priority parameter in the MeasureCell method.

mpColWidth | Row height stays, column width is adjusted.
mpRowHeight | Column width stays, row height is adjusted.
mpCellExtent | Default cell extent adjustment.
TKGridMoveCommand

Declares possible values for the Command parameter in the InternalMove method.

mcNone | No command.
mcBottom | Move to last row.
mcDown | Move to next row.
mcEnd | Move to last column.
mcHome | Move to first column.
mcLeft | Move to previous column.
mcMoveDown | Move to bottom row on current page.
mcMoveUp | Move to top row on current page.
mcPageDown | Move to next vertical page.
mcPageLeft | Move to next horizontal page.
mcPageRight | Move to previous horizontal page.
mcPageUp | Move to previous vertical page.
mcRight | Move to next column.
mcTop | Move to first row.
mcUp | Move to previous row.
TKGridMoveDirection

Declares possible values for the MoveDirection property.

mdDown | By pressing Enter, the cell below the currently focused cell will be focused.
mdLeft | By pressing Enter, the cell to the left of the currently focused cell will be focused.
mdRight | By pressing Enter, the cell to the right of the currently focused cell will be focused.
mdUp | By pressing Enter, the cell above the currently focused cell will be focused.
TKGridOption

Declares possible values for the Options property.

goAlignLastCol | Tries to put all columns to the visible area of the grid and omit free space to the right of the last cell. No horizontal scrollbar appears.
goAlignLastRow | Tries to put all rows to the visible area of the grid and omit free space below the last cell. No vertical scrollbar appears.
goAlwaysShowEditor | The grid is locked into edit mode. The user does not need to use Enter or F2 to turn on EditorMode everytime he moves to another cell. The behavior is slightly different as in TCustomGrid.
goEraseBackground | Enables the WM_ERASEBKGND message to be handled if True. This can be used to avoid grid flickering for the case the grid is placed into a container that requires repainting itself and all of its children after resizing. This behavior is typical for nested TPanels. If you don't use these you can set this option True to erase the background. The grid does not need the background to be erased as it fills the entire client area through WM_PAINT. But some users might need to erase the background due to the strange behavior when activating an application by clicking the main form's title bar.
goClippedCells | No painting is allowed beyond the cell outline.
goColMoving | Scrollable columns can be moved using the mouse.
goColSizing | Scrollable columns can be individually resized.
goColSorting | Scrollable columns can be sorted by mouse click at the first fixed row. The sorted column is visually indicated by arrow at the first fixed row.
goDoubleBufferedCells | Instructs the cell painter to draw each cell with double buffering to avoid cell flickering.
goDrawFocusSelected | Selected cells are drawn with with a focus rectangle if the grid (not the inplace editor) has the input focus. The behavior is slightly different as in TCustomGrid.
goEditing | Users can edit the contents of cells. No another limitation applicable.
goEnterMoves | If included, Enter does not turn on EditorMode, but causes another cell to be focused. What cell it is depends on MoveDirection.
goFixedHorzLine | Horizontal lines are drawn to separate the fixed (nonscrolling) rows in the grid.
goFixedVertLine | Vertical lines are drawn to separate the fixed (nonscrolling) columns in the grid. If ThemedCells is True, these are not drawn for fixed rows by default, as these are meant as a grid header.
goHeader | Draws cells in the first fixed row in standard Win-API header style.
goHeaderAlignment | Terminates the first fixed row drawn in standard Win-API header style by drawing a standard Win-API header terminator in an area not occupied by cells.
goHorzLine | Horizontal lines are drawn to separate the scrollable rows in the grid.
goIndicateHiddenCells | Hidden columns or rows are indicated in fixed cell area.
goIndicateSelection | Selection is indicated in the fixed cells by a specific color.
goMouseCanHideCells | Columns or rows can be hidden with the mouse while being resized. Set to False to enforce KGrid 1.2 behavior.
goMouseOverCells | If included, then if the mouse enters or leaves a cell, these cells will be invalidated and the cell under the mouse pointer gets a gdMouseOver state.
goNoSelEditText | If included, no text will be selected in the inplace editor upon its creation. This applies only to inplace editors having a selectable text, of course. The default behavior works only for editors responding to EM_SETSEL message. For another editors, the behavior can be maintained by the OnEditorSelect event handler.
goRangeSelect | Users can select ranges of cells at one time. No another limitation applicable.
goRowMoving | Scrollable rows can be moved using the mouse.
goRowSelect | Entire rows are selected rather than individual cells. No another limitation applicable.
goRowSizing | Scrollable rows can be individually resized. Caution: Some inplace editors cannot be resized in height - for example TComboBox.
goRowSorting | Scrollable rows can be sorted by mouse click at the first fixed column. The sorted row is visually indicated by arrow at the first fixed column.
goTabs | Users can navigate through the cells in the grid using Tab and Shift+Tab.
goThemes | Enables OS themes for both non-client and cells.
goThemedCells | Enables OS themes for cells.
goVertLine | Vertical lines are drawn to separate the scrollable columns in the grid.
goVirtualGrid | If included, the grid becomes virtual grid. In this mode, data for the cells must be supplied externally. No cell class instances are allocated. Cell property cannot be set and returns always nil. Cells property cannot be set and returns always empty string. FCells field is always nil - no grid structure is allocated. Column and Row structures (FCols and FRows) remain always allocated.
TKGridOptionEx

Declares possible values for the OptionsEx property.

gxEditorHCenter | When Inplace editor has horizontal constraint it will be horizontally centered.
gxEditorVCenter | When Inplace editor has vertical constraint it will be vertically centered.
gxEnterAppendsRow | Pressing Enter at the last cell appends a row.
gxEnterWraps | Pressing Enter wraps selection to next column/row.
gxFixedCellClickSelect | Clicking fixed cells together with Shift key selects/unselects respective columns/rows.
gxFixedThemedCells | All fixed cells will be painted with header theme (looks bad e.g. with classic WinXP).
gxTabAppendsRow | Pressing TAB at the last cell appends a row.
gxTabWraps | Pressing TAB wraps selection to next column/row.
gxEditFixedRows | Allow edit fixed rows
gxEditFixedCols | Allow edit fixed cols
TKGridRangeSelectStyle

Declares possible values for the RangeSelectStyle property.

rsDefault | The focused cell is not the base cell and expands the selection.
rsMS_Excel | The focused cell is the base cell and does not expand the selection.
TKGridScrollMode

Declares possible values for the ScrollModeHorz and ScrollModeVert properties.

smSmooth | The trackbar scrolls per pixel.
smCell | The trackbar scrolls per cell.
TKGridSelectionFlag

Declares possible values for the Flags parameter in the SelectionMove method.

sfDontCallSelectCell | Do not call the SelectCell method.
sfMustUpdate | Force invalidation of the old and new selection.
sfClampInView | Force calling of the ClampInView method.
sfNoMemPos | Do not set FMemCol and FMemRow fields.
TKGridSelectionStage

Declares possible values for the Stage parameter in the TKGridSelectionExpandEvent event handler or SelectionMove method.

ssInit | The selection moves entirely - the selection base cell changes.
ssExpand | The selection expands - the selection base cell remains unchanged.
TKGridSizeChange

Declares possible values for the Change parameter in the TKGridSizeChangedEvent event handler.

scColDeleted | Columns have been deleted.
scColInserted | Columns have been inserted.
scRowDeleted | Rows have been deleted.
scRowInserted | Rows have been inserted.
TKGridSizingStyle

Declares possible values for the SizingStyle property.

ssLine | Column widths or row heights update after the mouse button is released. Old TCustomGrid behavior but line has red color.
ssUpdate | Column widths or row heights update immediately.
ssXORLine | Column widths or row heights update after the mouse button is released. Old TCustomGrid behavior.
TKGridSortMode

Declares possible values for the SortMode property.

smNone | Corresponding column or row is not sorted.
smDown | Corresponding column or row is sorted from lowest to highest value.
smUp | Corresponding column or row is sorted from highest to lowest value.
TKGridSortStyle

Declares possible values for the SortStyle property.

ssDownUp | First click sorts from lowest to highest value, second click sorts from highest to lowest value.
ssDownUpNone | First click sorts from lowest to highest value, second click sorts from highest to lowest value, third click turns sorting off.
ssUpDownNone | First click sorts from highest to lowest value, second click sorts from lowest to highest value, third click turns sorting off.
TKGridState

Declares possible values for the FGridState field.

gsClickWaiting | The mouse button has been pressed on a fixed cell that triggers mouse click event.
gsColMoveWaiting | The mouse button has been pressed on a fixed cell that triggers column dragging.
gsColMoving | The user is dragging a column to a new position.
gsColSizing | The user is changing the width of a column.
gsColSortWaiting | The mouse button has been pressed on a fixed cell that triggers column sorting.
gsNormal | The grid layout is not changing.
gsRowMoveWaiting | The mouse button has been pressed on a fixed cell that triggers row dragging.
gsRowMoving | The user is dragging a row to a new position.
gsRowSizing | The user is changing the height of a row.
gsRowSortWaiting | The mouse button has been pressed on a fixed cell that triggers row sorting.
gsSelecting | The user is selecting a cell or row.

Constants

Overview

cAll = -1;
cCellBkGndDef = clWindow;
cCellLinesDef = clBtnFace;
cCellTextDef = clWindowText;
cColCountDef = 5;
cDefaultColWidthDef = 64;
cDefaultRowHeightDef = 21;
cDisabledDrawStyleDef = ddBright;
cDragStyleDef = dsLayeredFaded;
cDragSuggestionBkGndDef = clLime;
cDragSuggestionLineDef = clBlack;
cEditorTransparencyDef = etDefault;
cFixedCellBkGndDef = clBtnFace;
cFixedCellIndicationDef = clCream;
cFixedCellLinesDef = clWindowText;
cFixedCellTextDef = clBtnText;
cFixedColsDef = 1;
cFixedRowsDef = 1;
cFixedThemedCellHighlightDef = clBtnHighlight;
cFixedThemedCellLinesDef = clBtnShadow;
cFixedThemedCellShadowDef = clBtnFace;
cFocusedCellBkGndDef = clHighlight;
cFocusedCellTextDef = clHighlightText;
cFocusedRangeBkGndDef = clHighlight;
cFocusedRangeTextDef = clHighlightText;
cGF_CaretToLeft = $00000001;
cGF_DesignHitTest = $00000004;
cGF_EditorModeActive = $00000010;
cGF_EditorUpdating = $00000008;
cGF_EnterPressed = $00000100;
cGF_GridUpdates = $00000002;
cGF_SelCellsMerged = $00000080;
cGF_SelectedByMouse = $00000020;
cGF_ThroughClick = $00000040;
cGridLineWidthDef = 1;
ciCellBkGnd = TKGridColorIndex(0);
ciCellLines = TKGridColorIndex(1);
ciCellText = TKGridColorIndex(2);
ciDragSuggestionBkGnd = TKGridColorIndex(3);
ciDragSuggestionLine = TKGridColorIndex(4);
ciFixedCellBkGnd = TKGridColorIndex(5);
ciFixedCellIndication = TKGridColorIndex(6);
ciFixedCellLines = TKGridColorIndex(7);
ciFixedCellText = TKGridColorIndex(8);
ciFixedThemedCellHighlight = TKGridColorIndex(10);
ciFixedThemedCellLines = TKGridColorIndex(9);
ciFixedThemedCellShadow = TKGridColorIndex(11);
ciFocusedCellBkGnd = TKGridColorIndex(12);
ciFocusedCellText = TKGridColorIndex(13);
ciFocusedRangeBkGnd = TKGridColorIndex(14);
ciFocusedRangeText = TKGridColorIndex(15);
ciGridColorsMax = ciSelectedFixedCellBkGnd;
cInvalidIndex = -1;
ciSelectedCellBkGnd = TKGridColorIndex(16);
ciSelectedCellText = TKGridColorIndex(17);
ciSelectedFixedCellBkGnd = TKGridColorIndex(20);
ciSelectedRangeBkGnd = TKGridColorIndex(18);
ciSelectedRangeText = TKGridColorIndex(19);
cMinColWidthDef = 10;
cMinColWidthMin = 5;
cMinRowHeightDef = 10;
cMinRowHeightMin = 5;
cMouseCellHintTimeDef = 800;
cMouseCellHintTimeMax = 10000;
cMouseCellHintTimeMin = 100;
cMoveDirectionDef = mdRight;
cOptionsDef = [goAlwaysShowEditor, goDrawFocusSelected, goEnterMoves, goFixedVertLine, goFixedHorzLine, goIndicateHiddenCells, goHeader, goHeaderAlignment, goHorzLine, goMouseCanHideCells, goMouseOverCells, goRangeSelect, goThemes, goThemedCells, goVertLine];
cOptionsExDef = [gxEnterWraps, gxTABWraps];
cRangeSelectStyleDef = rsDefault;
cRowCountDef = 5;
cScrollBarsDef = ssBoth;
cScrollModeDef = smSmooth;
cScrollSpeedDef = 100;
cScrollSpeedMax = 1000;
cScrollSpeedMin = 50;
cSelectedCellBkGndDef = clBtnFace;
cSelectedCellTextDef = clBtnText;
cSelectedFixedCellBkGndDef = clCream;
cSelectedRangeBkGndDef = clBtnFace;
cSelectedRangeTextDef = clBtnText;
cSizingStyleDef = ssUpdate;
cSortStyleDef = ssDownUp;

Description

cAll = -1;

This constant can be passed into the FirstCol or FirstRow parameter of the UpdateAxes method.

cCellBkGndDef = clWindow;

Default value for the CellBkGnd color property.

cCellLinesDef = clBtnFace;

Default value for the CellLines color property.

cCellTextDef = clWindowText;

Default value for the CellText color property.

cColCountDef = 5;

Default value for the ColCount property.

cDefaultColWidthDef = 64;

Default value for the DefaultColWidth property.

cDefaultRowHeightDef = 21;

Default value for the DefaultRowHeight property.

cDisabledDrawStyleDef = ddBright;

Default value for the DisabledDrawStyle property.

cDragStyleDef = dsLayeredFaded;

Default value for the DragStyle property.

cDragSuggestionBkGndDef = clLime;

Default value for the DragSuggestionBkGnd color property.

cDragSuggestionLineDef = clBlack;

Default value for the DragSuggestionLine color property.

cEditorTransparencyDef = etDefault;

Default value for the EditorTransparency property.

cFixedCellBkGndDef = clBtnFace;

Default value for the FixedCellBkGnd color property.

cFixedCellIndicationDef = clCream;

Default value for the FixedCellIndication color property.

cFixedCellLinesDef = clWindowText;

Default value for the FixedCellLines color property.

cFixedCellTextDef = clBtnText;

Default value for the FixedCellText color property.

cFixedColsDef = 1;

Default value for the FixedCols property.

cFixedRowsDef = 1;

Default value for the FixedRows property.

cFixedThemedCellHighlightDef = clBtnHighlight;

Default value for the FixedThemedCellHighlight color property.

cFixedThemedCellLinesDef = clBtnShadow;

Default value for the FixedThemedCellLines color property.

cFixedThemedCellShadowDef = clBtnFace;

Default value for the FixedThemedCellShadow color property.

cFocusedCellBkGndDef = clHighlight;

Default value for the FocusedCellBkGnd color property.

cFocusedCellTextDef = clHighlightText;

Default value for the FocusedCellText color property.

cFocusedRangeBkGndDef = clHighlight;

Default value for the FocusedRangeBkGnd color property.

cFocusedRangeTextDef = clHighlightText;

Default value for the FocusedRangeText color property.

cGF_CaretToLeft = $00000001;

This internal flag is set if caret should be moved to the left side of the inplace editor.

cGF_DesignHitTest = $00000004;

This internal flag is set to allow column or row sizing at design time.

cGF_EditorModeActive = $00000010;

This internal flag is set to remember inplace editor state if the grid has no input focus.

cGF_EditorUpdating = $00000008;

This internal flag is set to prevent recursive calls while inplace editor is being updated.

cGF_EnterPressed = $00000100;

This internal flag is set if enter key has been pressed and handled by the grid.

cGF_GridUpdates = $00000002;

This internal flag is set if the Set.. methods in TKGridAxisItem and TKGridCell and their descendants must not call any grid methods that could cause infinite recursion.

cGF_SelCellsMerged = $00000080;

This internal flag is set if a selectable grid area contains at least 1 merged cell.

cGF_SelectedByMouse = $00000020;

This internal flag is set if a cell is selected by mouse click.

cGF_ThroughClick = $00000040;

This internal flag is set if a cell is 'through-clicked'.

cGridLineWidthDef = 1;

Default value for the GridLineWidth property.

ciCellBkGnd = TKGridColorIndex(0);

Index for the CellBkGnd property.

ciCellLines = TKGridColorIndex(1);

Index for the CellLines property.

ciCellText = TKGridColorIndex(2);

Index for the CellText property.

ciDragSuggestionBkGnd = TKGridColorIndex(3);

Index for the DragSuggestionBkGnd property.

ciDragSuggestionLine = TKGridColorIndex(4);

Index for the DragSuggestionLine property.

ciFixedCellBkGnd = TKGridColorIndex(5);

Index for the FixedCellBkGnd property.

ciFixedCellIndication = TKGridColorIndex(6);

Index for the FixedCellIndication property.

ciFixedCellLines = TKGridColorIndex(7);

Index for the FixedCellLines property.

ciFixedCellText = TKGridColorIndex(8);

Index for the FixedCellText property.

ciFixedThemedCellHighlight = TKGridColorIndex(10);

Index for the FixedThemedCellHighlight property.

ciFixedThemedCellLines = TKGridColorIndex(9);

Index for the FixedThemedCellLines property.

ciFixedThemedCellShadow = TKGridColorIndex(11);

Index for the FixedThemedCellShadow property.

ciFocusedCellBkGnd = TKGridColorIndex(12);

Index for the FocusedCellBkGnd property.

ciFocusedCellText = TKGridColorIndex(13);

Index for the FocusedCellText property.

ciFocusedRangeBkGnd = TKGridColorIndex(14);

Index for the FocusedRangeBkGnd property.

ciFocusedRangeText = TKGridColorIndex(15);

Index for the FocusedRangeText property.

ciGridColorsMax = ciSelectedFixedCellBkGnd;

Maximum color array index

cInvalidIndex = -1;

Constant for invalid column or row indexes. Currently, it is used internally. Functions InitialCol and InitialRow return this value in case of invalid parameters.

ciSelectedCellBkGnd = TKGridColorIndex(16);

Index for the SelectedCellBkGnd property.

ciSelectedCellText = TKGridColorIndex(17);

Index for the SelectedCellText property.

ciSelectedFixedCellBkGnd = TKGridColorIndex(20);

Index for the TKGridColors.SelectedFixedCell property.

ciSelectedRangeBkGnd = TKGridColorIndex(18);

Index for the SelectedRangeBkGnd property.

ciSelectedRangeText = TKGridColorIndex(19);

Index for the SelectedRangeText property.

cMinColWidthDef = 10;

Default value for the MinColWidth property.

cMinColWidthMin = 5;

Minimum value for the MinColWidth property.

cMinRowHeightDef = 10;

Default value for the MinRowHeight property.

cMinRowHeightMin = 5;

Minimum value for the MinRowHeight property.

cMouseCellHintTimeDef = 800;

Default value for the MouseCellHintTime property.

cMouseCellHintTimeMax = 10000;

Maximum value for the MouseCellHintTime property.

cMouseCellHintTimeMin = 100;

Minimum value for the MouseCellHintTime property.

cMoveDirectionDef = mdRight;

Default value for the MoveDirection property.

cOptionsDef = [goAlwaysShowEditor, goDrawFocusSelected, goEnterMoves, goFixedVertLine, goFixedHorzLine, goIndicateHiddenCells, goHeader, goHeaderAlignment, goHorzLine, goMouseCanHideCells, goMouseOverCells, goRangeSelect, goThemes, goThemedCells, goVertLine];

Default value for the Options property.

cOptionsExDef = [gxEnterWraps, gxTABWraps];

Default value for the OptionsEx property.

cRangeSelectStyleDef = rsDefault;

Default value for the RangeSelectStyle property.

cRowCountDef = 5;

Default value for the RowCount property.

cScrollBarsDef = ssBoth;

Default value for the ScrollBars property.

cScrollModeDef = smSmooth;

Default value for the ScrollModeHorz and ScrollModeVert properties.

cScrollSpeedDef = 100;

Default value for the ScrollSpeed property.

cScrollSpeedMax = 1000;

Maximum value for the ScrollSpeed property.

cScrollSpeedMin = 50;

Minimum value for the ScrollSpeed property.

cSelectedCellBkGndDef = clBtnFace;

Default value for the SelectedCellBkGnd color property.

cSelectedCellTextDef = clBtnText;

Default value for the SelectedCellText color property.

cSelectedFixedCellBkGndDef = clCream;

Default value for then TKGridColors.SelectedFixedCell color property.

cSelectedRangeBkGndDef = clBtnFace;

Default value for the SelectedRangeBkGnd color property.

cSelectedRangeTextDef = clBtnText;

Default value for the SelectedRangeText color property.

cSizingStyleDef = ssUpdate;

Default value for the SizingStyle property.

cSortStyleDef = ssDownUp;

Default value for the SortStyle property.

Author

Tomas Krysl (tk@tkweb.eu)

Created

15 Oct 2006

Last Modified

07 Dec 2010


KControls help: KGrids: Class TKCustomGrid

Class TKCustomGrid

Unit

KGrids

Declaration

type TKCustomGrid = class(TKCustomControl)

Description

KGrid base component

This is the class that you use as the ancestor for your TKCustomGrid overrides.

Hierarchy

TKCustomControl

Fields

 | Name | Description
Protected | FCellHintTimer | Gains access to the cell hint timer.
Protected | FCells | Two-dimensional dynamic array to store cell instances. Different cell classes can be used for cell instances.
Protected | FColors | Provides direct access to the color class for TKCustomGrid descendants
Protected | FCols | Dynamic array to store column instances. Different column classes can be used for column instances.
Protected | FDragArrow | Icon for column/row moving suggestion arrow.
Protected | FDragWindow | Wrapper for the window used to visually indicate a dragged column or row. Under Win2K or later system, this is a layered window. Under Win98SE or older system, it is a normal popup window.
Protected | FEditedCell | Copy of the cell being currently edited.
Protected | FEditor | Provides direct access to the inplace editor instance for TKCustomGrid descendants.
Protected | FEditorCell | Specifies the current position of inplace editor. If Selection.Cell1 is different from FEditorCell, the editor needs to be updated immediatelly to make these two values equal again.
Protected | FEditorRect | Specifies the current bounding rectangle of inplace editor.
Protected | FEditorWindowProc | Pointer to the original WindowProc property of the inplace editor.
Protected | FGridState | Holds the mutually exclusive grid state.
Protected | FHCI | Glyphs for hidden cell indicators.
Protected | FHint | Specifies the cell hint window.
Protected | FHintCell | Specifies the cell where hint timer has been started.
Protected | FHitCell | Specifies the cell where left mouse button has been pressed.
Protected | FHitPos | Specifies the point where left mouse button has been pressed.
Protected | FMaxCol | Field for MaxCol property. Descendants can modify it.
Protected | FMaxRow | Field for MaxRow property. Descendants can modify it.
Protected | FMemCol | Field to remember current column position for keyboard commands.
Protected | FMemRow | Field to remember current row position for keyboard commands.
Protected | FMouseOver | Specifies the cell where mouse is over. FMouseOver is valid if goMouseOverCells is included in Options.
Protected | FRows | Dynamic array to store row instances. Different row classes can be used for row instances.
Protected | FScrollOffset | Current scrolling offset in pixels for smSmooth mode (relative to cell boundary).
Protected | FScrollPos | Current scrolling position in pixels (bound to cell boundary).
Protected | FSelection | Specifies current(topmost) selection not affected by goRowSelect as Selection.
Protected | FSelections | Specifies all selections except FSelection. This separation is done for backward compatibility.
Protected | FTmpBitmap | Auxilliary bitmap for various tasks.

Methods

Overview

Public | constructor Create(AOwner: TComponent); override;
Public | destructor Destroy; override;
Protected | procedure AdjustPageSetup; override;
Protected | function AdjustSelection(const ASelection: TKGridRect): TKGridRect; virtual;
Public | procedure AutoSizeCol(ACol: Integer; FixedCells: Boolean = True);
Public | procedure AutoSizeGrid(Priority: TKGridMeasureCellPriority; FixedCells: Boolean = True);
Public | procedure AutoSizeRow(ARow: Integer; FixedCells: Boolean = True);
Protected | function BeginColDrag(var Origin: Integer; const MousePt: TPoint): Boolean; virtual;
Protected | function BeginColSizing(var Index, Pos: Integer): Boolean; virtual;
Protected | function BeginRowDrag(var Origin: Integer; const MousePt: TPoint): Boolean; virtual;
Protected | function BeginRowSizing(var Index, Pos: Integer): Boolean; virtual;
Protected | procedure CancelMode; override;
Protected | procedure CellHintTimerHandler(Sender: TObject); virtual;
Public | function CellRect(ACol, ARow: Integer; out R: TRect; VisibleOnly: Boolean = False): Boolean;
Public | function CellSelected(ACol, ARow: Integer): Boolean; virtual;
Public | function CellToPoint(ACol, ARow: Integer; var Point: TPoint; VisibleOnly: Boolean = False): Boolean; virtual;
Public | function CellVisible(ACol, ARow: Integer): Boolean; virtual;
Protected | procedure Changed; virtual;
Protected | procedure ChangeDataSize(ColInsert: Boolean; ColAt, ColCnt: Integer; RowInsert: Boolean; RowAt, RowCnt: Integer); virtual;
Protected | function CheckColDrag(Origin: Integer; var Destination: Integer; const MousePt: TPoint): Boolean; virtual;
Protected | function CheckRowDrag(Origin: Integer; var Destination: Integer; const MousePt: TPoint): Boolean; virtual;
Protected | function ClampInView(ACol, ARow: Integer): Boolean;
Public | procedure ClearCol(ACol: Integer); virtual;
Public | procedure ClearGrid; virtual;
Public | procedure ClearRow(ARow: Integer); virtual;
Public | procedure ClearSortMode;
Public | procedure ClearSortModeHorz; virtual;
Public | procedure ClearSortModeVert; virtual;
Protected | procedure ColMoved(FromIndex, ToIndex: Integer); virtual;
Public | function ColSelectable(ACol: Integer): Boolean; virtual;
Public | function ColSelected(ACol: Integer): Boolean; virtual;
Public | function ColValid(ACol: Integer): Boolean; virtual;
Protected | procedure ColWidthsChanged(ACol: Integer); virtual;
Protected | function CompareCellInstances(ACell1, ACell2: TKGridCell): Integer; virtual;
Protected | function CompareCells(ACol1, ARow1, ACol2, ARow2: Integer): Integer; virtual;
Protected | function CompareCols(ARow, ACol1, ACol2: Integer): Integer; virtual;
Protected | function CompareRows(ACol, ARow1, ARow2: Integer): Integer; virtual;
Protected | procedure CreateParams(var Params: TCreateParams); override;
Protected | function CustomSortCols(ByRow: Integer; var SortMode: TKGridSortMode): Boolean; virtual;
Protected | function CustomSortRows(ByCol: Integer; var SortMode: TKGridSortMode): Boolean; virtual;
Protected | procedure DefaultColWidthChanged; virtual;
Public | procedure DefaultComboKeyPreview(AEditor: TComboBox; ACol, ARow: Integer; var Key: Word; ShiftState: TShiftState; var IsGridKey: Boolean); virtual;
Public | procedure DefaultComboSelect(AEditor: TComboBox; SelectAll, CaretToLeft: Boolean); virtual;
Public | function DefaultCompareCells(ACell1, ACell2: TKGridCell): Integer; virtual;
Public | procedure DefaultEditKeyPreview(AEditor: TCustomEdit; ACol, ARow: Integer; var Key: Word; ShiftState: TShiftState; var IsGridKey: Boolean); virtual;
Public | procedure DefaultEditorCreate(ACol, ARow: Integer; var AEditor: TWinControl); virtual;
Public | procedure DefaultEditorDataFromGrid(AEditor: TWinControl; ACol, ARow: Integer; var AssignText: Boolean); virtual;
Public | procedure DefaultEditorDataToGrid(AEditor: TWinControl; ACol, ARow: Integer; var AssignText: Boolean); virtual;
Public | procedure DefaultEditorDestroy(AEditor: TWinControl; ACol, ARow: Integer); virtual;
Public | procedure DefaultEditorKeyPreview(AEditor: TWinControl; ACol, ARow: Integer; var Key: Word; ShiftState: TShiftState; var IsGridKey: Boolean); virtual;
Public | procedure DefaultEditorResize(AEditor: TWinControl; ACol, ARow: Integer; var ARect: TRect); virtual;
Public | procedure DefaultEditorSelect(AEditor: TWinControl; ACol, ARow: Integer; SelectAll, CaretToLeft, SelectedByMouse: Boolean); virtual;
Public | procedure DefaultEditSelect(AEditor: TCustomEdit; SelectAll, CaretToLeft: Boolean); virtual;
Public | procedure DefaultMouseCellHint(ACol, ARow: Integer; AShow: Boolean); virtual;
Protected | procedure DefaultRowHeightChanged; virtual;
Public | procedure DefaultScrollBarKeyPreview(AEditor: TScrollBar; ACol, ARow: Integer; var Key: Word; ShiftState: TShiftState; var IsGridKey: Boolean);
Protected | procedure DefaultSetCaretToLeft(Key: Word; ShiftState: TShiftState); virtual;
Protected | procedure DefineProperties(Filer: TFiler); override;
Public | procedure DeleteCol(At: Integer); virtual;
Public | procedure DeleteCols(At, Count: Integer); virtual;
Public | procedure DeleteRow(At: Integer); virtual;
Public | procedure DeleteRows(At, Count: Integer); virtual;
Protected | function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
Protected | function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
Protected | procedure DragMove(ACol, ARow: Integer; MousePt: TPoint);
Protected | function DrawCell(ACol, ARow: Integer; ARect: TRect; AState: TKGridDrawState): Boolean; virtual;
Protected | function EditorCreate(ACol, ARow: Integer): TWinControl; virtual;
Protected | procedure EditorDataFromGrid(AEditor: TWinControl; ACol, ARow: Integer); virtual;
Protected | procedure EditorDataToGrid(AEditor: TWinControl; ACol, ARow: Integer); virtual;
Protected | procedure EditorDestroy(var AEditor: TWinControl; ACol, ARow: Integer); virtual;
Protected | function EditorIsTransparent: Boolean; virtual;
Protected | function EditorKeyPreview(AEditor: TWinControl; ACol, ARow: Integer; var Key: Word; Shift: TShiftState): Boolean; virtual;
Protected | procedure EditorResize(AEditor: TWinControl; ACol, ARow: Integer; var ARect: TRect); virtual;
Protected | procedure EditorSelect(AEditor: TWinControl; ACol, ARow: Integer; SelectAll, CaretToLeft, SelectedByMouse: Boolean); virtual;
Protected | procedure EditorWindowProc(var Msg: TLMessage); virtual;
Protected | function EndColDrag(Origin, Destination: Integer; const MousePt: TPoint): Boolean; virtual;
Protected | function EndColSizing(var Index, Pos: Integer): Boolean; virtual;
Protected | function EndRowDrag(Origin, Destination: Integer; const MousePt: TPoint): Boolean; virtual;
Protected | function EndRowSizing(var Index, Pos: Integer): Boolean; virtual;
Public | procedure FindBaseCell(ACol, ARow: Integer; out BaseCol, BaseRow: Integer); virtual;
Public | procedure FocusCell(ACol, ARow: Integer);
Protected | procedure FreeData;
Protected | procedure GetAxisInfo(var Info: TKGridAxisInfo); virtual;
Public | function GetAxisInfoBoth(Mask: TKGridAxisInfoMask): TKGridAxisInfoBoth;
Public | function GetAxisInfoHorz(Mask: TKGridAxisInfoMask): TKGridAxisInfo; virtual;
Public | function GetAxisInfoVert(Mask: TKGridAxisInfoMask): TKGridAxisInfo; virtual;
Protected | function GetDragRect(Info: TKGridAxisInfoBoth; out DragRect: TRect): Boolean; virtual;
Public | function GetDrawState(ACol, ARow: Integer; AFocused: Boolean): TKGridDrawState; virtual;
Public | function GridRectSelectable(const GridRect: TKGridRect): Boolean; virtual;
Public | function GridRectToRect(GridRect: TKGridRect; var R: TRect; VisibleOnly: Boolean = False; Merged: Boolean = True): Boolean; virtual;
Public | function GridRectValid(const GridRect: TKGridRect): Boolean; virtual;
Protected | function GridStateToInvisibleCells: TKGridInvisibleCells;
Public | function HasFocus: Boolean; virtual;
Protected | function HasHorzScrollBar: Boolean; virtual;
Protected | function HasVertScrollBar: Boolean; virtual;
Public | procedure HideCellHint;
Public | function InitialCol(ACol: Integer): Integer; virtual;
Public | function InitialColInv(ACol: Integer): Integer; virtual;
Public | function InitialRow(ARow: Integer): Integer; virtual;
Public | function InitialRowInv(ARow: Integer): Integer; virtual;
Public | procedure InsertCol(At: Integer); virtual;
Public | procedure InsertCols(At, Count: Integer); virtual;
Public | procedure InsertRow(At: Integer); virtual;
Public | procedure InsertRows(At, Count: Integer); virtual;
Public | function InsertSortedCol(out ByRow, ACol: Integer): Boolean; virtual;
Public | function InsertSortedRow(out ByCol, ARow: Integer): Boolean; virtual;
Protected | procedure InternalExchangeCols(Index1, Index2: Integer); virtual;
Protected | procedure InternalExchangeRows(Index1, Index2: Integer); virtual;
Protected | function InternalExpandGridRect(const GridRect: TKGridRect): TKGridRect; virtual;
Protected | procedure InternalFindBaseCell(ACol, ARow: Integer; out BaseCol, BaseRow: Integer); virtual;
Protected | procedure InternalFlip(Left, Right: Integer; Exchange: TKGridExchangeProc); virtual;
Protected | function InternalGetCell(ACol, ARow: Integer): TKGridCell; virtual;
Protected | function InternalGetCellSpan(ACol, ARow: Integer): TKGridCellSpan; virtual;
Protected | function InternalGetColWidths(Index: Integer): Integer; virtual;
Protected | function InternalGetEffectiveColSpacing(ACol: Integer): Integer; virtual;
Protected | function InternalGetEffectiveRowSpacing(ARow: Integer): Integer; virtual;
Protected | procedure InternalGetHExtent(AIndex, AColSpan: Integer; out DestExtent, DestSpacing: Integer); virtual;
Protected | function InternalGetMaxColWidth(Index: Integer): Integer; virtual;
Protected | function InternalGetMaxRowHeight(Index: Integer): Integer; virtual;
Protected | function InternalGetMinColWidth(Index: Integer): Integer; virtual;
Protected | function InternalGetMinRowHeight(Index: Integer): Integer; virtual;
Protected | function InternalGetRowHeights(Index: Integer): Integer; virtual;
Protected | function InternalGetSelAvail: Boolean; override;
Protected | procedure InternalGetVExtent(AIndex, ARowSpan: Integer; out DestExtent, DestSpacing: Integer); virtual;
Protected | function InternalInsertIfCellModifiedNR(ByIndex, Index, Left, Right: Integer; SortedUp: Boolean; Compare: TKGridCompareProc): Integer;
Protected | function InternalInsertNR(ByIndex, Left, Right: Integer; SortedUp: Boolean; Compare: TKGridCompareProc): Integer; virtual;
Protected | function InternalMove(var ACol, ARow: Integer; Command: TKGridMoveCommand; Wrap, Expanding: Boolean): Boolean; virtual;
Protected | procedure InternalPaintCell(ACol, ARow: Integer; AState: TKGridDrawState; const ARect, ABlockRect: TRect; ACanvas: TCanvas; Clip, Printing: Boolean); virtual;
Protected | procedure InternalQuickSortNR(ByIndex, Left, Right: Integer; SortedDown: Boolean; Compare: TKGridCompareProc; Exchange: TKGridExchangeProc); virtual;
Protected | procedure InternalSetCell(ACol, ARow: Integer; Value: TKGridCell); virtual;
Protected | procedure InternalSetCells(ACol, ARow: Integer; const Text: WideString); virtual;
Protected | function InternalSetCellSpan(ACol, ARow: Integer; const Value: TKGridCellSpan): TKGridRect; virtual;
Protected | procedure InternalSetColCount(Value: Integer); virtual;
Protected | procedure InternalSetFixedCols(Value: Integer); virtual;
Protected | procedure InternalSetFixedRows(Value: Integer); virtual;
Protected | procedure InternalSetRowCount(Value: Integer); virtual;
Protected | procedure InternalUnlockUpdate; override;
Protected | function InternalUpdateVirtualGrid: Boolean; virtual;
Public | procedure InvalidateCell(ACol, ARow: Integer);
Public | procedure InvalidateCol(ACol: Integer); virtual;
Public | procedure InvalidateCols(FirstCol: Integer); virtual;
Public | procedure InvalidateCurrentSelection; virtual;
Public | procedure InvalidateGridRect(const GR: TKGridRect; Merged: Boolean = True); virtual;
Public | procedure InvalidateRow(ARow: Integer); virtual;
Public | procedure InvalidateRows(FirstRow: Integer); virtual;
Public | procedure InvalidateSelection(ASelection: TKGridRect); virtual;
Public | function IsDoubleBuffered: Boolean; virtual;
Protected | function IsThemed: Boolean; override;
Protected | procedure KeyDown(var Key: Word; Shift: TShiftState); override;
Protected | procedure LateUpdate(var Msg: TLMessage); override;
Protected | procedure Loaded; override;
Public | procedure LockSortMode; virtual;
Protected | function MeasureCell(ACol, ARow: Integer; const ARect: TRect; AState: TKGridDrawState; Priority: TKGridMeasureCellPriority): TPoint; virtual;
Protected | procedure MeasurePages(var Info: TKPrintMeasureInfo); override;
Protected | procedure MouseCellHint(ACol, ARow: Integer; AShow: Boolean); virtual;
Protected | procedure MouseClickCell(ACol, ARow: Integer); virtual;
Protected | procedure MouseDblClickCell(ACol, ARow: Integer); virtual;
Protected | procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
Protected | procedure MouseEnterCell(ACol, ARow: Integer); virtual;
Protected | procedure MouseFormLeave; override;
Protected | procedure MouseLeaveCell(ACol, ARow: Integer); virtual;
Protected | procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
Protected | procedure MouseOverCells; virtual;
Public | function MouseToCell(X, Y: Integer; var ACol, ARow: Integer): Boolean;
Protected | procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
Public | procedure MoveCol(FromIndex, ToIndex: Integer); virtual;
Public | procedure MoveRow(FromIndex, ToIndex: Integer); virtual;
Public | procedure MoveToNextCell; virtual;
Protected | function PageHeight: Integer; virtual;
Protected | function PageWidth: Integer; virtual;
Public | procedure PaintCell(ACanvas: TCanvas; ACol, ARow: Integer; AX: Integer = 0; AY: Integer = 0; APrinting: Boolean = False; ABlockRect: PRect = nil); virtual;
Protected | function PaintCells(ACanvas: TCanvas; CellBitmap: TBitmap; MainClipRgn: HRGN; FirstCol, LastCol, FirstRow, LastRow, X, Y, MaxX, MaxY: Integer; Printing, PaintSelection: Boolean; const ABlockRect: TRect): TPoint;
Protected | procedure PaintDragSuggestion(ACanvas: TCanvas); virtual;
Protected | procedure PaintHeaderAlignment(ACanvas: TCanvas; ARect: TRect); virtual;
Protected | procedure PaintPage; override;
Protected | procedure PaintSizingSuggestion(ACanvas: TCanvas); virtual;
Public | procedure PaintToCanvas(ACanvas: TCanvas); override;
Protected | function PointToCell(Point: TPoint; OutSide: Boolean; InvisibleCells: TKGridInvisibleCells; out HitCol, HitRow, SelCol, SelRow: Integer): Boolean; virtual;
Protected | function PointToSizing(Point: TPoint; var State: TKGridState; var Index, Pos: Integer): Boolean; virtual;
Protected | procedure ProcessDragWindow(const PtIni, PtCur: TPoint; Index: Integer; ColDrag, Hide: Boolean); virtual;
Public | procedure RealizeCellClass;
Public | procedure RealizeColClass;
Public | procedure RealizeRowClass;
Protected | procedure ResetTopLeft; virtual;
Protected | procedure RowHeightsChanged(ARow: Integer); virtual;
Protected | procedure RowMoved(FromIndex, ToIndex: Integer); virtual;
Public | function RowSelectable(ARow: Integer): Boolean; virtual;
Public | function RowSelected(ARow: Integer): Boolean; virtual;
Public | function RowValid(ARow: Integer): Boolean; virtual;
Protected | procedure SafeSetFocus; virtual;
Protected | procedure Scroll(CodeHorz, CodeVert, DeltaHorz, DeltaVert: Integer; CallUpdateEditor: Boolean); virtual;
Public | procedure ScrollBy(AColCount, ARowCount: Integer);
Public | function ScrollDeltaFromDelta(const Info: TKGridAxisInfo; ADelta: Integer): Integer; virtual;
Public | function ScrollNeeded(ACol, ARow: Integer; out DeltaHorz, DeltaVert: Integer): Boolean; virtual;
Protected | procedure ScrollTimerHandler(Sender: TObject); virtual;
Public | procedure SelectAll;
Protected | function SelectCell(ACol, ARow: Integer): Boolean; virtual;
Public | procedure SelectCol(ACol: Integer);
Public | procedure SelectCols(FirstCol, Count: Integer);
Protected | procedure SelectionChanged(NewSelection: TKGridRect; Flags: TKGridSelectionFlags);
Protected | function SelectionExpand(ACol, ARow: Integer): Boolean; virtual;
Protected | procedure SelectionFix(var Sel: TKGridRect); virtual;
Protected | function SelectionMove(ACol, ARow: Integer; Stage: TKGridSelectionStage; Flags: TKGridSelectionFlags): Boolean; virtual;
Public | procedure SelectionNormalize;
Protected | function SelectionSet(const NewSelection: TKGridRect): Boolean;
Public | procedure SelectRow(ARow: Integer);
Public | procedure SelectRows(FirstRow, Count: Integer);
Protected | function SetMouseCursor(X, Y: Integer): Boolean; override;
Public | procedure ShowCellHint;
Protected | procedure SizeChanged(Change: TKGridSizeChange; Index, Count: Integer); virtual;
Public | procedure SortCols(ByRow: Integer; SortMode: TKGridSortMode); virtual;
Public | function SortModeUnlocked: Boolean; virtual;
Public | procedure SortRows(ByCol: Integer; SortMode: TKGridSortMode); virtual;
Protected | procedure SuggestDrag(State: TKGridCaptureState); virtual;
Protected | procedure SuggestSizing(State: TKGridCaptureState); virtual;
Protected | procedure TopLeftChanged; virtual;
Public | procedure UnlockSortMode; virtual;
Public | procedure UnselectRange;
Protected | procedure UpdateAxes(Horz: Boolean; FirstCol: Integer; Vert: Boolean; FirstRow: Integer; Flags: TKGridAxisUpdateFlags); virtual;
Protected | procedure UpdateCellSpan; virtual;
Protected | procedure UpdateDesigner; virtual;
Protected | procedure UpdateEditor(Show: Boolean); virtual;
Protected | procedure UpdateScrollRange(Horz, Vert, UpdateNeeded: Boolean); virtual;
Protected | procedure UpdateSize; override;
Public | procedure UpdateSortMode(ACol, ARow: Integer); virtual;
Protected | procedure WndProc(var Msg: TMessage); override;

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.

Protected procedure AdjustPageSetup; override;

Adjusts the page setup. Ensures the PrintingMapped property is always True.

Protected function AdjustSelection(const ASelection: TKGridRect): TKGridRect; virtual;

Adjusts any selection rectangle specified by ASelection to be valid selection in goRowSelect mode, i.e. makes ASelection to span the entire row(s).

Public procedure AutoSizeCol(ACol: Integer; FixedCells: Boolean = True);

Resizes the column automatically so that the cell contents fit horizontally. Does include merged cell areas with their base cells located in this column. Set FixedCells to True to include fixed cells into autosizing.

Public procedure AutoSizeGrid(Priority: TKGridMeasureCellPriority; FixedCells: Boolean = True);

Resizes the entire grid automatically so that the cell contents fit both horizontally and vertically. Set FixedCells to True to include fixed cells into autosizing.

Public procedure AutoSizeRow(ARow: Integer; FixedCells: Boolean = True);

Resizes the row automatically so that the cell contents fit vertically. Does include merged cell areas with their base cells located in this row. Set FixedCells to True to include fixed cells into autosizing.

Protected function BeginColDrag(var Origin: Integer; const MousePt: TPoint): Boolean; virtual;

Calls OnBeginColDrag event handler or column class aware equivalent. See the TKGridBeginDragEvent type for parameter interpretation.

Protected function BeginColSizing(var Index, Pos: Integer): Boolean; virtual;

Calls OnBeginColSizing event handler or checks the CanResize property to decide whether the column can be resized. See the TKGridBeginSizingEvent type for parameter interpretation.

Protected function BeginRowDrag(var Origin: Integer; const MousePt: TPoint): Boolean; virtual;

Calls OnBeginRowDrag event handler or row class aware equivalent. See the TKGridBeginDragEvent type for parameter interpretation.

Protected function BeginRowSizing(var Index, Pos: Integer): Boolean; virtual;

Calls OnBeginRowSizing event handler or checks the CanResize property to decide whether the row can be resized. See the TKGridBeginSizingEvent type for parameter interpretation.

Protected procedure CancelMode; override;

Cancels any dragging or resizing operations performed by mouse.

Protected procedure CellHintTimerHandler(Sender: TObject); virtual;

This method is called periodically from the cell hint timer.

Public function CellRect(ACol, ARow: Integer; out R: TRect; VisibleOnly: Boolean = False): Boolean;

Returns the bounding rectangle of a cell specified by ACol and ARow without the column and row spacing areas defined by GridLineWidth. The function returns False if the cell indexes are invalid.

Public function CellSelected(ACol, ARow: Integer): Boolean; virtual;

Determines if a cell specified by ACol and ARow is selected.

Public function CellToPoint(ACol, ARow: Integer; var Point: TPoint; VisibleOnly: Boolean = False): Boolean; virtual;

Returns the left and top coordinates of a cell specified by ACol and ARow. The function returns False if the cell indexes are invalid.

Public function CellVisible(ACol, ARow: Integer): Boolean; virtual;

Determines if a cell specified by ACol and ARow is visible.

Protected procedure Changed; virtual;

In a non virtual grid, this method is called after OnEditorDestroy if the cell content has been modified. Changed calls OnChanged event handler.

Protected procedure ChangeDataSize(ColInsert: Boolean; ColAt, ColCnt: Integer; RowInsert: Boolean; RowAt, RowCnt: Integer); virtual;

Modifies the size of FCols, FRows and FCells. Updates FixedCols, ColCount, MaxCol, FixedRows, RowCount, MaxRow.

Protected function CheckColDrag(Origin: Integer; var Destination: Integer; const MousePt: TPoint): Boolean; virtual;

Calls OnCheckColDrag event handler or column class aware equivalent. See the TKGridCheckDragEvent type for parameter interpretation.

Protected function CheckRowDrag(Origin: Integer; var Destination: Integer; const MousePt: TPoint): Boolean; virtual;

Calls OnCheckRowDrag event handler or row class aware equivalent. See the TKGridCheckDragEvent type for parameter interpretation.

Protected function ClampInView(ACol, ARow: Integer): Boolean;

Forces the scrollable cell specified by ACol and ARow to become visible.

Public procedure ClearCol(ACol: Integer); virtual;

Clears all cells in a column identified by ACol.

Public procedure ClearGrid; virtual;

Clears all cells.

Public procedure ClearRow(ARow: Integer); virtual;

Clears all cells in a row identified by ARow.

Public procedure ClearSortMode;

Clears sorting mode of both rows and columns if grid sorting mode is not locked by LockSortMode.

Public procedure ClearSortModeHorz; virtual;

Clears sorting mode of rows if grid sorting mode is not locked by LockSortMode. Ensures that every column has it's SortMode equal to smNone.

Public procedure ClearSortModeVert; virtual;

Clears sorting mode of columns if grid sorting mode is not locked by LockSortMode. Ensures that every row has it's SortMode equal to smNone.

Protected procedure ColMoved(FromIndex, ToIndex: Integer); virtual;

Calls OnColumnMoved event handler. See the TKGridMovedEvent type for parameter interpretation.

Public function ColSelectable(ACol: Integer): Boolean; virtual;

Determines if a column specified by ACol can be selected, i.e. lies in non-fixed area.

Public function ColSelected(ACol: Integer): Boolean; virtual;

Determines if current selection includes a column specified by ACol.

Public function ColValid(ACol: Integer): Boolean; virtual;

Determines if a column specified by ACol is valid column.

Protected procedure ColWidthsChanged(ACol: Integer); virtual;

Calls OnColWidthsChanged event handler.

Protected function CompareCellInstances(ACell1, ACell2: TKGridCell): Integer; virtual;

Calls OnCompareCells event handler for the given two cell instances.

Protected function CompareCells(ACol1, ARow1, ACol2, ARow2: Integer): Integer; virtual;

Calls OnCompareCells event handler for the given two cells.

Protected function CompareCols(ARow, ACol1, ACol2: Integer): Integer; virtual;

Calls OnCompareCells event handler for two cells belonging to the same row identified by ARow. ACol1 and ACol2 are column indexes of these two cells. Method is used to compare grid rows.

Protected function CompareRows(ACol, ARow1, ARow2: Integer): Integer; virtual;

Calls OnCompareCells event handler for two cells belonging to the same column identified by ACol. ARow1 and ARow2 are row indexes of these two cells. Method is used to compare grid columns.

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

Overriden method - see Delphi help. CreateParams defines additional styles for the KGrid window (scrollbars etc.)

Protected function CustomSortCols(ByRow: Integer; var SortMode: TKGridSortMode): Boolean; virtual;

Calls OnCustomSortCols event handler. See the TKGridCustomSortEvent type for parameter interpretation.

Protected function CustomSortRows(ByCol: Integer; var SortMode: TKGridSortMode): Boolean; virtual;

Calls OnCustomSortRows event handler. See the TKGridCustomSortEvent type for parameter interpretation.

Protected procedure DefaultColWidthChanged; virtual;

Clears all user defined column widths.

Public procedure DefaultComboKeyPreview(AEditor: TComboBox; ACol, ARow: Integer; var Key: Word; ShiftState: TShiftState; var IsGridKey: Boolean); virtual;

Decides whether a key stroke should be handled by inplace editor identified by AEditor or by the grid. AEditor must be a descendant of TCustomComboBox. See TKGridEditorKeyPreviewEvent for interpretation of another parameters.

Public procedure DefaultComboSelect(AEditor: TComboBox; SelectAll, CaretToLeft: Boolean); virtual;

This function allows you to correctly set the caret position within inplace editor identified by AEditor. AEditor must be a descendant of TCustomComboBox. See TKGridEditorSelectEvent for interpretation of another parameters.

Public function DefaultCompareCells(ACell1, ACell2: TKGridCell): Integer; virtual;

Provides default behavior while comparing two cells identified by ACell1 and ACell2. Under current implementation, only text strings will be compared if if any of the cells inherits TKGridTextCell.

Public procedure DefaultEditKeyPreview(AEditor: TCustomEdit; ACol, ARow: Integer; var Key: Word; ShiftState: TShiftState; var IsGridKey: Boolean); virtual;

Decides whether a key stroke should be handled by inplace editor identified by AEditor or by the grid. AEditor must be a descendant of TCustomEdit. See TKGridEditorKeyPreviewEvent for interpretation of another parameters.

Public procedure DefaultEditorCreate(ACol, ARow: Integer; var AEditor: TWinControl); virtual;

Provides default behavior for the OnEditorCreate event.

Public procedure DefaultEditorDataFromGrid(AEditor: TWinControl; ACol, ARow: Integer; var AssignText: Boolean); virtual;

Provides default behavior for the OnEditorDataFromGrid event.

Public procedure DefaultEditorDataToGrid(AEditor: TWinControl; ACol, ARow: Integer; var AssignText: Boolean); virtual;

Provides default behavior for the OnEditorDataToGrid event.

Public procedure DefaultEditorDestroy(AEditor: TWinControl; ACol, ARow: Integer); virtual;

Provides default behavior for the OnEditorCreate event.

Public procedure DefaultEditorKeyPreview(AEditor: TWinControl; ACol, ARow: Integer; var Key: Word; ShiftState: TShiftState; var IsGridKey: Boolean); virtual;

Decides whether a key stroke should be handled by inplace editor identified by AEditor or by the grid. Calls all implemented DefaultxxKeyPreview methods or nothing if no ancestor is found for given AEditor. See TKGridEditorKeyPreviewEvent for interpretation of another parameters.

Public procedure DefaultEditorResize(AEditor: TWinControl; ACol, ARow: Integer; var ARect: TRect); virtual;

Provides default behavior for the OnEditorResize event.

Public procedure DefaultEditorSelect(AEditor: TWinControl; ACol, ARow: Integer; SelectAll, CaretToLeft, SelectedByMouse: Boolean); virtual;

This function allows you to correctly set the caret position within inplace editor identified by AEditor. Calls all implemented DefaultxxSelect methods or nothing if no ancestor is found for given AEditor. See TKGridEditorSelectEvent for interpretation of another parameters.

Public procedure DefaultEditSelect(AEditor: TCustomEdit; SelectAll, CaretToLeft: Boolean); virtual;

This function allows you to correctly set the caret position within inplace editor identified by AEditor. AEditor must be a descendant of TCustomEdit. See TKGridEditorSelectEvent for interpretation of another parameters.

Public procedure DefaultMouseCellHint(ACol, ARow: Integer; AShow: Boolean); virtual;

Provides default cell hint behavior.

Protected procedure DefaultRowHeightChanged; virtual;

Clears all user defined row heights.

Public procedure DefaultScrollBarKeyPreview(AEditor: TScrollBar; ACol, ARow: Integer; var Key: Word; ShiftState: TShiftState; var IsGridKey: Boolean);

Decides whether a key stroke should be handled by inplace editor identified by AEditor or by the grid. AEditor must be a descendant of TScrollBar. See TKGridEditorKeyPreviewEvent for interpretation of another parameters.

Protected procedure DefaultSetCaretToLeft(Key: Word; ShiftState: TShiftState); virtual;

Provides default behavior for an inplace editor if it's caret should be positioned to the left side.

Protected procedure DefineProperties(Filer: TFiler); override;

Defines the custom properties for *.dfm streaming.

Public procedure DeleteCol(At: Integer); virtual;

Deletes a column specified by At. At must be valid column index and ColCount must be > 1. Otherwise, nothing happens.

Public procedure DeleteCols(At, Count: Integer); virtual;

Deletes Count columns starting at index At. At must be valid column index and ColCount must be > 1. Otherwise, nothing happens. Count will be adapted so that no more but available columns will be deleted.

Public procedure DeleteRow(At: Integer); virtual;

Deletes a row specified by At. At must be valid row index and RowCount must be > 1. Otherwise, nothing happens.

Public procedure DeleteRows(At, Count: Integer); virtual;

Deletes Count rows starting at index At. At must be valid row index and RowCount must be > 1. Otherwise, nothing happens. Count will be adapted so that no more but available rows will be deleted.

Protected function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;

Overriden method - see Delphi help. Responds to mouse wheel events.

Protected function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;

Overriden method - see Delphi help. Responds to mouse wheel events.

Protected procedure DragMove(ACol, ARow: Integer; MousePt: TPoint);

Updates column/row dragging state if mouse is moved or scrolling is initiated by mouse. Called from MouseMove and ScrollTimerHandler.

Protected function DrawCell(ACol, ARow: Integer; ARect: TRect; AState: TKGridDrawState): Boolean; virtual;

Calls OnDrawCell event handler or cell class aware equivalent. See the TKGridDrawCellEvent type for parameter interpretation.

Protected function EditorCreate(ACol, ARow: Integer): TWinControl; virtual;

Calls OnEditorCreate event handler or cell class aware equivalent. See the TKGridEditorCreateEvent type for parameter interpretation.

Protected procedure EditorDataFromGrid(AEditor: TWinControl; ACol, ARow: Integer); virtual;

Calls OnEditorDataFromGrid event handler or cell class aware equivalent. See the TKGridEditorDataEvent type for parameter interpretation.

Protected procedure EditorDataToGrid(AEditor: TWinControl; ACol, ARow: Integer); virtual;

Calls OnEditorDataToGrid event handler or cell class aware equivalent. See the TKGridEditorDataEvent type for parameter interpretation.

Protected procedure EditorDestroy(var AEditor: TWinControl; ACol, ARow: Integer); virtual;

Calls OnEditorDestroy event handler or cell class aware equivalent. See the TKGridEditorDestroyEvent type for parameter interpretation.

Protected function EditorIsTransparent: Boolean; virtual;

Determines if the current inplace editor should be treated as transparent control from the grid's point of view. EditorTransparency has higher priority than the default behavior implemented by this method.

Protected function EditorKeyPreview(AEditor: TWinControl; ACol, ARow: Integer; var Key: Word; Shift: TShiftState): Boolean; virtual;

Calls OnEditorKeyPreview event handler or cell class aware equivalent. See the TKGridEditorDataEvent type for parameter interpretation.

Protected procedure EditorResize(AEditor: TWinControl; ACol, ARow: Integer; var ARect: TRect); virtual;

Calls OnEditorResize event handler or cell class aware equivalent. See the TKGridEditorResizeEvent type for parameter interpretation.

Protected procedure EditorSelect(AEditor: TWinControl; ACol, ARow: Integer; SelectAll, CaretToLeft, SelectedByMouse: Boolean); virtual;

Calls OnEditorSelect event handler or cell class aware equivalent. See the TKGridEditorSelectEvent type for parameter interpretation.

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

EditorWindowProc is the subclassed window procedure for inplace editor.

Protected function EndColDrag(Origin, Destination: Integer; const MousePt: TPoint): Boolean; virtual;

Calls OnEndColDrag event handler or column class aware equivalent. See the TKGridEndDragEvent type for parameter interpretation.

Protected function EndColSizing(var Index, Pos: Integer): Boolean; virtual;

Calls OnEndColSizing event handler. See the TKGridEndSizingEvent type for parameter interpretation.

Protected function EndRowDrag(Origin, Destination: Integer; const MousePt: TPoint): Boolean; virtual;

Calls OnEndRowDrag event handler or row class aware equivalent. See the TKGridEndDragEvent type for parameter interpretation.

Protected function EndRowSizing(var Index, Pos: Integer): Boolean; virtual;

Calls OnEndRowSizing event handler. See the TKGridEndSizingEvent type for parameter interpretation.

Public procedure FindBaseCell(ACol, ARow: Integer; out BaseCol, BaseRow: Integer); virtual;

Retrieves the base cell if the cell given by ACol and ARow belongs to a merged cell or returns ACol and ARow if it is a non-merged cell.

Public procedure FocusCell(ACol, ARow: Integer);

Selects a cell specified by ACol and ARow. If the grid has input focus, this cell becomes it automatically.

Protected procedure FreeData;

Destroys all column, row and cell instances.

Protected procedure GetAxisInfo(var Info: TKGridAxisInfo); virtual;

Returns information structure for column or row axis. Some fields of the Info structure must be already defined before calling this function. See TKGridAxisInfo for details.

Public function GetAxisInfoBoth(Mask: TKGridAxisInfoMask): TKGridAxisInfoBoth;

Returns miscellaneous information about both grid axes, i.e. column axis and row axis.

Public function GetAxisInfoHorz(Mask: TKGridAxisInfoMask): TKGridAxisInfo; virtual;

Returns miscellaneous information about column axis.

Public function GetAxisInfoVert(Mask: TKGridAxisInfoMask): TKGridAxisInfo; virtual;

Returns miscellaneous information about row axis.

Protected function GetDragRect(Info: TKGridAxisInfoBoth; out DragRect: TRect): Boolean; virtual;

Returns bounding rectangle where dragged column or row should appear.

Public function GetDrawState(ACol, ARow: Integer; AFocused: Boolean): TKGridDrawState; virtual;

Returns default draw state for a cell identified by ACol and ARow. Called by Paint - override to implement specific behavior.

Public function GridRectSelectable(const GridRect: TKGridRect): Boolean; virtual;

Determines if the entire grid rectangle lies within the non-fixed and thus selectable area.

Public function GridRectToRect(GridRect: TKGridRect; var R: TRect; VisibleOnly: Boolean = False; Merged: Boolean = True): Boolean; virtual;

Converts a grid rectangle into client coordinates. Set VisibleOnly to True to take only the visible part of the rectangle. Indexes in GridRect will be automatically trimmed either to non-fixed area or to a fixed area depending on top-left cell specified in GridRect. Set Merged to True to expand the grid rectangle by possible merged cell areas. The returned coordinates include column and row spacing areas defined by GridLineWidth.

Public function GridRectValid(const GridRect: TKGridRect): Boolean; virtual;

Determines if all indexes in GridRect are valid column or row indexes.

Protected function GridStateToInvisibleCells: TKGridInvisibleCells;

Returns the combination of invisible cells that must be taken into account for the state indicated by GridState.

Public function HasFocus: Boolean; virtual;

Determines if the grid, inplace editor or any child window of inplace editor has input focus.

Protected function HasHorzScrollBar: Boolean; virtual;

Determines if the grid can have a horizontal scrollbar.

Protected function HasVertScrollBar: Boolean; virtual;

Determines if the grid can have a vertical scrollbar.

Public procedure HideCellHint;

Forces the cell hint to hide.

Public function InitialCol(ACol: Integer): Integer; virtual;

Determines the initial index of a column identified by ACol. This function is a part of index mapping mechanism. Initial index is assigned to a column immediately after it is inserted into the grid either by changing ColCount or InsertCols.

Public function InitialColInv(ACol: Integer): Integer; virtual;

Determines the current column index from initial column position given by ACol. This function is a part of index mapping mechanism.

Public function InitialRow(ARow: Integer): Integer; virtual;

Determines the initial index of a row identified by ARow. This function is a part of index mapping mechanism. Initial index is assigned to a row immediately after it is inserted into the grid either by changing RowCount or InsertRows.

Public function InitialRowInv(ARow: Integer): Integer; virtual;

Determines the current row index from initial row position given by ARow. This function is a part of index mapping mechanism.

Public procedure InsertCol(At: Integer); virtual;

Inserts a new column into the grid. The new column will be inserted before the column identified by At. You can set this parameter greater or equal ColCount to insert a new column behind the last column.

Public procedure InsertCols(At, Count: Integer); virtual;

Inserts multiple new columns into the grid. The new columns will be inserted before the column identified by At. You can set this parameter greater or equal ColCount to insert these after the last column.

Public procedure InsertRow(At: Integer); virtual;

Inserts a new row into the grid. The new row will be inserted before the row identified by At. You can set this parameter greater or equal RowCount to insert a new row behind the last row.

Public procedure InsertRows(At, Count: Integer); virtual;

Inserts multiple new rows into the grid. The new rows will be inserted before the row identified by At. You can set this parameter greater or equal RowCount to insert these after the last row.

Public function InsertSortedCol(out ByRow, ACol: Integer): Boolean; virtual;

Inserts an empty column at the corresponding position. If columns are not sorted at this point, InsertSortedCol does nothing and returns False. During InsertSortedCol, a non recursive binary tree search is performed and the OnCompareCells event handler is called several times with slightly different parameters than e.g. during SortCols, i.e. the ACol1 is always cInvalidIndex. You can detect it to perform custom comparisons with the new value.

Public function InsertSortedRow(out ByCol, ARow: Integer): Boolean; virtual;

Inserts an empty row at the corresponding position. If rows are not sorted at this point, InsertSortedRow does nothing and returns False. During InsertSortedRow, a non recursive binary tree search is performed and the OnCompareCells event handler is called several times with slightly different parameters than e.g. during SortRows, i.e. the ARow1 is always cInvalidIndex. You can detect it to perform custom comparisons with the new value.

Protected procedure InternalExchangeCols(Index1, Index2: Integer); virtual;

Used internally to physically exchange two distinct columns.

Protected procedure InternalExchangeRows(Index1, Index2: Integer); virtual;

Used internally to physically exchange two distinct rows.

Protected function InternalExpandGridRect(const GridRect: TKGridRect): TKGridRect; virtual;

Used internally to check if the given grid rectangle contains any merged cell areas and if so, then expand it so that the result encloses all respective merged cells.

Protected procedure InternalFindBaseCell(ACol, ARow: Integer; out BaseCol, BaseRow: Integer); virtual;

Retrieves the base cell if the cell given by ACol and ARow belongs to a merged cell or returns ACol and ARow if it is a non-merged cell.

Protected procedure InternalFlip(Left, Right: Integer; Exchange: TKGridExchangeProc); virtual;

Used internally to reverse the order of previously sorted rows or columns in a fast manner, without cell comparisons.

Protected function InternalGetCell(ACol, ARow: Integer): TKGridCell; virtual;

Used internally. Returns a cell instance for the cell identified by ACol and ARow. If the cell instance is nil, creates a new instance for the cell using CellClass.

Protected function InternalGetCellSpan(ACol, ARow: Integer): TKGridCellSpan; virtual;

Returns the column span and row span for given cell. Does not perform cell validity check.

Protected function InternalGetColWidths(Index: Integer): Integer; virtual;

Returns the column width. Does not perform column validity check.

Protected function InternalGetEffectiveColSpacing(ACol: Integer): Integer; virtual;

Returns the effective column spacing. Does not perform column validity check.

Protected function InternalGetEffectiveRowSpacing(ARow: Integer): Integer; virtual;

Returns the effective row spacing. Does not perform row validity check.

Protected procedure InternalGetHExtent(AIndex, AColSpan: Integer; out DestExtent, DestSpacing: Integer); virtual;

Returns width and spacing for several cells according to given parameters.

Protected function InternalGetMaxColWidth(Index: Integer): Integer; virtual;

Returns the maximum column width. Does not perform column validity check.

Protected function InternalGetMaxRowHeight(Index: Integer): Integer; virtual;

Returns the maximum row height. Does not perform row validity check.

Protected function InternalGetMinColWidth(Index: Integer): Integer; virtual;

Returns the minimum column width. Does not perform column validity check.

Protected function InternalGetMinRowHeight(Index: Integer): Integer; virtual;

Returns the minimum row height. Does not perform row validity check.

Protected function InternalGetRowHeights(Index: Integer): Integer; virtual;

Returns the row height. Does not perform row validity check.

Protected function InternalGetSelAvail: Boolean; override;

Returns always True.

Protected procedure InternalGetVExtent(AIndex, ARowSpan: Integer; out DestExtent, DestSpacing: Integer); virtual;

Returns height and spacing for several cells according to given parameters.

Protected function InternalInsertIfCellModifiedNR(ByIndex, Index, Left, Right: Integer; SortedUp: Boolean; Compare: TKGridCompareProc): Integer;

Used internally by UpdateSortMode to place a modified cell into a correct location in a sorted row or column. This is performed in a fast manner using a binary tree search.

Protected function InternalInsertNR(ByIndex, Left, Right: Integer; SortedUp: Boolean; Compare: TKGridCompareProc): Integer; virtual;

Used internally by e.g. InsertSortedRow to insert a new row/column into previously sorted rows/column in a fast manner, using a binary tree search.

Protected function InternalMove(var ACol, ARow: Integer; Command: TKGridMoveCommand; Wrap, Expanding: Boolean): Boolean; virtual;

Used internally by KeyDown or other methods. Modifies ACol and ARow according to Command.

Protected procedure InternalPaintCell(ACol, ARow: Integer; AState: TKGridDrawState; const ARect, ABlockRect: TRect; ACanvas: TCanvas; Clip, Printing: Boolean); virtual;

Paints a cell identified by ACol and ARow. The cell will be painted to ACanvas according to the draw state specified by AState into a position specified by ARect. If ADoubleBufferedCells is True, ACanvas must be a memory device context. PaintCell ensures the correct memory bitmap for cell double buffering will be selected to this device context.

Protected procedure InternalQuickSortNR(ByIndex, Left, Right: Integer; SortedDown: Boolean; Compare: TKGridCompareProc; Exchange: TKGridExchangeProc); virtual;

Used internally by e.g. SortRows to sort rows or columns using a non recursive quick sort algorithm.

Protected procedure InternalSetCell(ACol, ARow: Integer; Value: TKGridCell); virtual;

Used internally to assign new cell value.

Protected procedure InternalSetCells(ACol, ARow: Integer; const Text: WideString); virtual;

Used internally to assign new text to a cell.

Protected function InternalSetCellSpan(ACol, ARow: Integer; const Value: TKGridCellSpan): TKGridRect; virtual;

Sets the cell span paramters according to given parameters. Automatically splits any existing overlapping areas. Returns a grid rectangle that can be used to update all affected cells.

Protected procedure InternalSetColCount(Value: Integer); virtual;

Used internally to set column count.

Protected procedure InternalSetFixedCols(Value: Integer); virtual;

Used internally to set fixed column count.

Protected procedure InternalSetFixedRows(Value: Integer); virtual;

Used internally to set fixed row count.

Protected procedure InternalSetRowCount(Value: Integer); virtual;

Used internally to set row count.

Protected procedure InternalUnlockUpdate; override;

Allows the changes to be reflected.

Protected function InternalUpdateVirtualGrid: Boolean; virtual;

Allows the descendant to decide whether the goVirtualGrid option can be modified.

Public procedure InvalidateCell(ACol, ARow: Integer);

Invalidates the cell specified by ACol and ARow if grid updating is not locked by LockUpdate.

Public procedure InvalidateCol(ACol: Integer); virtual;

Invalidates the entire column specified by ACol if grid updating is not locked by LockUpdate.

Public procedure InvalidateCols(FirstCol: Integer); virtual;

Invalidates all columns starting with FirstCol if grid updating is not locked by LockUpdate.

Public procedure InvalidateCurrentSelection; virtual;

Invalidates the current selection including the fixed cells in goIndicateSelection mode if grid updating is not locked by LockUpdate.

Public procedure InvalidateGridRect(const GR: TKGridRect; Merged: Boolean = True); virtual;

Invalidates the grid rectangle specified by GridRect if grid updating is not locked by LockUpdate.

Public procedure InvalidateRow(ARow: Integer); virtual;

Invalidates the entire row specified by ARow if grid updating is not locked by LockUpdate.

Public procedure InvalidateRows(FirstRow: Integer); virtual;

Invalidates all rows starting with FirstRow if grid updating is not locked by LockUpdate.

Public procedure InvalidateSelection(ASelection: TKGridRect); virtual;

Invalidates any custom grid rectangle that should be treated as grid selection, including the fixed cells in goIndicateSelection mode, if grid updating is not locked by LockUpdate.

Public function IsDoubleBuffered: Boolean; virtual;

Returns True either if the DoubleBuffered property is True or if goDoubleBufferedCells is included in grid's Options.

Protected function IsThemed: Boolean; override;

Determines if control can be painted with OS themes.

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

Overriden method - see Delphi help. Responds to keyboard events. Implements TCustomGrid specific behavior when the user presses a key.

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

Overriden method - performs late update.

Protected procedure Loaded; override;

Overriden method - see Delphi help. Updates grid colors.

Public procedure LockSortMode; virtual;

Locks sort mode updating so that all changes made to the cell data will not affect the current sort status of any column or row. Every LockSortMode call must have a corresponding UnlockSortMode call, please use a try-finally section.

Protected function MeasureCell(ACol, ARow: Integer; const ARect: TRect; AState: TKGridDrawState; Priority: TKGridMeasureCellPriority): TPoint; virtual;

Calls OnMeasureCell event handler or cell class aware equivalent. See the TKGridMeasureCellEvent type for parameter interpretation.

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

Measures the grid and updates information about printed shape.

Protected procedure MouseCellHint(ACol, ARow: Integer; AShow: Boolean); virtual;

Calls OnMouseCellHint event handler. See the TKGridCellEvent type for parameter interpretation.

Protected procedure MouseClickCell(ACol, ARow: Integer); virtual;

Calls OnMouseClickCell event handler. See the TKGridCellEvent type for parameter interpretation.

Protected procedure MouseDblClickCell(ACol, ARow: Integer); virtual;

Calls OnMouseDblClickCell event handler. See the TKGridCellEvent type for parameter interpretation.

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

Overriden method - see Delphi help. Responds to mouse events. Implements TCustomGrid specific behavior when the user presses a mouse button.

Protected procedure MouseEnterCell(ACol, ARow: Integer); virtual;

Calls OnMouseEnterCell event handler. See the TKGridCellEvent type for parameter interpretation.

Protected procedure MouseFormLeave; override;

Overriden method. Responds to WM_MOUSELEAVE message.

Protected procedure MouseLeaveCell(ACol, ARow: Integer); virtual;

Calls OnMouseLeaveCell event handler. See the TKGridCellEvent type for parameter interpretation.

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

Overriden method - see Delphi help. Responds to mouse events. Implements TCustomGrid specific behavior when the user moves the mouse cursor.

Protected procedure MouseOverCells; virtual;

Implements default behavior to visually indicate that the mouse cursor enters or leaves the cell if goMouseOverCells is included in Options.

Public function MouseToCell(X, Y: Integer; var ACol, ARow: Integer): Boolean;

Determines the cell that contains client area coordinates X and Y. If there is such a cell, the function returns True and corresponding cell indexes are returned in ACol and ARow. Otherwise, the function returns False.

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

Overriden method - see Delphi help. Responds to mouse events. Implements TCustomGrid specific behavior when the user releases a mouse button.

Public procedure MoveCol(FromIndex, ToIndex: Integer); virtual;

Moves a column from a position specified by FromIndex to a new position specified by ToIndex. Both column indexes must be valid and FromIndex must not equal to ToIndex. Otherwise, nothing happens.

Public procedure MoveRow(FromIndex, ToIndex: Integer); virtual;

Moves a row from a position specified by FromIndex to a new position specified by ToIndex. Both row indexes must be valid and FromIndex must not equal to ToIndex. Otherwise, nothing happens.

Public procedure MoveToNextCell; virtual;

Forces to move the input focus to the next cell according to MoveDirection and calls OnClick event if that succeeds.

Protected function PageHeight: Integer; virtual;

Returns the amount of rows in current page, minimum is 1.

Protected function PageWidth: Integer; virtual;

Returns the amount of columns in current page, minimum is 1.

Public procedure PaintCell(ACanvas: TCanvas; ACol, ARow: Integer; AX: Integer = 0; AY: Integer = 0; APrinting: Boolean = False; ABlockRect: PRect = nil); virtual;

Paints a cell identified by ACol and ARow to ACanvas. This is faster way than InvalidateCell but won't work under Qt. Set ACanvas to nil to paint to grid's Canvas. Otherwise, set AX and AY to specify painting origin on custom ACanvas.

Protected function PaintCells(ACanvas: TCanvas; CellBitmap: TBitmap; MainClipRgn: HRGN; FirstCol, LastCol, FirstRow, LastRow, X, Y, MaxX, MaxY: Integer; Printing, PaintSelection: Boolean; const ABlockRect: TRect): TPoint;

Paints a range of cells.

Protected procedure PaintDragSuggestion(ACanvas: TCanvas); virtual;

Paints the suggestion for drop target when dragging a column or row.

Protected procedure PaintHeaderAlignment(ACanvas: TCanvas; ARect: TRect); virtual;

Paints a header terminating rectangle to align the header with the right client area edge.

Protected procedure PaintPage; override;

Paints a page to a printer/preview canvas.

Protected procedure PaintSizingSuggestion(ACanvas: TCanvas); virtual;

Paints the suggestion for new width/height of a column/row being resized.

Public procedure PaintToCanvas(ACanvas: TCanvas); override;

Paints the control to the specified canvas.

Protected function PointToCell(Point: TPoint; OutSide: Boolean; InvisibleCells: TKGridInvisibleCells; out HitCol, HitRow, SelCol, SelRow: Integer): Boolean; virtual;

Determines which cell lies at client coordinates specified by Point. Set OutSide to True to evaluate a cell that does not actually lie at Point but is the closest. Such a cell always lies at the boundary of scrollable cell area. This is used for scrolling by mouse. InvisibleCells specifies if some invisible cells should be considered in some cases. Currently, this is used for scrolling by mouse, either. This function returns True if the corresponding cell has been found. In this case, ACol and ARow contain column and row indexes of the returned cell.

Protected function PointToSizing(Point: TPoint; var State: TKGridState; var Index, Pos: Integer): Boolean; virtual;

Determines the possible column or row sizing state along with default sizing parameters for client coordinates specified by Point. The possible sizing state is returned in State and sizing parameters in Index and Pos. This function returns True if Point is in an area where sizing of a column or row can begin.

Protected procedure ProcessDragWindow(const PtIni, PtCur: TPoint; Index: Integer; ColDrag, Hide: Boolean); virtual;

Updates drag object's (layered) window used to visually indicate the dragged column or row. This window is updated according to mouse cursor coordinates in MousePt, column or row index specified by Index. The Hide parameter forces the window to hide and thus visually indicate that column or row dragging has ended.

Public procedure RealizeCellClass;

Forces the cell class specified by CellClass to replace all other cell classes that do not inherit from it. Call this method to ensure that all the cells in the grid contain instances of CellClass or those inherited from CellClass. All possible cell class properties are copied by the Assign method.

Public procedure RealizeColClass;

Forces the column class specified by ColClass to replace all other column classes that do not inherit from it. Call this method to ensure that the entire horizontal grid axis contains instances of ColClass or those inherited from ColClass. All possible column class properties are copied by the Assign method.

Public procedure RealizeRowClass;

Forces the row class specified by RowClass to replace all other row classes that do not inherit from it. Call this method to ensure that the entire vertical grid axis contains instances of RowClass or those inherited from RowClass. All possible row class properties are copied by the Assign method.

Protected procedure ResetTopLeft; virtual;

Resets the LeftCol and TopRow property after the FixedCols or FixedRows properties have changed.

Protected procedure RowHeightsChanged(ARow: Integer); virtual;

Calls OnRowHeightsChanged event handler.

Protected procedure RowMoved(FromIndex, ToIndex: Integer); virtual;

Calls OnRowMoved event handler. See the TKGridMovedEvent type for parameter interpretation.

Public function RowSelectable(ARow: Integer): Boolean; virtual;

Determines if a row specified by ARow can be selected, i.e. lies in non-fixed area.

Public function RowSelected(ARow: Integer): Boolean; virtual;

Determines if current selection includes a row specified by ARow.

Public function RowValid(ARow: Integer): Boolean; virtual;

Determines if a row specified by ARow is valid row.

Protected procedure SafeSetFocus; virtual;

Tries to set input focus to the grid if EditorMode is False or to the inplace editor if EditorMode is True.

Protected procedure Scroll(CodeHorz, CodeVert, DeltaHorz, DeltaVert: Integer; CallUpdateEditor: Boolean); virtual;

Scrolls the scrollable cells either horizontally by DeltaHorz or vertically by DeltaVert or in both directions. CodeHorz and CodeVert are the codes coming from WM_HSCROLL or WM_VSCROLL messages. Set CallUpdateEditor to True to call UpdateEditor within this method to scroll the inplace editor, either. Set CallUpdateEditor to False if you don't want to scroll the inplace editor and update it by some other means, such as SelectionMove. This method avoids inplace editor flickering when scrolling with EditorMode = True.

Public procedure ScrollBy(AColCount, ARowCount: Integer);

Scrolls the non-fixed cells horizontally by AColCount cells or vertically by ARowCount cells. If the cells cannot be scrolled, nothing happens.

Public function ScrollDeltaFromDelta(const Info: TKGridAxisInfo; ADelta: Integer): Integer; virtual;

Retrieves the amount of pixels corresponding to the amount of cells specified by ADelta, relative from LeftCol and TopRow.

Public function ScrollNeeded(ACol, ARow: Integer; out DeltaHorz, DeltaVert: Integer): Boolean; virtual;

Determines if a cell specified by ACol and ARow should be scrolled, i.e. is not fully visible.

Protected procedure ScrollTimerHandler(Sender: TObject); virtual;

This method is called periodically from the timer used to automatically scroll the scrollable cells while the mouse pointer is captured and held outside the grid client area.

Public procedure SelectAll;

Selects all cells.

Protected function SelectCell(ACol, ARow: Integer): Boolean; virtual;

Calls OnSelectCell event handler or cell class aware equivalent See the TKGridSelectCellEvent type for parameter interpretation.

Public procedure SelectCol(ACol: Integer);

Selects a column.

Public procedure SelectCols(FirstCol, Count: Integer);

Select more columns.

Protected procedure SelectionChanged(NewSelection: TKGridRect; Flags: TKGridSelectionFlags);

Protected function SelectionExpand(ACol, ARow: Integer): Boolean; virtual;

Calls OnSelectionExpand event handler or cell class aware equivalent See the TKGridSelectionExpandEvent type for parameter interpretation.

Protected procedure SelectionFix(var Sel: TKGridRect); virtual;

Adjusts the grid rectangle identified by Sel and makes it valid. This method is intended to adjust FSelection or a rectangle assumed to be assigned to FSelection later.

Protected function SelectionMove(ACol, ARow: Integer; Stage: TKGridSelectionStage; Flags: TKGridSelectionFlags): Boolean; virtual;

Initializes or expands the current selection and performs all necessary adjustments. ACol and ARow are the indexes used to initialize or expand the selection. Stage determines, if the selection should be initialized or expanded. Flags forces various adjustments to be performed after the selection has been initialized or expanded. Returns True if the selection could be changed or would not be modified, either.

Public procedure SelectionNormalize;

Normalize current selection.

Protected function SelectionSet(const NewSelection: TKGridRect): Boolean;

Assigns new selection and performs all necessary adjustments.

Public procedure SelectRow(ARow: Integer);

Selects a row.

Public procedure SelectRows(FirstRow, Count: Integer);

Selects more rows.

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

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

Public procedure ShowCellHint;

Forces the cell hint to show on screen.

Protected procedure SizeChanged(Change: TKGridSizeChange; Index, Count: Integer); virtual;

Calls OnSizeChanged event handler. See the TKGridSizeChangedEvent type for parameter interpretation.

Public procedure SortCols(ByRow: Integer; SortMode: TKGridSortMode); virtual;

Sorts columns by values of a row if grid sorting mode is not locked by LockSortMode.

Public function SortModeUnlocked: Boolean; virtual;

Returns True if sort mode updating is not locked, i.e. there is no open LockSortMode and UnlockSortMode pair.

Public procedure SortRows(ByCol: Integer; SortMode: TKGridSortMode); virtual;

Sorts rows by values of a column if grid sorting mode is not locked by LockSortMode.

Protected procedure SuggestDrag(State: TKGridCaptureState); virtual;

Forces the column/row dragging suggestion to be created, destroyed or temporarilly hidden and shown, depending on the State parameter.

Protected procedure SuggestSizing(State: TKGridCaptureState); virtual;

Forces the column/row sizing suggestion to be created, destroyed or temporarilly hidden and shown, depending on the State parameter.

Protected procedure TopLeftChanged; virtual;

Calls OnTopLeftChanged event handler.

Public procedure UnlockSortMode; virtual;

Unlocks sort mode updating so that all changes made to the cell data will clear the current sort status of any column or row.

Public procedure UnselectRange;

Unselects range of cells.

Protected procedure UpdateAxes(Horz: Boolean; FirstCol: Integer; Vert: Boolean; FirstRow: Integer; Flags: TKGridAxisUpdateFlags); virtual;

Updates the column axis if Horz is True and/or row axis if Vert is True. Adjusts column widths/row heights if goAlignLastCol/goAlignLastRow is included in Options. Adjusts scrolling range - calls UpdateScrollRange. Invalidates columns/rows as needed or starting by column/row index given by FirstCol/FirstRow. Specify cAll as FirstCol/FirstRow to invalidate all columns/rows. Performs additional actions as specified by Flags.

Protected procedure UpdateCellSpan; virtual;

Updates/re-calculates the column/row span paramteres of all cells if necessary. Fixes all broken or incomplete merged cell areas, e.g. upon column or row moving or grid resizing.

Protected procedure UpdateDesigner; virtual;

Updates the Delphi form designer if ColWidths or RowHeights have been changed.

Protected procedure UpdateEditor(Show: Boolean); virtual;

Updates the inplace editor state. Set Show to True to create and display the inplace editor. Set Show to False to hide and destroy the inplace editor.

Protected procedure UpdateScrollRange(Horz, Vert, UpdateNeeded: Boolean); virtual;

Updates the scrolling range of the column axis if Horz is True and/or row axis if Vert is True. Set UpdateNeeded to True to force the invalidation of respective grid areas. Set UpdateNeeded to False to let UpdateScrollRange decide whether these need to be invalidated.

Protected procedure UpdateSize; override;

Updates the grid size.

Public procedure UpdateSortMode(ACol, ARow: Integer); virtual;

Updates column and row sorting mode (if there is one) if data has been modified in a single cell. Must be called explicitly each time a cell data has been modified if sorting interface is used.

Protected procedure WndProc(var Msg: TMessage); override;

Inherited method. Used to ensure correct painting for transparent inplace editors.

Properties

Overview

Public | property AllCellsSelected: Boolean;
Public | property AllColsSelected: Boolean;
Public | property AllRowsSelected: Boolean;
Public | property ArrayOfCells: TKGridCells;
Public | property ArrayOfCols: TKGridAxisItems;
Public | property ArrayOfRows: TKGridAxisItems;
Public | property Canvas;
Public | property Cell[ACol, ARow: Integer]: TKGridCell;
Public | property CellClass: TKGridCellClass;
Public | property CellPainter: TKGridCellPainter;
Public | property CellPainterClass: TKGridCellPainterClass;
Public | property Cells[ACol, ARow: Integer]: WideString;
Public | property CellSpan[ACol, ARow: Integer]: TKGridCellSpan;
Public | property Col: Integer;
Public | property ColClass: TKGridColClass;
Public | property ColCount: Integer;
Public | property Color;
Public | property Colors: TKGridColors;
Public | property Cols[Index: Integer]: TKGridCol;
Public | property ColWidths[Index: Integer]: Integer;
Public | property DefaultColWidth: Integer;
Public | property DefaultDrawing: Boolean;
Public | property DefaultRowHeight: Integer;
Public | property DisabledDrawStyle: TKGridDisabledDrawStyle;
Public | property DragStyle: TKGridDragStyle;
Public | property Editor: TWinControl;
Public | property EditorMode: Boolean;
Public | property EditorTransparency: TKGridEditorTransparency;
Public | property EffectiveColSpacing[Index: Integer]: Integer;
Public | property EffectiveRowSpacing[Index: Integer]: Integer;
Public | property EntireColSelected[Index: Integer]: Boolean;
Public | property EntireRowSelected[Index: Integer]: Boolean;
Public | property EntireSelectedColCount: Integer;
Public | property EntireSelectedRowCount: Integer;
Public | property FixedCols: Integer;
Public | property FixedRows: Integer;
Public | property GridHeight: Integer;
Public | property GridLineWidth: Integer;
Public | property GridWidth: Integer;
Public | property LastVisibleCol: Integer;
Public | property LastVisibleRow: Integer;
Public | property LeftCol: Integer;
Public | property MaxCol: Integer;
Public | property MaxRow: Integer;
Public | property MinColWidth: Integer;
Public | property MinRowHeight: Integer;
Public | property MoreCellsSelected: Boolean;
Public | property MouseCellHintTime: Cardinal;
Public | property MoveDirection: TKGridMoveDirection;
Public | property Objects[ACol, ARow: Integer]: TObject;
Public | property OnBeginColDrag: TKGridBeginDragEvent;
Public | property OnBeginColSizing: TKGridBeginSizingEvent;
Public | property OnBeginRowDrag: TKGridBeginDragEvent;
Public | property OnBeginRowSizing: TKGridBeginSizingEvent;
Public | property OnCellSpan: TKGridCellSpanEvent;
Public | property OnChanged: TKGridCellEvent;
Public | property OnCheckColDrag: TKGridCheckDragEvent;
Public | property OnCheckRowDrag: TKGridCheckDragEvent;
Public | property OnColumnMoved: TKGridMovedEvent;
Public | property OnColWidthsChanged: TNotifyEvent;
Public | property OnColWidthsChangedEx: TKGridExtentEvent;
Public | property OnCompareCellInstances: TKGridCompareCellInstancesEvent;
Public | property OnCompareCells: TKGridCompareCellsEvent;
Public | property OnCustomSortCols: TKGridCustomSortEvent;
Public | property OnCustomSortRows: TKGridCustomSortEvent;
Public | property OnDrawCell: TKGridDrawCellEvent;
Public | property OnEditorCreate: TKGridEditorCreateEvent;
Public | property OnEditorDataFromGrid: TKGridEditorDataEvent;
Public | property OnEditorDataToGrid: TKGridEditorDataEvent;
Public | property OnEditorDestroy: TKGridEditorDestroyEvent;
Public | property OnEditorKeyPreview: TKGridEditorKeyPreviewEvent;
Public | property OnEditorResize: TKGridEditorResizeEvent;
Public | property OnEditorSelect: TKGridEditorSelectEvent;
Public | property OnEndColDrag: TKGridEndDragEvent;
Public | property OnEndColSizing: TKGridEndSizingEvent;
Public | property OnEndRowDrag: TKGridEndDragEvent;
Public | property OnEndRowSizing: TKGridEndSizingEvent;
Public | property OnExchangeCols: TKGridExchangeEvent;
Public | property OnExchangeRows: TKGridExchangeEvent;
Public | property OnMeasureCell: TKGridMeasureCellEvent;
Public | property OnMouseCellHint: TKGridCellHintEvent;
Public | property OnMouseClickCell: TKGridCellEvent;
Public | property OnMouseDblClickCell: TKGridCellEvent;
Public | property OnMouseEnterCell: TKGridCellEvent;
Public | property OnMouseLeaveCell: TKGridCellEvent;
Public | property OnRowHeightsChanged: TNotifyEvent;
Public | property OnRowHeightsChangedEx: TKGridExtentEvent;
Public | property OnRowMoved: TKGridMovedEvent;
Public | property OnSelectCell: TKGridSelectCellEvent;
Public | property OnSelectionExpand: TKGridSelectionExpandEvent;
Public | property OnSizeChanged: TKGridSizeChangedEvent;
Public | property OnTopLeftChanged: TNotifyEvent;
Public | property Options: TKGridOptions;
Public | property OptionsEx: TKGridOptionsEx;
Public | property ParentColor;
Public | property RangeSelectStyle: TKGridRangeSelectStyle;
Public | property Row: Integer;
Public | property RowClass: TKGridRowClass;
Public | property RowCount: Integer;
Public | property RowHeights[Index: Integer]: Integer;
Public | property Rows[Index: Integer]: TKGridRow;
Public | property ScrollBars: TScrollStyle;
Public | property ScrollModeHorz: TKGridScrollMode;
Public | property ScrollModeVert: TKGridScrollMode;
Public | property ScrollSpeed: Cardinal;
Public | property Selection: TKGridRect;
Public | property SelectionCount: Integer;
Public | property SelectionRect: TRect;
Public | property Selections[Index: Integer]: TKGridRect;
Public | property SizingStyle: TKGridSizingStyle;
Public | property SortCol: Integer;
Public | property SortRow: Integer;
Public | property SortStyle: TKGridSortStyle;
Public | property TabStops[Index: Integer]: Boolean;
Public | property ThemedCells: Boolean;
Public | property Themes: Boolean;
Public | property ThroughClick: Boolean;
Public | property TopRow: Integer;
Public | property VisibleColCount: Integer;
Public | property VisibleGridRect: TKGridRect;
Public | property VisibleRowCount: Integer;

Description

Public property AllCellsSelected: Boolean;

Determines if all cells are selected.

Public property AllColsSelected: Boolean;

Determines if all columns are selected.

Public property AllRowsSelected: Boolean;

Determines if all columns are selected.

Public property ArrayOfCells: TKGridCells;

Provides fast read only access to the cell array FCells. Any cell can be directly accessed through ArrayOfCells[RowIndex, ColIndex]. In contrast with the Cell property, row index comes BEFORE column index here. It has been designed to speed up operations with rows because most grids usually contain much more rows than colums.

Public property ArrayOfCols: TKGridAxisItems;

Provides fast read only access to column array FCols.

Public property ArrayOfRows: TKGridAxisItems;

Provides fast read only access to row array FRows.

Public property Canvas;

Inherited property - see Delphi help.

Public property Cell[ACol, ARow: Integer]: TKGridCell;

Gains access to the cell instances. New cell instances are always created on demand by utilizing CellClass. To replace all other cell instances with CellClass, call RealizeCellClass.

Public property CellClass: TKGridCellClass;

Cell class used to create new cell instances. Cell instances are always created on demand.

Public property CellPainter: TKGridCellPainter;

Gains access to the active cell painter.

Public property CellPainterClass: TKGridCellPainterClass;

Specifies the cell painter class used to create new CellPainter. The new cell painter instance will be created immediately.

Public property Cells[ACol, ARow: Integer]: WideString;

Gains simplified access to the probably most used property of an textual cell instance. If the cell instance at the position specified by ACol and ARow does not inherit from a textual cell class TKGridTextCell, it will be created for this cell regardless of the current CellClass assignment.

Public property CellSpan[ACol, ARow: Integer]: TKGridCellSpan;

Specifies the column span and row span for given cell. Always specify positive values. Reading this property may return zero or negative values, which are used internally to find base cell of the respective merged area.

Public property Col: Integer;

Gains access to selection base cell. Setting Col discards the current selection and moves focus to a new base cell in the current row that is in the new column. The first column has an index of 0, the second column an index of 1, and so on. If the index denotes a column that is not selectable, nothing happens.

Public property ColClass: TKGridColClass;

Column class used to create new column instances. Column instances are always created when ColCount grows.

Public property ColCount: Integer;

Specifies the number of columns in the grid. Set ColCount to add or delete columns at the righthand side of the grid. The value of ColCount includes any fixed columns at the left of the grid as well as the scrollable columns in the body of the grid.

Public property Color;

Inherited property - see Delphi help. Specifies the default background color for client area erasing and for parts of client area not occupied by cells.

Public property Colors: TKGridColors;

Specifies all colors used by TKCustomGrid's default painting.

Public property Cols[Index: Integer]: TKGridCol;

Gains access to the column instances. Column instances are always created by utilizing ColClass when ColCount grows. To replace all other column instances with ColClass, call RealizeColClass.

Public property ColWidths[Index: Integer]: Integer;

Indicates the width (in pixels) of all the columns in the grid. Set ColWidths at runtime to change the width of an individual column. If the width of a column has not been set explicitly by resizing with the mouse, or by using the ColWidths property, its width is DefaultColWidth.

Public property DefaultColWidth: Integer;

Determines the width (in pixels) of all columns that have not been explicitly resized. Set DefaultColWidth to change the size of all columns in the grid. When DefaultColWidth is set, columns that have been resized using the mouse or by setting the ColWidths property are given the DefaultColWidth as well. When new columns are added to the grid, they are created with a width of DefaultColWidth.

Public property DefaultDrawing: Boolean;

Dummy property - introduced for backward compatibility with TCustomGrid.

Public property DefaultRowHeight: Integer;

Determines the height (in pixels) of all rows that have not been explicitly resized. Set DefaultRowHeight to change the size of all rows in the grid. When DefaultRowHeight is set, rows that have been resized using the mouse or by setting the RowHeights property are given the DefaultRowHeight as well. When new rows are added to the grid, they are created with a height of DefaultRowHeight.

Public property DisabledDrawStyle: TKGridDisabledDrawStyle;

Specifies the style how the control is drawn while not enabled.

Public property DragStyle: TKGridDragStyle;

Specifies how a column or row appears while being moved by mouse.

Public property Editor: TWinControl;

Returns reference to current inplace editor instance.

Public property EditorMode: Boolean;

Determines if inplace editor is active. Set EditorMode to true, at runtime, to put the grid in edit mode. When EditorMode is true, the user can edit cells in the grid. When the user presses F2, EditorMode is set to true. When the user presses Enter, the value of EditorMode is toggled or, depending on goEnterMoves and MoveDirection configuration, another cell is focused. Inplace editor can be activated only if goEditing is included in Options.

Public property EditorTransparency: TKGridEditorTransparency;

Determines if current inplace editor should be treated as a transparent control from the grid's point of view. If a transparent inplace editor needs to be painted, the cell background is painted first to the inplace editor's Canvas/device context. Typically, check boxes or radio buttons should appear as transparent controls in TKCustomGrid. Unfortunatelly we must use a custom decision mechanism as there is no standard VCL/LCL-based mechanism to design a control fully transparent in all cases. The algorithm used to paint the cell background should work for a wide range of controls either with or without OS themes.

Public property EffectiveColSpacing[Index: Integer]: Integer;

Returns the effective spacing between columns. This is nonzero, if goFixedVertLine or goVertLine is included in Options.

Public property EffectiveRowSpacing[Index: Integer]: Integer;

Returns the effective spacing between rows. This is nonzero, if goFixedHorzLine or goHorzLine is included in Options.

Public property EntireColSelected[Index: Integer]: Boolean;

Determines if an entire column is selected.

Public property EntireRowSelected[Index: Integer]: Boolean;

Determines if an entire row is selected.

Public property EntireSelectedColCount: Integer;

Determines number of entirely selected columns.

Public property EntireSelectedRowCount: Integer;

Determines number of entirely selected rows.

Public property FixedCols: Integer;

Specifies the number of columns on the left of the grid that cannot be scrolled. Set FixedCols to create or get rid of nonscrolling columns. Nonscrolling columns appear at the left of the grid, and are always visible, even when the user scrolls the other columns in the grid. Use nonscrolling columns for displaying row titles or row numbers, or to implement a scroll lock that the user can set.

Public property FixedRows: Integer;

Specifies the number of rows on the top of the grid that cannot be scrolled. Set FixedRows to create or get rid of nonscrolling rows. Nonscrolling rows appear at the top of the grid, and are always visible, even when the user scrolls the other rows in the grid. Use nonscrolling rows for displaying column titles or column numbers.

Public property GridHeight: Integer;

Specifies the height of the grid in pixels. If GridHeight is less than the value of ClientHeight, all of the rows of the grid appear in the control with an empty region below the grid. If the underlying grid is too tall to appear in the control, GridHeight is the same as ClientHeight, and the user must scroll to see the entire contents of the grid.

Public property GridLineWidth: Integer;

Specifies the width (in pixels) of the lines that separate the cells of the grid.

Public property GridWidth: Integer;

Specifies the width of the grid in pixels. If GridWidth is less than the value of ClientWidth, all of the columns of the grid appear in the control with an empty region to the right of the grid. If the underlying grid is too wide to appear in the control, GridWidth is the same as ClientWidth, and the user must scroll to see the entire contents of the grid.

Public property LastVisibleCol: Integer;

Returns the last (even partially) visible column in the grid.

Public property LastVisibleRow: Integer;

Returns the last (even partially) visible row in the grid.

Public property LeftCol: Integer;

Specifies the index of the first visible scrollable column in the grid. Set LeftCol to scroll the columns in the grid so that the column with index LeftCol is the first column after the fixed columns.

Public property MaxCol: Integer;

Specifies the number of columns the grid would have if no columns would have been deleted.

Public property MaxRow: Integer;

Specifies the number of rows the grid would have if no rows would have been deleted.

Public property MinColWidth: Integer;

Specifies the minimum width a column can have.

Public property MinRowHeight: Integer;

Specifies the minimum height a row can have.

Public property MoreCellsSelected: Boolean;

Determines if more cells are selected (more than one cell).

Public property MouseCellHintTime: Cardinal;

Specifies how fast the mouse cell hint should be.

Public property MoveDirection: TKGridMoveDirection;

Specifies the behavior after the user presses Enter. This property has no effect unless goEnterMoves is included in Options.

Public property Objects[ACol, ARow: Integer]: TObject;

Lists the objects for each cell in the grid. Setting Objects forces a descendant of TKGridObjectCell to be created for the related cell. If CellClass contains such a descendant, then it will be used instead of TKGridObjectCell. TObject instance given to Objects will be then stored in CellObject property. In contrast to TStringGrid, the passed TObject is owned by the TKGridObjectCell instance. Override TKGridObjectCell to implement another behavior.

Public property OnBeginColDrag: TKGridBeginDragEvent;

OnBeginColDrag is called when the user clicks on a column to start dragging. It enables the grid to control whether the column can be repositioned and if so, which column. Origin is the index of the column to be dragged. When OnBeginColDrag occurs, this is the index of the column in which the mouse was clicked. You can change this value for application specific behavior.

Public property OnBeginColSizing: TKGridBeginSizingEvent;

OnBeginColSizing is called when the user clicks between two columns to start resizing. It enables the grid to control whether the column can be resized and if so, which column. Index is the index of the column to be resized. Pos is the X-coordinate of the sizing line. These values correspond with the default processing initiated by mouse click. You can change both of these values for application specific behavior.

Public property OnBeginRowDrag: TKGridBeginDragEvent;

OnBeginRowDrag is called when the user clicks on a row to start dragging. It enables the grid to control whether the row can be repositioned and if so, which row. Origin is the index of the row to be dragged. When OnBeginRowDrag occurs, this is the index of the row in which the mouse was clicked. You can change this value for application specific behavior.

Public property OnBeginRowSizing: TKGridBeginSizingEvent;

OnBeginRowSizing is called when the user clicks between two rows to start resizing. It enables the grid to control whether the row can be resized and if so, which row. Index is the index of the row to be resized. Pos is the Y-coordinate of the sizing line. These values correspond with the default processing initiated by mouse click. You can change both of these values for application specific behavior.

Public property OnCellSpan: TKGridCellSpanEvent;

OnCellSpan is called whenever the grid needs to get information about column or row span of current cell. Use this only in virtual grid mode and do not write complex code here as this event is called really VERY frequently. You must provide the same cell span information as the TKGridCell.Span for non-virtual mode.

Public property OnChanged: TKGridCellEvent;

OnChanged is called after OnEditorDataToGrid only if OnCompareCellInstances returns different cells. Its purpose is to notify the application about any changes the user made via inplace editors. Does not work in virtual mode (if goVirtualGrid is included in Options).

Public property OnCheckColDrag: TKGridCheckDragEvent;

OnCheckColDrag validates whether the column currently selected for dragging can be dropped at the current location. Origin is the index of the column being actually dragged. Destination represents the potential drop target. You can modify Destination or set CanDrop to False for application specific behavior.

Public property OnCheckRowDrag: TKGridCheckDragEvent;

OnCheckRowDrag validates whether the row currently selected for dragging can be dropped at the current location. Origin is the index of the row being actually dragged. Destination represents the potential drop target. You can modify Destination or set CanDrop to False for application specific behavior.

Public property OnColumnMoved: TKGridMovedEvent;

OnColumnMoved is called after a column has been physically moved.

Public property OnColWidthsChanged: TNotifyEvent;

OnColWidthsChanged is called whenever the width of a single or more columns changes.

Public property OnColWidthsChangedEx: TKGridExtentEvent;

OnColWidthsChangedEx is called whenever the width of a single or more columns changes. AIndex corresponds to the first column whose width has been modified.

Public property OnCompareCellInstances: TKGridCompareCellInstancesEvent;

OnCompareCellInstances is currently called only if the grid needs to decide whether to call the OnChanged event handler. This event is not called in virtual mode (if goVirtualGrid is included in Options).

Public property OnCompareCells: TKGridCompareCellsEvent;

OnCompareCells is called whenever the grid needs to compare contents of two cells. This occurs if the SortCols, SortRows, InsertSortedCol and InsertSortedRow methods are called, either programmatically or by mouse click on the first fixed column or row. Do not write complex code here as this event is called VERY frequently. To speed up sorting, use properties introduced for fast data access, such as ArrayOfCells or TextPtr.

Public property OnCustomSortCols: TKGridCustomSortEvent;

OnCustomSortCols is called whenever the grid needs to sort columns. Use this event to override the default sorting algorithm.

Public property OnCustomSortRows: TKGridCustomSortEvent;

OnCustomSortRows is called whenever the grid needs to sort rows. Use this event to override the default sorting algorithm.

Public property OnDrawCell: TKGridDrawCellEvent;

OnDrawCell is called whenever a cell in the grid needs to be drawn. Draw on the cell using the methods of the Canvas property. If the OnDrawCell event handler is not assigned, all cells in grid will be painted with the cell class aware DrawCell method. If the cell has no assigned cell instance, it appears empty.

Public property OnEditorCreate: TKGridEditorCreateEvent;

OnEditorCreate is called whenever a cell is about to be edited. This event handler allows you to create a custom inplace editor for each cell. The editor should only be created, such as by means of AEditor := TEdit.Create(nil). Correct positioning within the grid, focusing, painting etc. is maintained later by grid itself. No manipulation requiring the editor's Handle is allowed here.

Public property OnEditorDataFromGrid: TKGridEditorDataEvent;

OnEditorDataFromGrid is called after OnEditorCreate. The inplace editor is correctly positioned, has a parent control, its Handle is allocated but is still not visible. Set data from the grid to the inplace editor in an user defined way here. Data can be set in EditorCreate but some assignments need that the inplace editor has a parent control. Grid is always parent control of inplace editor.

Public property OnEditorDataToGrid: TKGridEditorDataEvent;

OnEditorDataToGrid is called if the inplace editor is about to disappear. The inplace editor is still visible here and has a parent control. Its Handle is still allocated. Set data from the inplace editor to the grid in an user defined way here. Data can be transferred in EditorDestroy but some assignments need that the inplace editor has a parent control.

Public property OnEditorDestroy: TKGridEditorDestroyEvent;

OnEditorDestroy is called after OnEditorDataToGrid, just before the inplace editor is destroyed. It is no longer visible here and has no parent control. Its Handle is no more valid. Perform application specific operations just before the editor is destroyed here. You need not destroy the AEditor instance, but if so, set AEditor to nil after destroying it Example: FreeAndNil(AEditor).

Public property OnEditorKeyPreview: TKGridEditorKeyPreviewEvent;

OnEditorKeyPreview is called whenever inplace editor is focused and the user presses some key that is normally handled by the grid if no inplace editor is visible. Sometimes this key needs to be handled by the grid instead of the inplace editor. For example, the EditKeyPreview function decides whether the key needs to be handled by the grid or by the inplace editor. Write your own code that is specific for your custom inplace editors.

Public property OnEditorResize: TKGridEditorResizeEvent;

OnEditorResize is called whenever the grid needs to relocate the inplace editor (this might be quite often). By default, each inplace editor is always located so that its bounding rectangle equals to the cell rectangle. Write your own code to change this behavior. Inplace editors cannot appear outside the edited cell, clipping is always present. Note: Not every TWinControl instance intended as inplace editor can be arbitrary resized.

Public property OnEditorSelect: TKGridEditorSelectEvent;

OnEditorSelect is called immediately after OnEditorDataFromGrid. This event handler allows you to correctly set the caret position within your inplace editor.

Public property OnEndColDrag: TKGridEndDragEvent;

Determines whether a particular column can be dropped immediately after the user releases the mouse button but before the column is actually moved.

Public property OnEndColSizing: TKGridEndSizingEvent;

Determines whether a particular column can be resized immediately after the user releases the mouse button but before the column is actually resized. This event handler has no effect if SizingStyle is ssUpdate.

Public property OnEndRowDrag: TKGridEndDragEvent;

Determines whether a particular row can be dropped immediately after the user releases the mouse button but before the row is actually moved.

Public property OnEndRowSizing: TKGridEndSizingEvent;

Determines whether a particular row can be resized immediately after the user releases the mouse button but before the row is actually resized. This event handler has no effect if SizingStyle is ssUpdate.

Public property OnExchangeCols: TKGridExchangeEvent;

OnExchangeCols is called whenever the grid sorts columns or needs to exchange two columns. Typically you assign this event handler in virtual grid mode goVirtualGrid to physically sort your data or when implementing a custom behavior parallel to sorting cell instances owned by the grid. This event is called from MoveCol, either.

Public property OnExchangeRows: TKGridExchangeEvent;

OnExchangeRows is called whenever the grid sorts rows or needs to exchange two rows. Typically you assign this event handler in virtual grid mode goVirtualGrid to physically sort your data or when implementing a custom behavior parallel to sorting cell instances owned by the grid. This event is called from MoveRow, either.

Public property OnMeasureCell: TKGridMeasureCellEvent;

OnMeasureCell is called whenever the grid needs to get the horizontal and vertical extent of the data displayed in a cell. If the OnMeasureCell event handler is not assigned, all cells in the grid will be measured by default.

Public property OnMouseCellHint: TKGridCellHintEvent;

OnMouseCellHint is called whenever a cell is clicked by left mouse button.

Public property OnMouseClickCell: TKGridCellEvent;

OnMouseClickCell is called whenever a cell is clicked by left mouse button.

Public property OnMouseDblClickCell: TKGridCellEvent;

OnMouseDblClickCell is called whenever a cell is clicked by left mouse button.

Public property OnMouseEnterCell: TKGridCellEvent;

OnMouseEnterCell is called whenever mouse enters a cell.

Public property OnMouseLeaveCell: TKGridCellEvent;

OnMouseLeaveCell is called whenever mouse leaves a cell.

Public property OnRowHeightsChanged: TNotifyEvent;

OnRowHeightsChanged is called whenever the height of a single or more rows changes.

Public property OnRowHeightsChangedEx: TKGridExtentEvent;

OnRowHeightsChangedEx is called whenever the height of a single or more rows changes. AIndex corresponds to the first row whose height has been modified.

Public property OnRowMoved: TKGridMovedEvent;

OnRowMoved is called after a row has been physically moved.

Public property OnSelectCell: TKGridSelectCellEvent;

OnSelectCell is called whenever a cell is about to be selected. A cell can be selected either by mouse or keyboard, or programmatically e.g. by the FocusCell method. CanSelect is True by default to allow all selectable cells to be selected. Change this parameter to False to disallow cell selection. A cell that cannot be selected, cannot be edited as well. Many times you need some cells not to become editable. In this case, let OnEditorCreate decide it rather than OnSelectCell.

Public property OnSelectionExpand: TKGridSelectionExpandEvent;

OnSelectionExpand is called if the user expands the current selection. The selection can be expanded either by mouse or keyboard, or programmatically e.g. by the Selection property. CanExpand is True by default to allow all cells to become a target of selection expansion. Change this parameter to False to disallow selection expansion.

Public property OnSizeChanged: TKGridSizeChangedEvent;

OnSizeChanged is called whenever the ColCount or RowCount properties change.

Public property OnTopLeftChanged: TNotifyEvent;

OnTopLeftChanged is called whenever the LeftCol or TopRow properties change.

Public property Options: TKGridOptions;

Specifies basic display and behavioral properties of the grid.

Public property OptionsEx: TKGridOptionsEx;

Specifies extended display and behavioral properties of the grid.

Public property ParentColor;

Inherited property - see Delphi help.

Public property RangeSelectStyle: TKGridRangeSelectStyle;

Specifies the style how multiple cells are selected.

Public property Row: Integer;

Gains access to selection base cell. Setting Row discards the current selection and moves focus to a new base cell in the current column that is in the new row. The first row has an index of 0, the second row an index of 1, and so on. If the index denotes a row that is not selectable, nothing happens.

Public property RowClass: TKGridRowClass;

Row class used to create new row instances. Row instances are always created when RowCount grows.

Public property RowCount: Integer;

Specifies the number of rows in the grid. Set RowCount to add or delete rows at the bottom of the grid. The value of RowCount includes any fixed rows at the top of the grid as well as the scrollable rows in the body of the grid.

Public property RowHeights[Index: Integer]: Integer;

Indicates the height (in pixels) of all the rows in the grid. Set RowHeights at runtime to change the height of an individual row. If the height of a row has not been set explicitly by resizing with the mouse, or by using the RowHeights property, its height is DefaultRowHeight.

Public property Rows[Index: Integer]: TKGridRow;

Gains access to the row instances. Row instances are always created by utilizing RowClass when RowCount grows. To replace all other row instances with ColClass, call RealizeRowClass.

Public property ScrollBars: TScrollStyle;

Specifies whether the grid includes horizontal and vertical scroll bars. If all the cells in the grid fit in the ClientWidth, no horizontal scroll bar appears, even if ScrollBars is ssHorizontal or ssBoth. If all the cells fit in the ClientHeight, no vertical scroll bar appears, even if ScrollBars is ssVertical or ssBoth.

Public property ScrollModeHorz: TKGridScrollMode;

Specifies how horizontal scrollbar's trackbar scrolls the grid.

Public property ScrollModeVert: TKGridScrollMode;

Specifies how vertical scrollbar's trackbar scrolls the grid.

Public property ScrollSpeed: Cardinal;

Specifies how fast the scrolling by timer should be.

Public property Selection: TKGridRect;

Indicates the boundaries of the current selection. Set Selection to select a range of cells in the grid. In the TKGridRect structure, the Cell1 parameter always denotes base selection cell and Cell2 expanded selection cell. A base cell is always the cell that has input focus and can be currently edited. An expanded cell denotes the other selection corner.

Public property SelectionCount: Integer;

Returns the current number of selections. Returns always a value greater or equal to 1.

Public property SelectionRect: TRect;

Returns the selection rectangle.

Public property Selections[Index: Integer]: TKGridRect;

Gains access to all currently existing selections. This property cannot be used to add new selection. Please use TKCustomGrid.SelectionAdd instead.

Public property SizingStyle: TKGridSizingStyle;

Specifies how a column or row appears while being resized by mouse.

Public property SortCol: Integer;

Returns index of the column having its SortMode property smDown or smUp. There must be always one such column in the grid.

Public property SortRow: Integer;

Returns index of the row having its SortMode property smDown or smUp. There must be always one such row in the grid.

Public property SortStyle: TKGridSortStyle;

Specifies how sorting is performed when user clicks on clickable fixed cells that normally indicate sorting by an arrow.

Public property TabStops[Index: Integer]: Boolean;

Indicates whether the user can tab to specified columns in the grid if goTabs is included in Options. Set TabStops to False to remove the column identified by Index from the tab order. The first column in the grid is identified by an Index of 0. Setting TabStops for fixed columns has no effect.

Public property ThemedCells: Boolean;

Determines if cells can be painted with OS themes at the moment. Returns True if OS themes are available and both goThemes and goThemedCells are included in Options.

Public property Themes: Boolean;

Determines if OS themes are available to the grid.

Public property ThroughClick: Boolean;

If the SelectedByMouse parameter in OnEditorSelect is True you can set ThroughClick to True to click the inplace editor within the same mouse click that selected this cell.

Public property TopRow: Integer;

Specifies the index of the first visible scrollable row in the grid. Set TopRow to scroll the rows in the grid so that the row with index TopRow is the first row after the fixed rows.

Public property VisibleColCount: Integer;

Use VisibleColCount to determine the number of scrollable columns fully visible in the grid. VisibleColCount does not include the fixed columns counted by the FixedCols property. It does not include any partially visible columns on the right edge of the grid.

Public property VisibleGridRect: TKGridRect;

Indicates the area of scrollable cells visible in the grid. VisibleGridRect does not include any fixed cells or partially visible cells on the right or bottom side of the grid.

Public property VisibleRowCount: Integer;

Use VisibleRowCount to determine the number of scrollable rows fully visible in the grid. VisibleRowCount does not include the fixed rows counted by the FixedRows property. It does not include any partially visible rows on the bottom of the grid.


KControls help: KGrids: Class TKGrid

Class TKGrid

Unit

KGrids

Declaration

type TKGrid = class(TKCustomGrid)

Description

KGrid design-time component

This is the class you use both on run-time and design-time.

Hierarchy

TKCustomGrid > TKCustomControl

Properties

Overview

Published | property Align;
Published | property Anchors;
Published | property BorderStyle;
Published | property BorderWidth;
Published | property ColCount;
Published | property Color;
Published | property Colors;
Published | property Constraints;
Published | property Ctl3D;
Published | property DefaultColWidth;
Published | property DefaultDrawing;
Published | property DefaultRowHeight;
Published | property DisabledDrawStyle;
Published | property DragCursor;
Published | property DragKind;
Published | property DragMode;
Published | property DragStyle;
Published | property Enabled;
Published | property FixedCols;
Published | property FixedRows;
Published | property Font;
Published | property GridLineWidth;
Published | property MinColWidth;
Published | property MinRowHeight;
Published | property MouseCellHintTime;
Published | property MoveDirection;
Published | property OnBeginColDrag;
Published | property OnBeginColSizing;
Published | property OnBeginRowDrag;
Published | property OnBeginRowSizing;
Published | property OnCellSpan;
Published | property OnChanged;
Published | property OnCheckColDrag;
Published | property OnCheckRowDrag;
Published | property OnClick;
Published | property OnColumnMoved;
Published | property OnColWidthsChanged;
Published | property OnColWidthsChangedEx;
Published | property OnCompareCellInstances;
Published | property OnCompareCells;
Published | property OnContextPopup;
Published | property OnCustomSortCols;
Published | property OnCustomSortRows;
Published | property OnDblClick;
Published | property OnDockDrop;
Published | property OnDockOver;
Published | property OnDragDrop;
Published | property OnDragOver;
Published | property OnDrawCell;
Published | property OnEditorCreate;
Published | property OnEditorDataFromGrid;
Published | property OnEditorDataToGrid;
Published | property OnEditorDestroy;
Published | property OnEditorKeyPreview;
Published | property OnEditorResize;
Published | property OnEditorSelect;
Published | property OnEndColDrag;
Published | property OnEndColSizing;
Published | property OnEndDock;
Published | property OnEndDrag;
Published | property OnEndRowDrag;
Published | property OnEndRowSizing;
Published | property OnEnter;
Published | property OnExchangeCols;
Published | property OnExchangeRows;
Published | property OnExit;
Published | property OnGetSiteInfo;
Published | property OnKeyDown;
Published | property OnKeyPress;
Published | property OnKeyUp;
Published | property OnMeasureCell;
Published | property OnMouseCellHint;
Published | property OnMouseClickCell;
Published | property OnMouseDblClickCell;
Published | property OnMouseDown;
Published | property OnMouseEnterCell;
Published | property OnMouseLeaveCell;
Published | property OnMouseMove;
Published | property OnMouseUp;
Published | property OnMouseWheel;
Published | property OnMouseWheelDown;
Published | property OnMouseWheelUp;
Published | property OnPrintNotify;
Published | property OnPrintPaint;
Published | property OnResize;
Published | property OnRowHeightsChanged;
Published | property OnRowHeightsChangedEx;
Published | property OnRowMoved;
Published | property OnSelectCell;
Published | property OnSelectionExpand;
Published | property OnSizeChanged;
Published | property OnStartDock;
Published | property OnStartDrag;
Published | property OnTopLeftChanged;
Published | property OnUnDock;
Published | property Options;
Published | property OptionsEx;
Published | property ParentColor;
Published | property ParentFont;
Published | property ParentShowHint;
Published | property PopupMenu;
Published | property RangeSelectStyle;
Published | property RowCount;
Published | property ScrollBars;
Published | property ScrollModeHorz;
Published | property ScrollModeVert;
Published | property ScrollSpeed;
Published | property ShowHint;
Published | property SizingStyle;
Published | property SortStyle;
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 ColCount;

See TKCustomGrid.ColCount for details.

Published property Color;

See TKCustomGrid.Color for details.

Published property Colors;

See TKCustomGrid.Colors for details.

Published property Constraints;

Inherited property - see Delphi help.

Published property Ctl3D;

Inherited property - see Delphi help.

Published property DefaultColWidth;

See TKCustomGrid.DefaultColWidth for details.

Published property DefaultDrawing;

See TKCustomGrid.DefaultDrawing for details.

Published property DefaultRowHeight;

See TKCustomGrid.DefaultRowHeight for details.

Published property DisabledDrawStyle;

See TKCustomGrid.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 DragStyle;

See TKCustomGrid.DragStyle for details.

Published property Enabled;

Inherited property - see Delphi help.

Published property FixedCols;

See TKCustomGrid.FixedCols for details.

Published property FixedRows;

See TKCustomGrid.FixedRows for details.

Published property Font;

Inherited property - see Delphi help.

Published property GridLineWidth;

See TKCustomGrid.GridLineWidth for details.

Published property MinColWidth;

See TKCustomGrid.MinColWidth for details.

Published property MinRowHeight;

See TKCustomGrid.MinRowHeight for details.

Published property MouseCellHintTime;

See TKCustomGrid.MouseCellHintTime for details.

Published property MoveDirection;

See TKCustomGrid.MoveDirection for details.

Published property OnBeginColDrag;

See TKCustomGrid.OnBeginColDrag for details.

Published property OnBeginColSizing;

See TKCustomGrid.OnBeginColSizing for details.

Published property OnBeginRowDrag;

See TKCustomGrid.OnBeginRowDrag for details.

Published property OnBeginRowSizing;

See TKCustomGrid.OnBeginRowSizing for details.

Published property OnCellSpan;

See TKCustomGrid.OnCellSpan for details.

Published property OnChanged;

See TKCustomGrid.OnChanged for details.

Published property OnCheckColDrag;

See TKCustomGrid.OnCheckColDrag for details.

Published property OnCheckRowDrag;

See TKCustomGrid.OnCheckRowDrag for details.

Published property OnClick;

Inherited property - see Delphi help.

Published property OnColumnMoved;

See TKCustomGrid.OnColumnMoved for details.

Published property OnColWidthsChanged;

See TKCustomGrid.OnColWidthsChanged for details.

Published property OnColWidthsChangedEx;

See TKCustomGrid.OnColWidthsChangedEx for details.

Published property OnCompareCellInstances;

See TKCustomGrid.OnCompareCellInstances for details.

Published property OnCompareCells;

See TKCustomGrid.OnCompareCells for details.

Published property OnContextPopup;

Inherited property - see Delphi help.

Published property OnCustomSortCols;

See TKCustomGrid.OnCustomSortCols for details.

Published property OnCustomSortRows;

See TKCustomGrid.OnCustomSortRows for details.

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 OnDrawCell;

See TKCustomGrid.OnDrawCell for details.

Published property OnEditorCreate;

See TKCustomGrid.OnEditorCreate for details.

Published property OnEditorDataFromGrid;

See TKCustomGrid.OnEditorDataFromGrid for details.

Published property OnEditorDataToGrid;

See TKCustomGrid.OnEditorDataToGrid for details.

Published property OnEditorDestroy;

See TKCustomGrid.OnEditorDestroy for details.

Published property OnEditorKeyPreview;

See TKCustomGrid.OnEditorKeyPreview for details.

Published property OnEditorResize;

See TKCustomGrid.OnEditorResize for details.

Published property OnEditorSelect;

See TKCustomGrid.OnEditorSelect for details.

Published property OnEndColDrag;

See TKCustomGrid.OnEndColDrag for details.

Published property OnEndColSizing;

See TKCustomGrid.OnEndColSizing for details.

Published property OnEndDock;

Inherited property - see Delphi help.

Published property OnEndDrag;

Inherited property - see Delphi help.

Published property OnEndRowDrag;

See TKCustomGrid.OnEndRowDrag for details.

Published property OnEndRowSizing;

See TKCustomGrid.OnEndRowSizing for details.

Published property OnEnter;

Inherited property - see Delphi help.

Published property OnExchangeCols;

See TKCustomGrid.OnExchangeCols for details.

Published property OnExchangeRows;

See TKCustomGrid.OnExchangeRows for details.

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 OnMeasureCell;

See TKCustomGrid.OnMeasureCell for details.

Published property OnMouseCellHint;

See TKCustomGrid.OnMouseCellHint for details.

Published property OnMouseClickCell;

See TKCustomGrid.OnMouseClickCell for details.

Published property OnMouseDblClickCell;

See TKCustomGrid.OnMouseDblClickCell for details.

Published property OnMouseDown;

Inherited property - see Delphi help.

Published property OnMouseEnterCell;

See TKCustomGrid.OnMouseEnterCell for details.

Published property OnMouseLeaveCell;

See TKCustomGrid.OnMouseLeaveCell for details.

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;

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

Published property OnPrintPaint;

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

Published property OnResize;

Inherited property - see Delphi help.

Published property OnRowHeightsChanged;

See TKCustomGrid.OnRowHeightsChanged for details.

Published property OnRowHeightsChangedEx;

See TKCustomGrid.OnRowHeightsChangedEx for details.

Published property OnRowMoved;

See TKCustomGrid.OnRowMoved for details.

Published property OnSelectCell;

See TKCustomGrid.OnSelectCell for details.

Published property OnSelectionExpand;

See TKCustomGrid.OnSelectionExpand for details.

Published property OnSizeChanged;

See TKCustomGrid.OnSizeChanged for details.

Published property OnStartDock;

Inherited property - see Delphi help.

Published property OnStartDrag;

Inherited property - see Delphi help.

Published property OnTopLeftChanged;

See TKCustomGrid.OnTopLeftChanged for details.

Published property OnUnDock;

Inherited property - see Delphi help.

Published property Options;

See TKCustomGrid.Options for details.

Published property OptionsEx;

See TKCustomGrid.OptionsEx for details.

Published property ParentColor;

Inherited property - see Delphi help.

Published property ParentFont;

Inherited property - see Delphi help.

Published property ParentShowHint;

Inherited property - see Delphi help.

Published property PopupMenu;

Inherited property - see Delphi help.

Published property RangeSelectStyle;

See TKCustomGrid.RangeSelectStyle for details.

Published property RowCount;

See TKCustomGrid.RowCount for details.

Published property ScrollBars;

See TKCustomGrid.ScrollBars for details.

Published property ScrollModeHorz;

See TKCustomGrid.ScrollModeHorz for details.

Published property ScrollModeVert;

See TKCustomGrid.ScrollModeVert for details.

Published property ScrollSpeed;

See TKCustomGrid.ScrollSpeed for details.

Published property ShowHint;

Inherited property - see Delphi help.

Published property SizingStyle;

See TKCustomGrid.SizingStyle for details.

Published property SortStyle;

See TKCustomGrid.SortStyle for details.

Published property TabOrder;

Inherited property - see Delphi help.

Published property TabStop;

Inherited property - see Delphi help.

Published property Visible;

Inherited property - see Delphi help.


KControls help: KGrids: Class TKGridAttrTextCell

Class TKGridAttrTextCell

Unit

KGrids

Declaration

type TKGridAttrTextCell = class(TKGridTextCell)

Description

Class for a textual cell with custom appearance

This cell class implements properties and methods needed to display/edit a textual cell with custom appearance.

Hierarchy

TKGridTextCell > TKGridCell

Methods

Overview

Public | constructor Create(AGrid: TKCustomGrid); override;
Public | destructor Destroy; override;
Public | procedure ApplyDrawProperties; override;
Public | procedure Assign(Source: TKGridCell); override;
Protected | procedure BrushChange(Sender: TObject);
Protected | procedure FontChange(Sender: TObject);
Protected | procedure Initialize; override;

Description

Public constructor Create(AGrid: TKCustomGrid); override;

Creates the instance. See Create for details.

Public destructor Destroy; override;

Destroys the instance. See TObject.Destroy in Delphi help.

Public procedure ApplyDrawProperties; override;

Applies TKGridAttrTextCell properties to the cell painter.

Public procedure Assign(Source: TKGridCell); override;

Copies shareable properties of another instance that inherits from TKGridCell into this TKGridAttrTextCell instance.

Protected procedure BrushChange(Sender: TObject);

Called from FBrush.OnChange. Sets BrushChanged to True.

Protected procedure FontChange(Sender: TObject);

Called from FFont.OnChange. Sets FontChanged to True.

Protected procedure Initialize; override;

Initializes the cell data.

Properties

Overview

Public | property Attributes: TKTextAttributes;
Public | property BackColor: TColor;
Public | property Brush: TBrush;
Public | property BrushChanged: Boolean;
Public | property Font: TFont;
Public | property FontChanged: Boolean;
Public | property HAlign: TKHAlign;
Public | property HPadding: Integer;
Public | property VAlign: TKVAlign;
Public | property VPadding: Integer;

Description

Public property Attributes: TKTextAttributes;

Shareable property. These are the text attributes to render the text.

Public property BackColor: TColor;

Shareable property. This is the color used to fill the gaps between a non solid Brush.

Public property Brush: TBrush;

Shareable property. This is the brush that will be used to fill the cell background.

Public property BrushChanged: Boolean;

Non-shareable property. Returns True if Brush.OnChange occured.

Public property Font: TFont;

Shareable property. This is the font that will be used to render the text.

Public property FontChanged: Boolean;

Non-shareable property. Returns True if Font.OnChange occured.

Public property HAlign: TKHAlign;

Shareable property. This is the horizontal alignment that will be used to place the text within the cell rectangle.

Public property HPadding: Integer;

Shareable property. This is the horizontal padding of the text from the cell rectangle.

Public property VAlign: TKVAlign;

Shareable property. This is the vertical alignment that will be used to place the text within the cell rectangle.

Public property VPadding: Integer;

Shareable property. This is the vertical padding of the text from the cell rectangle.


KControls help: KGrids: Class TKGridAxisItem

Class TKGridAxisItem

Unit

KGrids

Declaration

type TKGridAxisItem = class(TObject)

Description

Base class to store column or row properties

This is the base class for storing column or row properties. It implements properties and methods that are common for columns and rows.

Fields

 | Name | Description
Protected | FBackExtent |

Methods

Overview

Public | constructor Create(AGrid: TKCustomGrid); virtual;
Public | procedure Assign(Source: TStrings); overload; virtual; abstract;
Public | procedure Assign(Source: TKGridAxisItem); overload; virtual;
Protected | procedure BeginDrag(var Origin: Integer; const MousePt: TPoint; var CanBeginDrag: Boolean); virtual;
Protected | procedure CheckDrag(Origin: Integer; var Destination: Integer; const MousePt: TPoint; var CanDrop: Boolean); virtual;
Public | procedure Clear; virtual; abstract;
Protected | procedure EndDrag(Origin, Destination: Integer; const MousePt: TPoint; var CanEndDrag: Boolean); virtual;
Public | function Equals(Item: TKGridAxisItem): Boolean; virtual;
Protected | function GetObjects(Index: Integer): TObject; virtual; abstract;
Protected | function GetStrings(Index: Integer): WideString; virtual; abstract;
Protected | function GetVisible: Boolean; virtual;
Protected | procedure SetExtent(const Value: Integer); virtual; abstract;
Protected | procedure SetObjects(Index: Integer; const Value: TObject); virtual; abstract;
Protected | procedure SetSortArrowIndex(Value: Integer); virtual; abstract;
Protected | procedure SetSortMode(const Value: TKGridSortMode); virtual; abstract;
Protected | procedure SetStrings(Index: Integer; const Value: WideString); virtual; abstract;
Protected | procedure SetVisible(Value: Boolean); virtual; abstract;

Description

Public constructor Create(AGrid: TKCustomGrid); virtual;

Creates the instance. Do not create custom instances. All necessary TKGridAxisItem instances are created automatically by TKCustomGrid.

Public procedure Assign(Source: TStrings); overload; virtual; abstract;

Makes it possible to assign a list of strings contained in TStrings to the grid. This method is provided to retain compatibility with TStringGrid. It behaves exactly the same way as the corresponding method in TStringGrid. Without implementation.

Public procedure Assign(Source: TKGridAxisItem); overload; virtual;

Copies shareable properties of another TKGridAxisItem instances into this TKGridAxisItem instance.

Protected procedure BeginDrag(var Origin: Integer; const MousePt: TPoint; var CanBeginDrag: Boolean); virtual;

Cell class aware version of OnBeginColDrag or OnBeginRowDrag events. See the TKGridBeginDragEvent type for parameter interpretation.

Protected procedure CheckDrag(Origin: Integer; var Destination: Integer; const MousePt: TPoint; var CanDrop: Boolean); virtual;

Cell class aware version of OnCheckColDrag or OnCheckRowDrag events. See the TKGridCheckDragEvent type for parameter interpretation.

Public procedure Clear; virtual; abstract;

Abstract prototype. Sets text of all cells corresponding to this column or row to empty string.

Protected procedure EndDrag(Origin, Destination: Integer; const MousePt: TPoint; var CanEndDrag: Boolean); virtual;

Cell class aware version of OnEndColDrag or OnEndRowDrag events. See the TKGridEndDragEvent type for parameter interpretation.

Public function Equals(Item: TKGridAxisItem): Boolean; virtual;

Returns True if shareable properties of this TKGridAxisItem instance have the same value as those in Item.

Protected function GetObjects(Index: Integer): TObject; virtual; abstract;

Read method for the Objects property. Without implementation.

Protected function GetStrings(Index: Integer): WideString; virtual; abstract;

Read method for the Strings property. Without implementation.

Protected function GetVisible: Boolean; virtual;

Read method for the Visible property. Without implementation.

Protected procedure SetExtent(const Value: Integer); virtual; abstract;

Write method for the Extent property. Without implementation.

Protected procedure SetObjects(Index: Integer; const Value: TObject); virtual; abstract;

Write method for the Objects property. Without implementation.

Protected procedure SetSortArrowIndex(Value: Integer); virtual; abstract;

Write method for the SortArrowIndex property. Without implementation.

Protected procedure SetSortMode(const Value: TKGridSortMode); virtual; abstract;

Write method for the SortMode property. Without implementation.

Protected procedure SetStrings(Index: Integer; const Value: WideString); virtual; abstract;

Write method for the Strings property. Without implementation.

Protected procedure SetVisible(Value: Boolean); virtual; abstract;

Write method for the Visible property. Without implementation.

Properties

Overview

Public | property CanResize: Boolean;
Public | property Extent: Integer;
Public | property Grid: TKCustomgrid;
Public | property InitialPos: Integer;
Public | property MaxExtent: Integer;
Public | property MinExtent: Integer;
Public | property Objects[Index: Integer]: TObject;
Public | property SortArrowIndex: Integer;
Public | property SortMode: TKGridSortMode;
Public | property Strings[Index: Integer]: WideString;
Public | property Tag: TObject;
Public | property Visible: Boolean;

Description

Public property CanResize: Boolean;

Shareable property. Determines if this column or row can be resized. This property virtually covers the OnBeginColSizing or OnBeginRowSizing events.

Public property Extent: Integer;

Shareable property. Determines the column width or row height. Do not write this property unless you write a TKCustomGrid descendant.

Public property Grid: TKCustomgrid;

Pointer to the grid. You will probably need it when implementing application specific behavior.

Public property InitialPos: Integer;

Non-shareable property. Determines the initial column or row position just after it was inserted into the grid. Do not write this property unless you write a TKCustomGrid descendant.

Public property MaxExtent: Integer;

Specifies the maximum extent of this column or row. Set zero to disable check. Does not work (cannot work) in goAlignLast... mode.

Public property MinExtent: Integer;

Specifies the minimum extent of this column or row. Set zero to disable check. This setting overrides the MinColWidth or MinRowHeight setting.

Public property Objects[Index: Integer]: TObject;

Provides access to the object cell instances corresponding to the column or row referred by this TKGridAxisItem instance. Provided to retain compatibility with TStringGrid.

Public property SortArrowIndex: Integer;

Specifies the index of the fixed column or row where the sorting can be initiated/changed by mouse click and where the sorting arrow will be displayed. This applies only for multiline column or row headers, i.e. if there are two or more fixed columns or rows defined.

Public property SortMode: TKGridSortMode;

Makes it possible to sort column or row referred by this TKGridAxisItem instance.

Public property Strings[Index: Integer]: WideString;

Provides access to the obj cell instances corresponding to the column or row referred by this TKGridAxisItem instance.

Public property Tag: TObject;

Provides access to custom object for Row

Public property Visible: Boolean;

Shareable property. Determines if the column or row is visible.


KControls help: KGrids: Class TKGridCell

Class TKGridCell

Unit

KGrids

Declaration

type TKGridCell = class(TObject)

Description

Base class to store cell properties

This class implements properties and methods common to all cell classes.

Methods

Overview

Public | constructor Create(AGrid: TKCustomGrid); virtual;
Protected | procedure AfterUpdate; virtual;
Public | procedure ApplyDrawProperties; virtual;
Public | procedure Assign(Source: TKGridCell); virtual;
Protected | procedure BeforeUpdate; virtual;
Public | procedure Clear;
Protected | procedure DrawCell(ACol, ARow: Integer; const ARect: TRect; State: TKGridDrawState); virtual;
Protected | procedure EditorCreate(ACol, ARow: Integer; var AEditor: TWinControl); virtual;
Protected | procedure EditorDataFromGrid(AEditor: TWinControl; ACol, ARow: Integer; var AssignText: Boolean); virtual;
Protected | procedure EditorDataToGrid(AEditor: TWinControl; ACol, ARow: Integer; var AssignText: Boolean); virtual;
Protected | procedure EditorDestroy(var AEditor: TWinControl; ACol, ARow: Integer); virtual;
Protected | procedure EditorKeyPreview(AEditor: TWinControl; ACol, ARow: Integer; var Key: Word; Shift: TShiftState; var IsGridKey: Boolean); virtual;
Protected | procedure EditorResize(AEditor: TWinControl; ACol, ARow: Integer; var ARect: TRect); virtual;
Protected | procedure EditorSelect(AEditor: TWinControl; ACol, ARow: Integer; SelectAll, CaretToLeft, SelectedByMouse: Boolean); virtual;
Protected | function FindCell(out ACol, ARow: Integer): Boolean; virtual;
Protected | procedure Initialize; virtual;
Protected | procedure MeasureCell(ACol, ARow: Integer; const ARect: TRect; State: TKGridDrawState; Priority: TKGridMeasureCellPriority; var Extent: TPoint); virtual;
Protected | procedure SelectCell(ACol, ARow: Integer; var ACanSelect: Boolean); virtual;
Protected | procedure SelectionExpand(ACol, ARow: Integer; var ACanExpand: Boolean); virtual;

Description

Public constructor Create(AGrid: TKCustomGrid); virtual;

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

Protected procedure AfterUpdate; virtual;

Called after specific property has been updated. Default behavioor: Searches the cell in the parent grid and invalidates the cell. You can override this method to extend behavior.

Public procedure ApplyDrawProperties; virtual;

Applies TKGridCell properties to the cell painter. The TKGridCell's implementation does nothing.

Public procedure Assign(Source: TKGridCell); virtual;

Copies the properties of another TKGridCell instances into this TKGridCell instance.

Protected procedure BeforeUpdate; virtual;

Called before specific property is to be updated.

Public procedure Clear;

Clears the cell data.

Protected procedure DrawCell(ACol, ARow: Integer; const ARect: TRect; State: TKGridDrawState); virtual;

Cell class aware version of OnDrawCell. Fills ARect with predefined Brush.

Protected procedure EditorCreate(ACol, ARow: Integer; var AEditor: TWinControl); virtual;

Cell class aware version of OnEditorCreate. The TKGridCell's implementation calls DefaultEditorCreate.

Protected procedure EditorDataFromGrid(AEditor: TWinControl; ACol, ARow: Integer; var AssignText: Boolean); virtual;

Cell class aware version of OnEditorDataFromGrid. The TKGridCell's implementation calls DefaultEditorDataFromGrid.

Protected procedure EditorDataToGrid(AEditor: TWinControl; ACol, ARow: Integer; var AssignText: Boolean); virtual;

Cell class aware version of OnEditorDataToGrid. The TKGridCell's implementation calls DefaultEditorDataToGrid.

Protected procedure EditorDestroy(var AEditor: TWinControl; ACol, ARow: Integer); virtual;

Cell class aware version of OnEditorDestroy. The TKGridCell's implementation calls DefaultEditorDestroy.

Protected procedure EditorKeyPreview(AEditor: TWinControl; ACol, ARow: Integer; var Key: Word; Shift: TShiftState; var IsGridKey: Boolean); virtual;

Cell class aware version of OnEditorKeyPreview. The TKGridCell's implementation calls DefaultEditorKeyPreview.

Protected procedure EditorResize(AEditor: TWinControl; ACol, ARow: Integer; var ARect: TRect); virtual;

Cell class aware version of OnEditorResize. The TKGridCell's implementation calls DefaultEditorResize.

Protected procedure EditorSelect(AEditor: TWinControl; ACol, ARow: Integer; SelectAll, CaretToLeft, SelectedByMouse: Boolean); virtual;

Cell class aware version of OnEditorSelect. The TKGridCell's implementation calls DefaultEditorSelect.

Protected function FindCell(out ACol, ARow: Integer): Boolean; virtual;

Searches the cell in the parent grid.

Protected procedure Initialize; virtual;

Initializes the cell data.

Protected procedure MeasureCell(ACol, ARow: Integer; const ARect: TRect; State: TKGridDrawState; Priority: TKGridMeasureCellPriority; var Extent: TPoint); virtual;

Cell class aware version of OnMeasureCell.

Protected procedure SelectCell(ACol, ARow: Integer; var ACanSelect: Boolean); virtual;

Cell class aware version of OnSelectCell. The TKGridCell's implementation does nothing.

Protected procedure SelectionExpand(ACol, ARow: Integer; var ACanExpand: Boolean); virtual;

Cell class aware version of OnSelectionExpand. The TKGridCell's implementation does nothing.

Properties

Overview

Public | property ColSpan: Integer;
Public | property Grid: TKCustomgrid;
Public | property RowSpan: Integer;
Public | property Span: TKGridCellSpan;

Description

Public property ColSpan: Integer;

Specifies the number of columns the cell should be spanned to.

Public property Grid: TKCustomgrid;

Pointer to the grid. You will probably need it when implementing application specific behavior.

Public property RowSpan: Integer;

Specifies the number of rows the cell should be spanned to.

Public property Span: TKGridCellSpan;

Specifies both cell span parameters.


KControls help: KGrids: Class TKGridCellPainter

Class TKGridCellPainter

Unit

KGrids

Declaration

type TKGridCellPainter = class(TObject)

Description

Wrapper for a versatile and easily extensible cell painting engine

Properties and methods of this class provide standard cell painting. To adapt cell painting, you can use combinations of elementary painting methods in the OnDrawCell event handler or override and adapt some high level methods of TKGridCellPainter.

Fields

 | Name | Description
Protected | FPrinting | Returns True if the grid is being printed out.

Methods

Overview

Public | constructor Create(AGrid: TKCustomGrid);
Public | destructor Destroy; override;
Public | function BeginClip: Boolean; virtual;
Protected | procedure BeginDraw; virtual;
Public | function CellCheckBoxRect(var BaseRect: TRect; out Bounds, Interior: TRect; StretchMode: TKStretchMode): Boolean;
Public | function CellGraphicRect(var BaseRect: TRect; out Bounds, Interior: TRect; StretchMode: TKStretchMode): Boolean;
Public | function CellSortArrowRect(var BaseRect: TRect; out Bounds, Interior: TRect): Boolean;
Public | function CellTextExtent(const BaseRect: TRect; out Extent: TPoint): Boolean;
Public | function CellTextRect(var BaseRect: TRect; out Bounds, Interior: TRect): Boolean;
Public | procedure DefaultAttributes; virtual;
Public | procedure DefaultDraw; virtual;
Public | function DefaultEdges: Cardinal; virtual;
Public | function DefaultMeasure(Priority: TKGridMeasureCellPriority): TPoint; virtual;
Public | procedure DrawButtonFrame(const ARect: TRect); virtual;
Public | procedure DrawCellButton(Bounds: TRect);
Public | procedure DrawCellCheckBox(const Bounds, Interior: TRect);
Public | procedure DrawCellCommon; virtual;
Public | procedure DrawCellFocus(const ARect: TRect; SkipTest: Boolean = False); virtual;
Public | procedure DrawCellGraphic(const Bounds, Interior: TRect);
Public | procedure DrawCellSortArrow(const Bounds, Interior: TRect);
Public | procedure DrawCellText(var ARect: TRect); virtual;
Public | procedure DrawCheckBoxFrame(const ARect: TRect); virtual;
Public | procedure DrawEmptyCell; virtual;
Public | procedure DrawFixedCell; virtual;
Public | procedure DrawFixedCellBackground(const ARect: TRect); virtual;
Public | procedure DrawFixedCellNonThemedBackground(const ARect: TRect); virtual;
Public | procedure DrawHeaderCell; virtual;
Public | procedure DrawHeaderCellBackground(const ARect: TRect);
Public | procedure DrawNormalCellBackground(const ARect: TRect); virtual;
Public | procedure DrawSelectableCell; virtual;
Public | procedure DrawSelectedCellBackground(const ARect: TRect; RClip: PRect = nil); virtual;
Public | procedure DrawThemedFixedCell; virtual;
Public | procedure DrawThemedHeaderCell; virtual;
Public | procedure EndClip; virtual;
Protected | procedure EndDraw; virtual;
Protected | function GetSortArrowWidth: Integer; virtual;
Protected | procedure Initialize; virtual;

Description

Public constructor Create(AGrid: TKCustomGrid);

Creates the instance. Do not create custom instances. All necessary TKGridCellPainter instances are created automatically by TKCustomGrid.

Public destructor Destroy; override;

Destroys the instance. See TObject.Destroy in Delphi help.

Public function BeginClip: Boolean; virtual;

Forces the drawing output to be clipped within CellRect. This behavior must be cancelled by EndClip when no longer needed. You don't need to call BeginClip if the Options property already contains goClippedCells.

Protected procedure BeginDraw; virtual;

High level method. Provides default behavior needed to initialize painting of a cell. It is called automatically in PaintCell.

Public function CellCheckBoxRect(var BaseRect: TRect; out Bounds, Interior: TRect; StretchMode: TKStretchMode): Boolean;

Calculates the checkbox position within BaseRect, if any. The position is stored in Bounds (checkbox with padding) and Interior (checkbox without padding). Bounds are excluded from BaseRect.

Public function CellGraphicRect(var BaseRect: TRect; out Bounds, Interior: TRect; StretchMode: TKStretchMode): Boolean;

Calculates the graphic position within BaseRect, if any. The position is stored in Bounds (graphic with padding) and Interior (graphic without padding). Bounds are excluded from BaseRect.

Public function CellSortArrowRect(var BaseRect: TRect; out Bounds, Interior: TRect): Boolean;

Calculates the sorting arrow position within BaseRect, if any. The position is stored in Bounds (sorting arrow with padding) and Interior (sorting arrow without padding). Bounds are excluded from BaseRect.

Public function CellTextExtent(const BaseRect: TRect; out Extent: TPoint): Boolean;

Calculates the cell text horizontal and vertical extent, if any.

Public function CellTextRect(var BaseRect: TRect; out Bounds, Interior: TRect): Boolean;

Calculates the text position within BaseRect, if any. The position is stored in Bounds (text with padding) and Interior (text without padding). Bounds are excluded from BaseRect.

Public procedure DefaultAttributes; virtual;

Low level method. Prepares default painting attributes. Under current implementation, DefaultAttributes applies default colors to the Canvas's Brush and Font properties.

Public procedure DefaultDraw; virtual;

Highest level method. Provides default painting of any cell. You should call DefaultDraw when implementing the OnDrawCell event handler unless any specific cell painting is required. This method supersedes the obsolete DefaultDrawCell function.

Public function DefaultEdges: Cardinal; virtual;

Returns the combination of edge masks (BF_...) to paint a fixed cell correctly in old TCustomGrid style or if no OS themes are available.

Public function DefaultMeasure(Priority: TKGridMeasureCellPriority): TPoint; virtual;

Highest level method. Provides default cell extent calculation.

Public procedure DrawButtonFrame(const ARect: TRect); virtual;

Low level method. Paints a button frame.

Public procedure DrawCellButton(Bounds: TRect);

Low level method. Paints button frame.

Public procedure DrawCellCheckBox(const Bounds, Interior: TRect);

Low level method. Paints checkbox frame.

Public procedure DrawCellCommon; virtual;

Low level method. Paints common parts of a themed and non-themed cell.

Public procedure DrawCellFocus(const ARect: TRect; SkipTest: Boolean = False); virtual;

Low level method. Paints a standard focus rectangle around the focused cell.

Public procedure DrawCellGraphic(const Bounds, Interior: TRect);

Low level method. Paints the graphic (if any) within the rectangle specified by Interior. Fills the rectangle specified by Bounds with current brush.

Public procedure DrawCellSortArrow(const Bounds, Interior: TRect);

Low level method. Paints the sort arrow within the rectangle specified by Interior. Fills the rectangle specified by Bounds with current brush.

Public procedure DrawCellText(var ARect: TRect); virtual;

Low level method. Paints cell text.

Public procedure DrawCheckBoxFrame(const ARect: TRect); virtual;

Low level method. Paints a check box frame.

Public procedure DrawEmptyCell; virtual;

High level method. Paints an empty cell, i.e. only fills the cell background.

Public procedure DrawFixedCell; virtual;

High level method. Paints a non themed fixed cell.

Public procedure DrawFixedCellBackground(const ARect: TRect); virtual;

Low level method. Paints fixed cell background.

Public procedure DrawFixedCellNonThemedBackground(const ARect: TRect); virtual;

Low level method. Paints non-themed fixed cell background.

Public procedure DrawHeaderCell; virtual;

High level method. Paints a fixed cell in Windows Header style.

Public procedure DrawHeaderCellBackground(const ARect: TRect);

Low level method. Paints header background.

Public procedure DrawNormalCellBackground(const ARect: TRect); virtual;

Low level method. Paints selection background frame.

Public procedure DrawSelectableCell; virtual;

High level method. Paints a selectable cell.

Public procedure DrawSelectedCellBackground(const ARect: TRect; RClip: PRect = nil); virtual;

Low level method. Paints selection background frame.

Public procedure DrawThemedFixedCell; virtual;

High level method. Paints a themed fixed cell.

Public procedure DrawThemedHeaderCell; virtual;

High level method. Paints a themed fixed cell in Windows Header style.

Public procedure EndClip; virtual;

Restores normal drawing output after previous BeginClip call.

Protected procedure EndDraw; virtual;

High level method. Provides default behavior needed to finalize painting of a cell. It is called automatically in PaintCell.

Protected function GetSortArrowWidth: Integer; virtual;

Read method for the SortArrowWidth property.

Protected procedure Initialize; virtual;

Initializes all canvas independent attributes to default values. Called from DefaultAttributes just before cell painting.

Properties

Overview

Public | property Attributes: TKTextAttributes;
Public | property BackColor: TColor;
Public | property BlockRect: TRect;
Public | property Button: Boolean;
Public | property ButtonChecked: Boolean;
Public | property Canvas: TCanvas;
Public | property CellPos: TPoint;
Public | property CellRect: TRect;
Public | property CheckBox: Boolean;
Public | property CheckBoxChecked: Boolean;
Public | property CheckBoxHAlign: TKHAlign;
Public | property CheckBoxHPadding: Integer;
Public | property CheckboxState: TCheckBoxState;
Public | property CheckBoxVAlign: TKVAlign;
Public | property CheckBoxVPadding: Integer;
Public | property Col: Integer;
Public | property Graphic: TGraphic;
Public | property GraphicDrawText: Boolean;
Public | property GraphicHAlign: TKHAlign;
Public | property GraphicHPadding: Integer;
Public | property GraphicStretchMode: TKStretchMode;
Public | property GraphicVAlign: TKVAlign;
Public | property GraphicVPadding: Integer;
Public | property Grid: TKCustomGrid;
Public | property HAlign: TKHAlign;
Public | property HotFrameOnly: Boolean;
Public | property HPadding: Integer;
Public | property Printing: Boolean;
Public | property Row: Integer;
Public | property SortArrowHAlign: TKHAlign;
Public | property SortArrowHPadding: Integer;
Public | property SortArrowWidth: Integer;
Public | property State: TKGridDrawState;
Public | property Text: WideString;
Public | property VAlign: TKVAlign;
Public | property VPadding: Integer;

Description

Public property Attributes: TKTextAttributes;

Specifies the text attributes used to render the cell text.

Public property BackColor: TColor;

Specifies the color used to fill the gaps if the Brush referred by Canvas is not solid brush.

Public property BlockRect: TRect;

Specifies the bounding rectangle of block of cells. This value can be given either in TKCustomGrid's client coordinates or, in goDoubleBufferedCells mode, relative to CellPos.

Public property Button: Boolean;

Determines if a standard button frame should be painted for a selectable cell. To paint a button frame, you need to implement the OnDrawCell event handler, set Button to True and call DefaultDraw, which ensures correct painting of a button frame.

Public property ButtonChecked: Boolean;

Specifies if the button frame should be painted in pressed or released (normal) state. This property has no effect unless Button is True.

Public property Canvas: TCanvas;

Identifies the Canvas where the cell will be painted to. The value of this property is either equal to TKCustomGrid.Canvas or, in goDoubleBufferedCells mode, equal to a memory device context whose dimensions correspond to the size of the cell. When implementing the OnDrawCell event handler, you can paint to TKCustomGrid.Canvas as usual in TStringGrid. However, if you wish to use goDoubleBufferedCells, you must paint to TKGridCellPainter.Canvas.

Public property CellPos: TPoint;

Specifies the left and top position/origin of the cell in TKCustomGrid's client coordinates.

Public property CellRect: TRect;

Specifies the bounding rectangle of the cell. This value can be given either in TKCustomGrid's client coordinates or, in goDoubleBufferedCells mode, relative to CellPos.

Public property CheckBox: Boolean;

Determines if a standard check box frame should be painted for a selectable cell. To paint a check box frame, you need to implement the OnDrawCell event handler, set CheckBox to True and call DefaultDraw, which ensures correct painting of a check box frame.

Public property CheckBoxChecked: Boolean;

Specifies if the check box frame should be painted in checked or unchecked state. This property is for backward compatibility and has no effect unless CheckBox is True. For new designs use the CheckBoxState property.

Public property CheckBoxHAlign: TKHAlign;

Specifies the horizontal padding for the sorting arrow.

Public property CheckBoxHPadding: Integer;

Specifies the horizontal padding for the sorting arrow.

Public property CheckboxState: TCheckBoxState;

Specifies if the check box frame should be painted in checked, grayed or unchecked state. This property has no effect unless CheckBox is True. Added by Karol Schmidt

Public property CheckBoxVAlign: TKVAlign;

Specifies the vertical padding for the sorting arrow.

Public property CheckBoxVPadding: Integer;

Specifies the vertical padding for the sorting arrow.

Public property Col: Integer;

Specifies the column index of the cell.

Public property Graphic: TGraphic;

Specifies the image that should be drawn in the cell.

Public property GraphicDrawText: Boolean;

Specifies if the text should appear next to the image.

Public property GraphicHAlign: TKHAlign;

Specifies the horizontal alignment for the image.

Public property GraphicHPadding: Integer;

Specifies the horizontal padding for the image.

Public property GraphicStretchMode: TKStretchMode;

Specifies if the the image should be stretched within the cell (aspect ratio is preserved).

Public property GraphicVAlign: TKVAlign;

Specifies the vertical alignment for the image.

Public property GraphicVPadding: Integer;

Specifies the vertical padding for the image.

Public property Grid: TKCustomGrid;

Specifies the calling grid.

Public property HAlign: TKHAlign;

This is the default horizontal alignment that will be used to place the text within the cell rectangle.

Public property HotFrameOnly: Boolean;

When true, a check box frame etc. is only painted "hot" when mouse cursor is over that frame. When false, it is painted "hot" when mouse cursor is over entire cell.

Public property HPadding: Integer;

This is the default horizontal padding for the text.

Public property Printing: Boolean;

Returns True if the grid is being printed out. Needed e.g. for font height adjstment while printing.

Public property Row: Integer;

Specifies the row index of the cell.

Public property SortArrowHAlign: TKHAlign;

Specifies the horizontal padding for the check box.

Public property SortArrowHPadding: Integer;

Specifies the horizontal padding for the sorting arrow.

Public property SortArrowWidth: Integer;

Returns the width of the sorting arrow glyph. This value can be either zero if no sorting arrow should be drawn for the cell (most cases), or a width of the glyph for column/row sorting.

Public property State: TKGridDrawState;

Specifies the draw state of the cell.

Public property Text: WideString;

Specifies the text that appears in the cell.

Public property VAlign: TKVAlign;

This is the default vertical alignment that will be used to place the text within the cell rectangle.

Public property VPadding: Integer;

This is the default vertical padding for the text.


KControls help: KGrids: Class TKGridCol

Class TKGridCol

Unit

KGrids

Declaration

type TKGridCol = class(TKGridAxisItem)

Description

Class to store column properties

This class implements properties and methods specific to columns.

Hierarchy

TKGridAxisItem

Methods

Overview

Public | constructor Create(AGrid: TKCustomGrid); override;
Public | procedure Assign(Source: TKGridAxisItem); override;
Public | procedure Assign(Source: TStrings); override;
Public | procedure Clear; override;
Public | function Equals(Item: TKGridAxisItem): Boolean; override;
Protected | function GetObjects(Index: Integer): TObject; override;
Protected | function GetStrings(Index: Integer): WideString; override;
Protected | procedure SetExtent(const Value: Integer); override;
Protected | procedure SetObjects(Index: Integer; const Value: TObject); override;
Protected | procedure SetSortArrowIndex(Value: Integer); override;
Protected | procedure SetSortMode(const Value: TKGridSortMode); override;
Protected | procedure SetStrings(Index: Integer; const Value: WideString); override;
Protected | procedure SetVisible(Value: Boolean); override;

Description

Public constructor Create(AGrid: TKCustomGrid); override;

Creates the instance. Do not create custom instances. All necessary TKGridCol instances are created automatically by TKCustomGrid.

Public procedure Assign(Source: TKGridAxisItem); override;

Copies the properties of another TKGridAxisItem instances into this TKGridCol instance.

Public procedure Assign(Source: TStrings); override;

Makes it possible to assign a list of strings contained in TStrings to the grid. It behaves exactly the same way as the corresponding method in TStringGrid. Implementation for columns, i.e. the strings contained in Source are copied to the text cells corresponding to the column referred by this TKGridCol instance.

Public procedure Clear; override;

Sets text of all cells corresponding to this column to empty string.

Public function Equals(Item: TKGridAxisItem): Boolean; override;

Returns True if shareable properties of this TKGridAxisItem instance have the same value as those in Item.

Protected function GetObjects(Index: Integer): TObject; override;

Read method for the Objects property. Implementation for columns.

Protected function GetStrings(Index: Integer): WideString; override;

Read method for the Strings property. Implementation for columns.

Protected procedure SetExtent(const Value: Integer); override;

Write method for the Extent property. Implementation for columns.

Protected procedure SetObjects(Index: Integer; const Value: TObject); override;

Write method for the Objects property. Implementation for columns.

Protected procedure SetSortArrowIndex(Value: Integer); override;

Write method for the SortArrowIndex property. Implementation for columns.

Protected procedure SetSortMode(const Value: TKGridSortMode); override;

Write method for the SortMode property. Implementation for columns.

Protected procedure SetStrings(Index: Integer; const Value: WideString); override;

Write method for the Strings property. Implementation for columns.

Protected procedure SetVisible(Value: Boolean); override;

Write method for the Visible property. Implementation for columns.

Properties

Overview

Public | property CellHint: Boolean;
Public | property TabStop: Boolean;

Description

Public property CellHint: Boolean;

Shareable property. Determines if cell hint is enabled for this column.

Public property TabStop: Boolean;

Shareable property. Determines if pressing the TAB or Shift+TAB key can move the input focus at a cell that belongs to this column. This property has effect only if goTabs is present under Options.


KControls help: KGrids: Class TKGridColors

Class TKGridColors

Unit

KGrids

Declaration

type TKGridColors = class(TPersistent)

Description

Container for all colors used by TKCustomGrid 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 | FBrightColors |
Protected | FColors |

Methods

Overview

Public | constructor Create(AGrid: TKCustomGrid);
Public | procedure Assign(Source: TPersistent); override;
Public | procedure BrightRangeBkGnds;
Public | procedure ClearBrightColors;
Protected | procedure Initialize; virtual;
Protected | function InternalGetColor(Index: TKGridColorIndex): TColor; virtual;
Protected | procedure InternalSetColor(Index: TKGridColorIndex; Value: TColor); virtual;

Description

Public constructor Create(AGrid: TKCustomGrid);

Creates the instance. You can create a custom instance and pass it e.g. to a Colors property. The AGrid 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 TKGridColors instance.

Public procedure BrightRangeBkGnds;

Ensures cell range background colors will be brightened if specified by BrightRangeBkGnd.

Public procedure ClearBrightColors;

Clears cached brighter colors.

Protected procedure Initialize; virtual;

Initializes the color array.

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

Returns the specific color according to ColorScheme.

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

Replaces the specific color.

Properties

Overview

Published | property BrightRangeBkGnd: Boolean;
Published | property CellBkGnd: TColor;
Published | property CellLines: TColor;
Published | property CellText: TColor;
Public | property Color[Index: TKGridColorIndex]: TColor;
Public | property Colors: TKColorArray;
Public | property ColorScheme: TKGridColorScheme;
Published | property DragSuggestionBkGnd: TColor;
Published | property DragSuggestionLine: TColor;
Published | property FixedCellBkGnd: TColor;
Published | property FixedCellIndication: TColor;
Published | property FixedCellLines: TColor;
Published | property FixedCellText: TColor;
Published | property FixedThemedCellHighlight: TColor;
Published | property FixedThemedCellLines: TColor;
Published | property FixedThemedCellShadow: TColor;
Published | property FocusedCellBkGnd: TColor;
Published | property FocusedCellText: TColor;
Published | property FocusedRangeBkGnd: TColor;
Published | property FocusedRangeText: TColor;
Published | property SelectedCellBkGnd: TColor;
Published | property SelectedCellText: TColor;
Published | property SelectedFixedCellBkGnd: TColor;
Published | property SelectedRangeBkGnd: TColor;
Published | property SelectedRangeText: TColor;

Description

Published property BrightRangeBkGnd: Boolean;

Specifies if cell range colors should be brightened from focused cell colors.

Published property CellBkGnd: TColor;

Background color for non-fixed cells.

Published property CellLines: TColor;

Color for lines around non-fixed cells.

Published property CellText: TColor;

Text color for non-fixed cells.

Public property Color[Index: TKGridColorIndex]: TColor;

Returns always normal color - regardless of the ColorScheme setting.

Public property Colors: TKColorArray;

Returns array of normal colors.

Public property ColorScheme: TKGridColorScheme;

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

Published property DragSuggestionBkGnd: TColor;

Background color for drag suggestion stroke.

Published property DragSuggestionLine: TColor;

Line color for drag suggestion stroke.

Published property FixedCellBkGnd: TColor;

Background color for fixed cells.

Published property FixedCellIndication: TColor;

Background color for fixed cells that currently indicate selection.

Published property FixedCellLines: TColor;

Color for lines around fixed cells.

Published property FixedCellText: TColor;

Text color for fixed cells.

Published property FixedThemedCellHighlight: TColor;

Color for 3D highlight effects for fixed cells if goThemedCells is True

Published property FixedThemedCellLines: TColor;

Color for lines around fixed cells if goThemedCells is True

Published property FixedThemedCellShadow: TColor;

Color for 3D shadow effects for fixed cells if goThemedCells is True

Published property FocusedCellBkGnd: TColor;

Background color for focused cell defined by Selection.Cell1.

Published property FocusedCellText: TColor;

Text color for focused cell defined by Selection.Cell1.

Published property FocusedRangeBkGnd: TColor;

Background color for another focused cells within the range or full row selection.

Published property FocusedRangeText: TColor;

Text color for another focused cells within the range or full row selection.

Published property SelectedCellBkGnd: TColor;

Background color for selected cells defined by Selection.Cell1.

Published property SelectedCellText: TColor;

Text color for selected cells defined by Selection.Cell1.

Published property SelectedFixedCellBkGnd: TColor;

Background color for selected cells defined by Selection.Cell1.

Published property SelectedRangeBkGnd: TColor;

Background color for another selected cells within the range or full row selection.

Published property SelectedRangeText: TColor;

Text color for another selected cells within the range or full row selection.


KControls help: KGrids: Class TKGridObjectCell

Class TKGridObjectCell

Unit

KGrids

Declaration

type TKGridObjectCell = class(TKGridObjectCellAncestor)

Description

Class for an object cell

This cell class implements properties and methods needed to store a custom object in a cell. This class is implemented for backward compatibility with TStringGrid. You can implement different cell classes to store any user defined data.

Methods

Overview

Public | constructor Create(AGrid: TKCustomGrid); override;
Public | destructor Destroy; override;
Public | procedure Assign(Source: TKGridCell); override;
Protected | procedure Initialize; override;

Description

Public constructor Create(AGrid: TKCustomGrid); override;

Creates the instance. See Create for details.

Public destructor Destroy; override;

Destroys the instance. See TObject.Destroy in Delphi help.

Public procedure Assign(Source: TKGridCell); override;

Copies shareable properties of another instance that inherits from TKGridCell into this TKGridObjectCell instance.

Protected procedure Initialize; override;

Initializes the cell data.

Properties

Overview

Public property CellObject: TObject;

Description

Public property CellObject: TObject;

Shareable property. This is the object stored within the cell class. A single object instance passed to CellObject cannot be shared among multiple cell class instances. The reason is that TObject instances do not support Assign method, more convenient it would be to store TPersistents.


KControls help: KGrids: Class TKGridRow

Class TKGridRow

Unit

KGrids

Declaration

type TKGridRow = class(TKGridAxisItem)

Description

Class to store row properties

This class implements properties and methods specific to rows.

Hierarchy

TKGridAxisItem

Methods

Overview

Public | constructor Create(AGrid: TKCustomGrid); override;
Public | procedure Assign(Source: TStrings); override;
Public | procedure Clear; override;
Protected | function GetObjects(Index: Integer): TObject; override;
Protected | function GetStrings(Index: Integer): WideString; override;
Protected | procedure SetExtent(const Value: Integer); override;
Protected | procedure SetObjects(Index: Integer; const Value: TObject); override;
Protected | procedure SetSortArrowIndex(Value: Integer); override;
Protected | procedure SetSortMode(const Value: TKGridSortMode); override;
Protected | procedure SetStrings(Index: Integer; const Value: WideString); override;
Protected | procedure SetVisible(Value: Boolean); override;

Description

Public constructor Create(AGrid: TKCustomGrid); override;

Creates the instance. Do not create custom instances. All necessary TKGridRow instances are created automatically by TKCustomGrid.

Public procedure Assign(Source: TStrings); override;

Makes it possible to assign a list of strings contained in TStrings to the grid. It behaves exactly the same way as the corresponding method in TStringGrid. Implementation for rows, i.e. the strings contained in Source are copied to the text cells corresponding to the row referred by this TKGridRow instance.

Public procedure Clear; override;

Sets text of all cells corresponding to this row to empty string.

Protected function GetObjects(Index: Integer): TObject; override;

Read method for the Objects property. Implementation for rows.

Protected function GetStrings(Index: Integer): WideString; override;

Read method for the Strings property. Implementation for rows.

Protected procedure SetExtent(const Value: Integer); override;

Write method for the Extent property. Implementation for rows.

Protected procedure SetObjects(Index: Integer; const Value: TObject); override;

Write method for the Objects property. Implementation for rows.

Protected procedure SetSortArrowIndex(Value: Integer); override;

Write method for the SortArrowIndex property. Implementation for rows.

Protected procedure SetSortMode(const Value: TKGridSortMode); override;

Write method for the SortMode property. Implementation for rows.

Protected procedure SetStrings(Index: Integer; const Value: WideString); override;

Write method for the Strings property. Implementation for rows.

Protected procedure SetVisible(Value: Boolean); override;

Write method for the Visible property. Implementation for rows.


KControls help: KGrids: Class TKGridTextCell

Class TKGridTextCell

Unit

KGrids

Declaration

type TKGridTextCell = class(TKGridCell)

Description

Class for simple textual cell

This cell class implements properties and methods needed to display/edit a cell with simple text.

Hierarchy

TKGridCell

Methods

Overview

Public | constructor Create(AGrid: TKCustomGrid); override;
Public | destructor Destroy; override;
Public | procedure ApplyDrawProperties; override;
Public | procedure Assign(Source: TKGridCell); override;
Protected | procedure AssignText(const Value: WideString); virtual;
Protected | procedure EditorCreate(ACol, ARow: Integer; var AEditor: TWinControl); override;
Protected | procedure Initialize; override;

Description

Public constructor Create(AGrid: TKCustomGrid); override;

Creates the instance. See Create for details.

Public destructor Destroy; override;

Destroys the instance. See TObject.Destroy in Delphi help.

Public procedure ApplyDrawProperties; override;

Applies TKGridTextCell properties to the cell painter.

Public procedure Assign(Source: TKGridCell); override;

Copies shareable properties of another instance that inherits from TKGridCell into this TKGridTextCell instance.

Protected procedure AssignText(const Value: WideString); virtual;

Assigns a new text string into this TKGridTextCell instance. The new string will be assigned by a grow on demand method, i.e. the memory allocated for the string can only grow within each assignment. It continues to grow until the TKGridTextCell instance is destroyed.

Protected procedure EditorCreate(ACol, ARow: Integer; var AEditor: TWinControl); override;

Cell class aware version of OnEditorCreate. Creates a TEdit inplace editor.

Protected procedure Initialize; override;

Initializes the cell data.

Properties

Overview

Public | property Text: WideString;
Public | property TextPtr: PWideChar;

Description

Public property Text: WideString;

Shareable property. This is the editable text that appears in the cell.

Public property TextPtr: PWideChar;

Readonly property. This is the editable text that appears in the cell - published as pointer for fast read operations like sorting.


KControls 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


KControls 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


KControls 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


KControls 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


KControls 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


KControls help: KIcon

Unit KIcon

Description

This unit provides an advanced Windows icon management i.e. replacement for the Graphics.TIcon component

Copyright © 2005 Tomas Krysl (tomkrysl@tkweb.eu)

The purpose of the TKIcon component is to replace and expand the standard TIcon component provided by VCL. The TKIcon component is not based on Windows icon functions, but manages the icon structures by itself.

    Major features are:
  • 32-bit icons/cursors with alpha channel supported
  • correct rendering in all 32-bit Windows platforms
  • optional rendering of all icon/ cursors subimages
  • icons/cursors can be stretched when drawn
  • multiple rendering styles
  • loading from file/stream, HICON, module resources, file associations
  • saving to file/stream
  • icon image manipulation (inserting/deleting/cropping/enlarging)
  • full TPicture integration (only TPicture.Icon can't be used)
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 TIcon |
Class TKIcon |

Functions and Procedures

Overview

function CreateAlphaBitmapFromResIcon(const ResName: string; ResType: PChar): TKAlphaBitmap;
function CreateBitmapFromResIcon(const ResName: string; ResType: PChar = RT_ICON): TBitmap;
function GetModuleIconCount(const ModuleName: string): Integer; overload;
function GetModuleIconCount(Instance: HINST): Integer; overload;
function GetModuleResourceCount(Instance: HINST; ResType: PChar): Integer;
function MakeHandles(hXOR, hAND: HBITMAP): TKIconHandles;
procedure RegisterKIcon;
procedure UnregisterKIcon;

Description

function CreateAlphaBitmapFromResIcon(const ResName: string; ResType: PChar): TKAlphaBitmap;

Creates an alpha bitmap from an icon object stored in application resources.

function CreateBitmapFromResIcon(const ResName: string; ResType: PChar = RT_ICON): TBitmap;

Creates a bitmap from an icon object stored in application resources.

function GetModuleIconCount(const ModuleName: string): Integer; overload;

Returns the total number of HW-independent icon resources in a module identified by ModuleName.

function GetModuleIconCount(Instance: HINST): Integer; overload;

Returns the total number of HW-independent icon resources in a module identified by Instance.

function GetModuleResourceCount(Instance: HINST; ResType: PChar): Integer;

Returns the total number of resources of a type specified by ResType in a module identified by Instance.

function MakeHandles(hXOR, hAND: HBITMAP): TKIconHandles;

Returns the str1ucture containing hXOR and hAND bitmaps.

procedure RegisterKIcon;

Integrates KIcon into TPicture.

procedure UnregisterKIcon;

Removes KIcon from TPicture.

Types

Overview

PKCursorHotSpot = ^TKCursorHotSpot;
PKIconCursorDirEntry = ^TKIconCursorDirEntry;
PKIconCursorDirEntryInRes = ^TKIconCursorDirEntryInRes;
PKIconCursorInRes = ^TKIconCursorInRes;
PKIconData = ^TKIconData;
PKIconHeader = ^TKIconHeader;
TKCursorDir = packed record Width: Word; Height: Word; end;
TKCursorHotSpot = packed record xHotSpot: Word; yHotSpot: Word; end;
TKIconCursorDirEntry = packed record Width: Byte; Height: Byte; ColorCount: Byte; Reserved: Byte; Info: TKIconCursorDirInfo; dwBytesInRes: Longint; dwImageOffset: Longint; end;
TKIconCursorDirEntryInRes = packed record Info: TKIconCursorInfo; wPlanes: Word; wBitCount: Word; dwBytesInRes: Longint; wEntryName: Word; end;
TKIconCursorDirInfo = packed record case Integer of 0: ( wPlanes: Word; wBitCount: Word; ); 1: ( wX: Word; wY: Word; ); end;
TKIconCursorInfo = packed record case Integer of 0: (Icon: TKIconResdir); 1: (Cursor: TKCursorDir); end;
TKIconCursorInRes = packed record IH: TKIconHeader; Entries: array [0..MaxInt div SizeOf(TKIconCursorDirEntryInRes) - 2] of TKIconCursorDirEntryInRes; end;
TKIconData = record Width: Integer; Height: Integer; Bpp: Integer; BytesInRes: Integer; Offset: Integer; HotSpot: TPoint; iXOR: PBitmapInfo; iXORSize: Integer; pXOR: Pointer; pXORSize: Integer; hXOR: HBITMAP; pAND: Pointer; pANDSize: Integer; hAND: HBITMAP; IsPNG: Boolean; PNG: TKIconPngObject; end;
TKIconDimension = record Width, Height: Integer; end;
TKIconHandles = record hXOR, hAND: HBITMAP; end;
TKIconHeader = packed record idReserved: Word; idType: Word; idCount: Word; end;
TKIconResdir = packed record Width: Byte; Height: Byte; ColorCount: Byte; Reserved: Byte; end;

Description

PKCursorHotSpot = ^TKCursorHotSpot;

Pointer to the cursor hot spot structure

PKIconCursorDirEntry = ^TKIconCursorDirEntry;

Pointer to the icon/cursor directory entry

PKIconCursorDirEntryInRes = ^TKIconCursorDirEntryInRes;

Pointer to the icon/cursor resource file directory entry

PKIconCursorInRes = ^TKIconCursorInRes;

Pointer to the helper structure

PKIconData = ^TKIconData;

Pointer to the internal image description structure

PKIconHeader = ^TKIconHeader;

Pointer to the icon file header structure

TKCursorDir = packed record Width: Word; Height: Word; end;

Helper structure for cursor specific data in resource file

TKCursorHotSpot = packed record xHotSpot: Word; yHotSpot: Word; end;

Helper structure to typecast cursor hot spot coordinates

TKIconCursorDirEntry = packed record Width: Byte; Height: Byte; ColorCount: Byte; Reserved: Byte; Info: TKIconCursorDirInfo; dwBytesInRes: Longint; dwImageOffset: Longint; end;

Icon/cursor directory entry. This structure decribes each icon/cursor image. These structures describing all images immediately follow the TKIconHeader structure in the icon file. After these the bitmap data for all images are stored (TBitmapInfoHeader, palette data, bitmap bits - XOR, AND).

    Members:
  • Width - image width
  • Height - image height
  • ColorCount - number of entries in palette table
  • Reserved - not used
  • Info - different for icons/cursors
  • dwBytesInRes - total number bytes in the image including pallette data, XOR bits, AND bits and bitmap info header
  • dwImageOffset - position of image as offset from the beginning of file

TKIconCursorDirEntryInRes = packed record Info: TKIconCursorInfo; wPlanes: Word; wBitCount: Word; dwBytesInRes: Longint; wEntryName: Word; end;

Icon/cursor directory entry as found in resource files

    Members:
  • Info - structure that merges icon/cursor specific data
  • wPlanes - not used = 0
  • wBitCount - not used = 0
  • dwBytesInRes - total number of bytes in the image including pallette data, XOR bits, AND bits and bitmap info header
  • wEntryName - icon/cursor entry name. This number identifies the particular icon image in a resource file (images are stored under ICONENTRY key)

TKIconCursorDirInfo = packed record case Integer of 0: ( wPlanes: Word; wBitCount: Word; ); 1: ( wX: Word; wY: Word; ); end;

Helper structure identifying attributes that are different for icons and cursors

    Members:
  • wPlanes - for icons: amount of image planes - I think that this is always 1
  • wBitCount - for icons: image color resolution
  • wX - for cursors: hot spot horizontal coordinate
  • wY - for cursors: hot spot vertical coordinate

TKIconCursorInfo = packed record case Integer of 0: (Icon: TKIconResdir); 1: (Cursor: TKCursorDir); end;

Helper structure merging icon and cursor specific data

TKIconCursorInRes = packed record IH: TKIconHeader; Entries: array [0..MaxInt div SizeOf(TKIconCursorDirEntryInRes) - 2] of TKIconCursorDirEntryInRes; end;

Helper structure to access resource data

TKIconData = record Width: Integer; Height: Integer; Bpp: Integer; BytesInRes: Integer; Offset: Integer; HotSpot: TPoint; iXOR: PBitmapInfo; iXORSize: Integer; pXOR: Pointer; pXORSize: Integer; hXOR: HBITMAP; pAND: Pointer; pANDSize: Integer; hAND: HBITMAP; IsPNG: Boolean; PNG: TKIconPngObject; end;

Represents the internal data structure describing each icon/cursor image

    Members:
  • Width - image width
  • Height - image height
  • Bpp - image color resolution
  • BytesInRes - total image data size
  • HotSpot - hot spot for a cursor
  • iXOR - pointer to the color bitmap info header + palette
  • iXORSize - size of iXOR data
  • pXOR - pointer to the color bitmap bits
  • pXORSize - size of pXOR data
  • hXOR - handle to the color bitmap - is always a DIB section
  • pAND - pointer to the monochrome (mask) bitmap bits
  • pANDSize - size of pAND data
  • hAND - handle to the monochrome bitmap - is always a DIB section
  • PNG - holds the PNG image

TKIconDimension = record Width, Height: Integer; end;

Specifies the width and height of an icon or cursor image

TKIconHandles = record hXOR, hAND: HBITMAP; end;

Specifies the GDI handles for one icon/cursor image

    Members:
  • hXOR - handle to the color bitmap - icon image
  • hAND - handle to the monochrome bitmap - icon image mask

TKIconHeader = packed record idReserved: Word; idType: Word; idCount: Word; end;

Icon file header

    Members:
  • idReserved - always 0
  • idType - 1=icon, 2=cursor
  • idCount - total number of icon images in file

TKIconResdir = packed record Width: Byte; Height: Byte; ColorCount: Byte; Reserved: Byte; end;

Helper structure for icon specific data in resource file

Enumerations

TKIconAlignStyle

Controls how the image should be aligned when they are beeing resized

asNone | image remains aligned to the top-left corner
asCenter | image will be centered within the new boundary rectangle
TKIconDrawStyle

Specifies how the icon image(s) should be rendered. This feature can be used along with the MaskFromColor method to implement a ‘color picker’ for a new mask construction.

idsNormal | paint normally
idsNoMask | paint without applying the mask - color bitmap only
idsMaskOnly | paint only the mask - monochrome bitmap only
idsAlphaChannel | paint only the alpha channel as grayscale image - only for 32 bit icon bitmaps else paint as with idsNoMask style

Author

Tomas Krysl (tomkrysl@tkweb.eu)

Created

9 Jan 2005

Last Modified

20 Jun 2010


KControls help: KIcon: Class TIcon

Class TIcon

Unit

KIcon

Declaration

type TIcon = class(TKIcon)

Description

This class is necessary because of the TPicture streaming.

Hierarchy

TKIcon


KControls help: KIcon: Class TKIcon

Class TKIcon

Unit

KIcon

Declaration

type TKIcon = class(TGraphic)

Description

KIcon main class.

Methods

Overview

Public | constructor Create; override;
Public | destructor Destroy; override;
Public | procedure Add(const Handles: TKIconHandles);
Public | procedure Assign(Source: TPersistent); override;
Protected | procedure Changed(Sender: TObject); override;
Public | procedure Clear; dynamic;
Public | procedure CopyToAlphaBitmap(Index: Integer; Bitmap: TKAlphaBitmap);
Public | procedure CopyToBitmap(Index: Integer; Bitmap: TBitmap);
Public | function CreateHandle(Index: Integer): HICON;
Public | procedure Delete(Index: Integer);
Protected | procedure Draw(ACanvas: TCanvas; const Rect: TRect); override;
Protected | function GetEmpty: Boolean; override;
Protected | function GetHeight: Integer; override;
Protected | function GetTransparent: Boolean; override;
Protected | function GetWidth: Integer; override;
Public | procedure Insert(Index: Integer; const Handles: TKIconHandles);
Public | procedure LoadFromAssocExtension(const Extension: string);
Public | procedure LoadFromAssocFile(const FileName: string);
Public | procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle; APalette: HPALETTE); override;
Public | procedure LoadFromHandle(Handle: HICON);
Public | procedure LoadFromModule(const ModuleName: string; ID: Word); overload;
Public | procedure LoadFromModule(const ModuleName, ResName: string); overload;
Public | procedure LoadFromModuleByIndex(const ModuleName: string; Index: Integer);
Public | procedure LoadFromResource(Instance: HINST; const ResName: string); overload;
Public | procedure LoadFromResource(Instance: HINST; ID: Word); overload;
Public | procedure LoadFromResourceByIndex(Instance: HINST; Index: Integer);
Public | procedure LoadFromStream(Stream: TStream); override;
Protected | procedure LoadHandles(Index: Integer; const Handles: TKIconHandles; OrigBpp: Boolean);
Public | procedure MaskFromColor(Index: Integer; Color: TColor; HasAlpha: Boolean = False);
Public | procedure SaveToClipboardFormat(var Format: Word; var Data: THandle; var APalette: HPALETTE); override;
Public | procedure SaveToStream(Stream: TStream); override;
Protected | procedure SetHeight(Value: Integer); override;
Protected | procedure SetTransparent(Value: Boolean); override;
Protected | procedure SetWidth(Value: Integer); override;
Protected | procedure Update; dynamic;
Protected | procedure UpdateDim(Index: Integer; Value: TKIconDimension);

Description

Public constructor Create; override;

Overriden method - see Delphi help.

Public destructor Destroy; override;

Overriden method - see Delphi help.

Public procedure Add(const Handles: TKIconHandles);

Adds a new image to the end of the internal image list. You should always specify valid color and mask bitmap handles else an exception will occur.

Public procedure Assign(Source: TPersistent); override;

Overriden method - see Delphi help.

Protected procedure Changed(Sender: TObject); override;

Overriden method - see Delphi help. Calls Update method.

Public procedure Clear; dynamic;

Clears all images so that the instance contains no icon/cursor.

Public procedure CopyToAlphaBitmap(Index: Integer; Bitmap: TKAlphaBitmap);

Copies the icon image into an alpha bitmap identified by Bitmap. Icon image is copied to the alpha bitmap. It icon has alpha channel it is copied as well. Bitmap size will always be matched to the icon image.

Public procedure CopyToBitmap(Index: Integer; Bitmap: TBitmap);

Copies the icon image into a bitmap identified by Bitmap. Both color and mask image is copied to preserve true transparency. You can use this to pass to Glyph properties (e.g. TSpeedButton). Bitmap properties will always be matched to the icon image. For 32bpp icon images, alpha channel is copied as well.

Public function CreateHandle(Index: Integer): HICON;

Creates an icon handle for use with Win32 API icon functions. The image identified by Index will be used for this handle. If DisplayAll is False and Index is out of range, CurrentIndex will be used instead.

Public procedure Delete(Index: Integer);

Deletes an image identified by Index from the internal image list.

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

Overriden method - see Delphi help.

Protected function GetEmpty: Boolean; override;

Overriden method - see Delphi help.

Protected function GetHeight: Integer; override;

Overriden method - see Delphi help.

Protected function GetTransparent: Boolean; override;

Overriden method - see Delphi help.

Protected function GetWidth: Integer; override;

Overriden method - see Delphi help.

Public procedure Insert(Index: Integer; const Handles: TKIconHandles);

Inserts an image at the position identified by Index into the internal image list. The existing images will be preserved and shifted accordingly.

Public procedure LoadFromAssocExtension(const Extension: string);

Loads the icon from the module associated with the file extension identified by Extension (DefaultIcon registry key). The Extension parameter should contain the leading period ('.'). If no association can be found for that extension, an exception will be triggered.

Public procedure LoadFromAssocFile(const FileName: string);

Loads the icon from the module associated with the file identified by FileName (DefaultIcon registry key). If no association can be found for the file, an exception will be raised and the function will try to load FileName as if it was a module itself.

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

Overriden method - see Delphi help. Does nothing for icons/cursors.

Public procedure LoadFromHandle(Handle: HICON);

Loads the icon from Win32 API icon handle. Please keep in mind that icon bitmaps can't be loaded as DIBs because they are already converted to DDBs when accessible through HICON. So it is impossible to load the icon in it's native format (e.g. as stored in an *.ico file) from HICON. This function has been introduced only to complete the loading schemes of this class and you should rather use another LoadFrom... methods. The behavior of this function can be controlled via the InHandleBpp and InHandleFullAlpha properties. It is not recommended to use this function in new projects.

Public procedure LoadFromModule(const ModuleName: string; ID: Word); overload;

Loads the icon from resources of a module identified by ModuleName. A valid icon resource must be specified by ID, otherwise an exception occurs. This function uses the LoadLibrary API function, so it is recommended to use the LoadFromResourceX functions to load multiple icons from the same module. ID is of type Word so it can’t exceed 65535.

Public procedure LoadFromModule(const ModuleName, ResName: string); overload;

Does the same thing, but with resource ID specified as string. Let's suppose ID = 123. Here you can pass it as a string '#123'.

Public procedure LoadFromModuleByIndex(const ModuleName: string; Index: Integer);

This function does the same as LoadFromModule, but the icon resource is specified by index here. The index stands for the n-th icon stored in the module resources. So, LoadFromModule('dummy.exe', 'MAINICON') would produce the same results as LoadFromModuleByIndex('dummy.exe', 0), provided 'MAINICON' is the first icon resource in 'dummy.exe'.

Public procedure LoadFromResource(Instance: HINST; const ResName: string); overload;

Loads the icon from resources of a module instance identified by Instance. Further behavior corresponds to LoadFromModule with resource ID specified as string.

Public procedure LoadFromResource(Instance: HINST; ID: Word); overload;

Loads the icon from resources of a module instance identified by Instance. Further behavior corresponds to LoadFromModule with resource ID specified as integer.

Public procedure LoadFromResourceByIndex(Instance: HINST; Index: Integer);

Loads the icon from resources of a module instance identified by Instance. Further behavior corresponds to LoadFromModuleByIndex.

Public procedure LoadFromStream(Stream: TStream); override;

Loads the icon from the stream. Parses the *.ico file structure. An overriden method.

Protected procedure LoadHandles(Index: Integer; const Handles: TKIconHandles; OrigBpp: Boolean);

Copies the bitmaps stored in Handles to the icon image identified by Index. If OrigBpp is True, the color resolution for the color bitmap remains unchanged, otherwise the value of InHandleBpp will be used.

Public procedure MaskFromColor(Index: Integer; Color: TColor; HasAlpha: Boolean = False);

Makes it possible to create a new mask bitmap for the image identified by Index. The new monochrome mask bitmap will be created from the color bitmap. Pixels of the color bitmap that match Color will be masked by the new mask, other pixels will be unmasked. If the Color parameter contains alpha channel, you should set HasAlpha to True to perform comparison with the alpha channel. Otherwise, only the red, green and blue channels will be compared.

Public procedure SaveToClipboardFormat(var Format: Word; var Data: THandle; var APalette: HPALETTE); override;

Overriden method - see Delphi help. Does nothing for icons/cursors.

Public procedure SaveToStream(Stream: TStream); override;

Saves the icon to the stream. Assembles the *.ico file structure. An overriden method.

Protected procedure SetHeight(Value: Integer); override;

Overriden method - see Delphi help.

Protected procedure SetTransparent(Value: Boolean); override;

Overriden method - see Delphi help.

Protected procedure SetWidth(Value: Integer); override;

Overriden method - see Delphi help.

Protected procedure Update; dynamic;

Updates MaxWidth, MaxHeight and CurrentIndex properties accordingly.

Protected procedure UpdateDim(Index: Integer; Value: TKIconDimension);

Resizes an icon image identified by Index to new dimensions stored in Value. The AlignStyle property controls the image alignment within the new rectangle.

Properties

Overview

Public | property AlignStyle: TKIconAlignStyle;
Public | property CurrentIndex: Integer;
Public | property Cursor: Boolean;
Public | property Dimensions[Index: Integer]: TKIconDimension;
Public | property DisplayAll: Boolean;
Public | property DisplayHorz: Boolean;
Public | property Handles[Index: Integer]: TKIconHandles;
Public | property Heights[Index: Integer]: Integer;
Public | property HotSpot[Index: Integer]: TPoint;
Public | property IconCount: Integer;
Public | property IconData[Index: Integer]: TKIconData;
Public | property IconDrawStyle: TKIconDrawStyle;
Public | property InHandleBpp: Integer;
Public | property InHandleFullAlpha: Boolean;
Public | property MaxHeight: Integer;
Public | property MaxWidth: Integer;
Public | property OptimalIcon: Boolean;
Public | property OverSizeWeight: Single;
Public | property RequestedSize: TKIconDimension;
Public | property Spacing: Integer;
Public | property StretchEnabled: Boolean;
Public | property Widths[Index: Integer]: Integer;

Description

Public property AlignStyle: TKIconAlignStyle;

Controls the icon image resizing which is performed by the UpdateDim method.

Public property CurrentIndex: Integer;

Specifies the index of the currently displayed icon image. If no image is loaded (no icon), the value of CurrentIndex is -1.

Public property Cursor: Boolean;

Indicates whether the instance of this class represents a cursor (True) or an icon (False).

Public property Dimensions[Index: Integer]: TKIconDimension;

Makes it possible to read/modify the size of an icon image.

Public property DisplayAll: Boolean;

Specifies whether all icon images (True) or a single subimage should be drawn (False). When True, all available icon images will be rendered.

Public property DisplayHorz: Boolean;

Specifies how the images should be drawn when DisplayAll is True. If True, the images will be drawn horizontally aligned. If False, the images will be drawn vertically aligned.

Public property Handles[Index: Integer]: TKIconHandles;

Makes it possible to read/modify icon image bitmaps (color and mask bitmap). Bitmaps that you pass will be copied and remain unchanged. When reading original bitmap handles are returned and thus must not be modified or released.

Public property Heights[Index: Integer]: Integer;

Makes it possible to read/modify the height of an icon image.

Public property HotSpot[Index: Integer]: TPoint;

For a cursor, this property contains the hot spots for all cursor images.

Public property IconCount: Integer;

Returns the number of images found in this instance.

Public property IconData[Index: Integer]: TKIconData;

Makes it possible to read the internal data structure of each icon image. A copy of the structure is returned but the pointers or handles are original (no copies are created) and thus must not be modified or released.

Public property IconDrawStyle: TKIconDrawStyle;

Affects the icon image rendering.

Public property InHandleBpp: Integer;

Specifies the color resolution a DIB should have after converted from a DDB that has been passed to the LoadHandles method.

Public property InHandleFullAlpha: Boolean;

Determines whether a DIB with 32 bits per pixel should have full visibility (alpha channel of each pixel set to 0xFF) after converted from a DDB that has been passed to the LoadHandles method. The alpha channel values will be only set to 0xFF when the current alpha channel of every pixel is zero.

Public property MaxHeight: Integer;

Returns the height of the image that has the maximum height of all icon images. When DisplayAll is True and DisplayHorz is False, returns the total height of all images and spaces between them (specified by Spacing).

Public property MaxWidth: Integer;

Returns the width of the image that has the maximum width of all icon images. When both DisplayAll and DisplayHorz is True, returns the total width of all images and spaces between them (specified by Spacing).

Public property OptimalIcon: Boolean;

This property applies only when DisplayAll is False. It determines whether the icon image corresponding to the RequestedSize property and the current display mode color resolution (True) or the subimage specified by CurrentIndex (False) should be displayed.

Public property OverSizeWeight: Single;

Controls the decision threshold for the optimal image when OptimalIcon is True. The bigger the value is, the less is the probability a subimage greater than RequestedSize will be selected. This value is big enough by default so that almost always a smaller image will be selected if none with the exact size is found.

Public property RequestedSize: TKIconDimension;

Specifies the preferred image size when OptimalIcon is True. When OverSizeWeight is small, a greater subimage may be often selected.

Public property Spacing: Integer;

Specifies the spacing between icon images when DisplayAll is True.

Public property StretchEnabled: Boolean;

Specifies whether icon images can be stretched when drawn. This property was introduced perhaps only for backward compatibility with Graphics.TIcon.

Public property Widths[Index: Integer]: Integer;

Makes it possible to read/modify the width of an icon image.


KControls help: Class Hierarchy

Class Hierarchy

  • TComponent
    • TKPrintPreviewDialog
    • TKPrintSetupDialog
  • TCustomControl
    • TKCustomControl
      • TKCustomGrid
        • TKCustomDBGrid
          • TKDBGrid
        • TKGrid
      • TKCustomHexEditor
        • TKHexEditor
      • TKPrintPreview
  • TDataLink
    • TKDBGridDataLink
  • TGraphic
    • TKAlphaBitmap
    • TKIcon
      • TIcon
  • THintWindow
    • TKHintWindow
      • TKGraphicHint
      • TKTextHint
  • TKDBGridCellAncestor
    • TKDBGridCell
  • TKGridObjectCellAncestor
    • TKGridObjectCell
  • TList
    • TKHexEditorChangeList
  • TObject
    • TKDragWindow
    • TKGridAxisItem
      • TKGridCol
        • TKDBGridCol
      • TKGridRow
    • TKGridCell
      • TKGridTextCell
        • TKGridAttrTextCell
    • TKGridCellPainter
      • TKDBGridCellPainter
  • TPersistent
    • TKGridColors
      • TKDBGridColors
    • TKHexEditorColors
    • TKPreviewColors
    • TKPrintPageSetup


KControls help: All Classes, Interfaces and Objects

All Classes, Interfaces and Objects

Name | Unit | Description
TIcon | KIcon | This class is necessary because of the TPicture streaming.
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.
TKCustomDBGrid | KDBGrids | KGrid data aware base component
TKCustomGrid | KGrids | KGrid base component
TKCustomHexEditor | KHexEditor | Hexadecimal editor base component
TKDBGrid | KDBGrids | KDBGrid design-time component
TKDBGridCell | KDBGrids | Base cell class for TKDBGrid
TKDBGridCellPainter | KDBGrids | Cell painter class used by TKCustomDBGrid class
TKDBGridCol | KDBGrids | Column class for TKCustomDBGrid
TKDBGridColors | KDBGrids | Container for all colors used by TKCustomDBGrid class
TKDBGridDataLink | KDBGrids | Data link override for TKCustomDBGrid
TKDragWindow | KGraphics | Encapsulates the drag window
TKGraphicHint | KGraphics |
TKGrid | KGrids | KGrid design-time component
TKGridAttrTextCell | KGrids | Class for a textual cell with custom appearance
TKGridAxisItem | KGrids | Base class to store column or row properties
TKGridCell | KGrids | Base class to store cell properties
TKGridCellPainter | KGrids | Wrapper for a versatile and easily extensible cell painting engine
TKGridCol | KGrids | Class to store column properties
TKGridColors | KGrids | Container for all colors used by TKCustomGrid class
TKGridObjectCell | KGrids | Class for an object cell
TKGridRow | KGrids | Class to store row properties
TKGridTextCell | KGrids | Class for simple textual cell
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
TKIcon | KIcon | KIcon main class.
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


KControls 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.
PKCursorHotSpot | KIcon | Pointer to the cursor hot spot structure
PKHexEditorChangeItem | KHexEditor | Pointer to TKHexEditorChangeItem
PKIconCursorDirEntry | KIcon | Pointer to the icon/cursor directory entry
PKIconCursorDirEntryInRes | KIcon | Pointer to the icon/cursor resource file directory entry
PKIconCursorInRes | KIcon | Pointer to the helper structure
PKIconData | KIcon | Pointer to the internal image description structure
PKIconHeader | KIcon | Pointer to the icon file header structure
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.
TKCursorDir | KIcon | Helper structure for cursor specific data in resource file
TKCursorHotSpot | KIcon | Helper structure to typecast cursor hot spot coordinates
TKDBCustomGrid | KDBGrids | For backward compatibility.
TKDBGridColClass | KDBGrids | Metaclass for TKDBGridCol
TKDBGridOptions | KDBGrids | Set type for TKDBGridOption enumeration.
TKDynColorRecs | KGraphics | Dynamic array for TKColorRec.
TKGridAxisInfo | KGrids | Declares a structure returned by the GetAxisInfoHorz or GetAxisInfoVert functions
TKGridAxisInfoBoth | KGrids | Declares a structure returned by the GetAxisInfoBoth function
TKGridAxisInfoMask | KGrids | Set type for TKGridAxisInfoMaskMembers enumeration.
TKGridAxisItemClass | KGrids | Metaclass for TKGridAxisItem
TKGridAxisItems | KGrids | Dynamic array type to store TKGridAxisItem instances
TKGridAxisUpdateFlags | KGrids | Set type for TKGridAxisUpdateFlags enumeration.
TKGridBeginDragEvent | KGrids | Declares event handler e.g. for the OnBeginColDrag event
TKGridBeginSizingEvent | KGrids | Declares event handler e.g. for the OnBeginColSizing event
TKGridCanResizeFunc | KGrids | Method type for the CanResize field in the TKGridAxisInfo structure.
TKGridCellClass | KGrids | Metaclass for TKGridCell
TKGridCellEvent | KGrids | Declares event handler for any cell notification events
TKGridCellHintEvent | KGrids | Declares event handler for the OnMouseCellHint event
TKGridCellPainterClass | KGrids | Metaclass for TKGridCellPainter
TKGridCellRow | KGrids | Dynamic array type to store row of TKGridCell instances
TKGridCells | KGrids | Dynamic array type to store the entire grid of TKGridCell instances
TKGridCellSpan | KGrids | Declares a structure that holds both column and row span of a cell
TKGridCellSpanEvent | KGrids | Declares event handler for the OnCellSpan event
TKGridCheckDragEvent | KGrids | Declares event handler e.g. for the OnCheckColDrag event
TKGridColClass | KGrids | Metaclass for TKGridCol
TKGridColorIndex | KGrids | Declares possible indexes e.g. for the Color property.
TKGridCompareCellInstancesEvent | KGrids | Declares event handler for the OnCompareCellInstances
TKGridCompareCellsEvent | KGrids | Declares event handler for the OnCompareCells
TKGridCompareProc | KGrids | Method type for the Compare parameter e.g. in the InternalQuickSortNR method.
TKGridCoord | KGrids | Declares a structure that hold both column and row index of a cell
TKGridCustomSortEvent | KGrids | Declares event handler for the OnCustomSortCols or OnCustomSortRows events
TKGridDrawCellEvent | KGrids | Declares event handler e.g. for the OnDrawCell event
TKGridDrawState | KGrids | Set type for TKGridDrawStateMembers enumeration.
TKGridEditorCreateEvent | KGrids | Declares event handler for the OnEditorCreate event
TKGridEditorDataEvent | KGrids | Declares event handler for the OnEditorDataFromGrid or OnEditorDataToGrid events
TKGridEditorDestroyEvent | KGrids | Declares event handler for the OnEditorDestroy event
TKGridEditorKeyPreviewEvent | KGrids | Declares event handler for the OnEditorKeyPreview event
TKGridEditorResizeEvent | KGrids | Declares event handler for the OnEditorResize event
TKGridEditorSelectEvent | KGrids | Declares event handler for the OnEditorSelect event
TKGridEndDragEvent | KGrids | Declares event handler e.g. for the OnEndColDrag event
TKGridEndSizingEvent | KGrids | Declares event handler e.g. for the OnEndColSizing event
TKGridExchangeEvent | KGrids | Declares event handler for the OnExchangeCols or OnExchangeRows event
TKGridExchangeProc | KGrids | Method type for the Exchange parameter e.g. in the InternalQuickSortNR method.
TKGridExtentEvent | KGrids | Declares event handler for any cell extent notification events
TKGridGetExtentFunc | KGrids | Method type for the CellExtent field in the TKGridAxisInfo structure.
TKGridHCIBitmaps | KGrids | Declares a structure for hidden cell indicator glyphs.
TKGridMeasureCellEvent | KGrids | Declares event handler e.g. for the OnMeasureCell event
TKGridMovedEvent | KGrids | Declares event handler for the OnColumnMoved or OnRowMoved events
TKGridOptions | KGrids | Set type for TKGridOption enumeration.
TKGridOptionsEx | KGrids | Set type for TKGridOptionEx enumeration.
TKGridRect | KGrids | Declares the type e.g. for the Selection property
TKGridRowClass | KGrids | Metaclass for TKGridRow
TKGridSelectCellEvent | KGrids | Declares event handler for the OnSelectCell event
TKGridSelectionExpandEvent | KGrids | Declares event handler for the OnSelectCell event
TKGridSelectionFlags | KGrids | Set type for TKGridSelectionFlag enumeration.
TKGridSizeChangedEvent | KGrids | Declares event handler for the OnSizeChanged event
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
TKIconCursorDirEntry | KIcon | Icon/cursor directory entry. This structure decribes each icon/cursor image. These structures describing all images immediately follow the TKIconHeader structure in the icon file. After these the bitmap data for all images are stored (TBitmapInfoHeader, palette data, bitmap bits - XOR, AND).
TKIconCursorDirEntryInRes | KIcon | Icon/cursor directory entry as found in resource files
TKIconCursorDirInfo | KIcon | Helper structure identifying attributes that are different for icons and cursors
TKIconCursorInfo | KIcon | Helper structure merging icon and cursor specific data
TKIconCursorInRes | KIcon | Helper structure to access resource data
TKIconData | KIcon | Represents the internal data structure describing each icon/cursor image
TKIconDimension | KIcon | Specifies the width and height of an icon or cursor image
TKIconHandles | KIcon | Specifies the GDI handles for one icon/cursor image
TKIconHeader | KIcon | Icon file header
TKIconResdir | KIcon | Helper structure for icon specific data in resource file
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.
TUpdateLayeredWindowProc | KGraphics |
TWords | KFunctions | Static array for Word.


KControls help: All Enumerations

All Enumerations

Name | Unit | Description
TKBrightMode | KGraphics | Declares possible values for the Style parameter of the BrightColor function.
TKDBGridOption | KDBGrids | Declares possible values for the DBOptions property.
TKGridAxisInfoMaskMembers | KGrids | Declares possible values for the Mask parameter in the GetAxisInfoHorz or GetAxisInfoVert functions.
TKGridAxisUpdateFlag | KGrids | Declares possible values for the Flags parameter in the UpdateAxes method.
TKGridCaptureState | KGrids | Declares possible values for the State parameter in the SuggestDrag or SuggestSizing functions.
TKGridColorScheme | KGrids | Declares possible values for the ColorScheme property.
TKGridDisabledDrawStyle | KGrids | Declares possible values for the DisabledDrawStyle property.
TKGridDragStyle | KGrids | Declares possible values for the DragStyle property.
TKGridDrawStateMembers | KGrids | Declares possible values for the State parameter in the TKGridDrawCellEvent event handler or DrawCell method.
TKGridEditorTransparency | KGrids | Declares possible values for the EditorTransparency property.
TKGridInvisibleCells | KGrids | Declares possible values for the InvisibleCells parameter in the PointToCell method.
TKGridMeasureCellPriority | KGrids | Declares possible values for the Priority parameter in the MeasureCell method.
TKGridMoveCommand | KGrids | Declares possible values for the Command parameter in the InternalMove method.
TKGridMoveDirection | KGrids | Declares possible values for the MoveDirection property.
TKGridOption | KGrids | Declares possible values for the Options property.
TKGridOptionEx | KGrids | Declares possible values for the OptionsEx property.
TKGridRangeSelectStyle | KGrids | Declares possible values for the RangeSelectStyle property.
TKGridScrollMode | KGrids | Declares possible values for the ScrollModeHorz and ScrollModeVert properties.
TKGridSelectionFlag | KGrids | Declares possible values for the Flags parameter in the SelectionMove method.
TKGridSelectionStage | KGrids | Declares possible values for the Stage parameter in the TKGridSelectionExpandEvent event handler or SelectionMove method.
TKGridSizeChange | KGrids | Declares possible values for the Change parameter in the TKGridSizeChangedEvent event handler.
TKGridSizingStyle | KGrids | Declares possible values for the SizingStyle property.
TKGridSortMode | KGrids | Declares possible values for the SortMode property.
TKGridSortStyle | KGrids | Declares possible values for the SortStyle property.
TKGridState | KGrids | Declares possible values for the FGridState field.
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)
TKIconAlignStyle | KIcon | Controls how the image should be aligned when they are beeing resized
TKIconDrawStyle | KIcon | Specifies how the icon image(s) should be rendered. This feature can be used along with the MaskFromColor method to implement a ‘color picker’ for a new mask construction.
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.


KControls help: All Variables

All Variables

None


KControls help: All Constants

All Constants

Name | Unit | Description
cActiveRecordDef | KDBGrids | Default value for the ActiveRecord property.
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
cAll | KGrids | This constant can be passed into the FirstCol or FirstRow parameter of the UpdateAxes method.
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.
cCellBkGndDef | KGrids | Default value for the CellBkGnd color property.
cCellLinesDef | KGrids | Default value for the CellLines color property.
cCellTextDef | KGrids | Default value for the CellText color 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.
cColCountDef | KGrids | Default value for the ColCount property.
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.
cDBOptionsDef | KDBGrids | Default value for the DBOptions property.
cDefaultColWidthDef | KGrids | Default value for the DefaultColWidth property.
cDefaultImageSet | KDBGrids | Used by default to distinguish image field type.
cDefaultRowHeightDef | KGrids | Default value for the DefaultRowHeight property.
cDefaultStringSet | KDBGrids | Used by default to distinguish string field type.
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
cDisabledDrawStyleDef | KGrids | Default value for the DisabledDrawStyle property.
cDragStyleDef | KGrids | Default value for the DragStyle property.
cDragSuggestionBkGndDef | KGrids | Default value for the DragSuggestionBkGnd color property.
cDragSuggestionLineDef | KGrids | Default value for the DragSuggestionLine color property.
cDrawStylesDef | KHexEditor | Default value for the DrawStyles property
cEditorTransparencyDef | KGrids | Default value for the EditorTransparency property.
cEllipsis | KFunctions | Text ellipsis string.
cFixedCellBkGndDef | KGrids | Default value for the FixedCellBkGnd color property.
cFixedCellIndicationDef | KGrids | Default value for the FixedCellIndication color property.
cFixedCellLinesDef | KGrids | Default value for the FixedCellLines color property.
cFixedCellTextDef | KGrids | Default value for the FixedCellText color property.
cFixedColsDef | KGrids | Default value for the FixedCols property.
cFixedRowsDef | KGrids | Default value for the FixedRows property.
cFixedThemedCellHighlightDef | KGrids | Default value for the FixedThemedCellHighlight color property.
cFixedThemedCellLinesDef | KGrids | Default value for the FixedThemedCellLines color property.
cFixedThemedCellShadowDef | KGrids | Default value for the FixedThemedCellShadow color property.
cFocusedCellBkGndDef | KGrids | Default value for the FocusedCellBkGnd color property.
cFocusedCellTextDef | KGrids | Default value for the FocusedCellText color property.
cFocusedRangeBkGndDef | KGrids | Default value for the FocusedRangeBkGnd color property.
cFocusedRangeTextDef | KGrids | Default value for the FocusedRangeText color property.
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
cGF_CaretToLeft | KGrids | This internal flag is set if caret should be moved to the left side of the inplace editor.
cGF_DBDataUpdating | KDBGrids | This internal flag is set if grid is being updated.
cGF_DBInternalChanging | KDBGrids | This internal flag is set if data record is being changed.
cGF_DesignHitTest | KGrids | This internal flag is set to allow column or row sizing at design time.
cGF_EditorModeActive | KGrids | This internal flag is set to remember inplace editor state if the grid has no input focus.
cGF_EditorUpdating | KGrids | This internal flag is set to prevent recursive calls while inplace editor is being updated.
cGF_EnterPressed | KGrids | This internal flag is set if enter key has been pressed and handled by the grid.
cGF_GridUpdates | KGrids | This internal flag is set if the Set.. methods in TKGridAxisItem and TKGridCell and their descendants must not call any grid methods that could cause infinite recursion.
cGF_SelCellsMerged | KGrids | This internal flag is set if a selectable grid area contains at least 1 merged cell.
cGF_SelectedByMouse | KGrids | This internal flag is set if a cell is selected by mouse click.
cGF_ThroughClick | KGrids | This internal flag is set if a cell is 'through-clicked'.
cGridLineWidthDef | KGrids | Default value for the GridLineWidth property.
cHeight | KHexEditor | Default value for the Height property
cHorzLinesDef | KHexEditor | Default value for the HorzLines color property
ciActiveRecord | KDBGrids | Index for the ActiveRecord 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.
ciCellBkGnd | KGrids | Index for the CellBkGnd property.
ciCellLines | KGrids | Index for the CellLines property.
ciCellText | KGrids | Index for the CellText property.
ciDBGridColorsMax | KDBGrids | Maximum color array index
ciDigitBkGnd | KHexEditor | Index for the DigitBkGnd color property
ciDigitTextEven | KHexEditor | Index for the DigitTextEven color property
ciDigitTextOdd | KHexEditor | Index for the DigitTextOdd color property
ciDragSuggestionBkGnd | KGrids | Index for the DragSuggestionBkGnd property.
ciDragSuggestionLine | KGrids | Index for the DragSuggestionLine property.
ciFixedCellBkGnd | KGrids | Index for the FixedCellBkGnd property.
ciFixedCellIndication | KGrids | Index for the FixedCellIndication property.
ciFixedCellLines | KGrids | Index for the FixedCellLines property.
ciFixedCellText | KGrids | Index for the FixedCellText property.
ciFixedThemedCellHighlight | KGrids | Index for the FixedThemedCellHighlight property.
ciFixedThemedCellLines | KGrids | Index for the FixedThemedCellLines property.
ciFixedThemedCellShadow | KGrids | Index for the FixedThemedCellShadow property.
ciFocusedCellBkGnd | KGrids | Index for the FocusedCellBkGnd property.
ciFocusedCellText | KGrids | Index for the FocusedCellText property.
ciFocusedRangeBkGnd | KGrids | Index for the FocusedRangeBkGnd property.
ciFocusedRangeText | KGrids | Index for the FocusedRangeText property.
ciGridColorsMax | KGrids | Maximum color array index
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 | KGrids | Constant for invalid column or row indexes. Currently, it is used internally. Functions InitialCol and InitialRow return this value in case of invalid parameters.
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.
ciSelectedCellBkGnd | KGrids | Index for the SelectedCellBkGnd property.
ciSelectedCellText | KGrids | Index for the SelectedCellText property.
ciSelectedFixedCellBkGnd | KGrids | Index for the TKGridColors.SelectedFixedCell property.
ciSelectedRangeBkGnd | KGrids | Index for the SelectedRangeBkGnd property.
ciSelectedRangeText | KGrids | Index for the SelectedRangeText 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
cMinColWidthDef | KGrids | Default value for the MinColWidth property.
cMinColWidthMin | KGrids | Minimum value for the MinColWidth property.
cMinRowHeightDef | KGrids | Default value for the MinRowHeight property.
cMinRowHeightMin | KGrids | Minimum value for the MinRowHeight property.
cMouseCellHintTimeDef | KGrids | Default value for the MouseCellHintTime property.
cMouseCellHintTimeMax | KGrids | Maximum value for the MouseCellHintTime property.
cMouseCellHintTimeMin | KGrids | Minimum value for the MouseCellHintTime property.
cMoveDirectionDef | KGrids | Default value for the MoveDirection property.
cOptionsDef | KGrids | Default value for the Options property.
cOptionsDef | KControls | Default value for the Options property.
cOptionsExDef | KGrids | Default value for the OptionsEx 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.
cRangeSelectStyleDef | KGrids | Default value for the RangeSelectStyle property.
crDragHandFree | KFunctions | Constant for uncaptured dragging cursor.
crDragHandGrip | KFunctions | Constant for captured dragging cursor.
crHResize | KFunctions | Constant for horizontal resize cursor.
cRowCountDef | KGrids | Default value for the RowCount property.
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
cScrollBarsDef | KGrids | Default value for the ScrollBars property.
cScrollDelta | KControls | Constant for control scrollbars. It means: Use given Delta to update scrollbar.
cScrollModeDef | KGrids | Default value for the ScrollModeHorz and ScrollModeVert properties.
cScrollNoAction | KControls | Constant for control scrollbars. It means: Leave that scrollbar untouched.
cScrollSpeedDef | KGrids | Default value for the ScrollSpeed property.
cScrollSpeedDef | KHexEditor | Default value for the ScrollSpeed property
cScrollSpeedMax | KGrids | Maximum value for the ScrollSpeed property.
cScrollSpeedMax | KHexEditor | Maximum for the ScrollSpeed property
cScrollSpeedMin | KHexEditor | Minimum for the ScrollSpeed property
cScrollSpeedMin | KGrids | Minimum value 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.
cSelectedCellBkGndDef | KGrids | Default value for the SelectedCellBkGnd color property.
cSelectedCellTextDef | KGrids | Default value for the SelectedCellText color property.
cSelectedFixedCellBkGndDef | KGrids | Default value for then TKGridColors.SelectedFixedCell color property.
cSelectedRangeBkGndDef | KGrids | Default value for the SelectedRangeBkGnd color property.
cSelectedRangeTextDef | KGrids | Default value for the SelectedRangeText 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
cSizingStyleDef | KGrids | Default value for the SizingStyle property.
cSortStyleDef | KGrids | Default value for the SortStyle 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


KControls 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.
CellInGridRect | KGrids | Determines if the Cell specified by ACol and ARow lies within grid rectangle R.
CharInSetEx | KFunctions | Compiler independent Delphi2009-like CharInSet function for ANSI characters.
CharInSetEx | KFunctions | Compiler independent Delphi2009-like CharInSet function for Unicode characters.
ColInGridRect | KGrids | Determines if the grid rectangle contains a subset of cells belonging to the column specified by ACol.
ColorToGrayScale | KGraphics | Makes a grayscale representation of the given color.
ComboKeyPreview | KGrids | Obsolete function. Call TKCustomGrid.DefaultComboKeyPreview instead.
ComboSelect | KGrids | Obsolete function. Call TKCustomGrid.DefaultComboSelect instead.
CompareAxisItems | KGrids | Compares two TKGridAxisItems arrays. The function returns True if the arrays are equal in length and all corresponding TKGridAxisItem instances within both arrays have equal property values.
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.
CreateAlphaBitmapFromResIcon | KIcon | Creates an alpha bitmap from an icon object stored in application resources.
CreateBitmapFromResIcon | KIcon | Creates a bitmap from an icon object stored in application resources.
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.
DefaultDrawCell | KGrids | Obsolete function. Implements default painting for TKCustomGrid cells. Call TKCustomGrid.CellPainter.DefaultDraw instead.
DefaultKeyPreview | KGrids | Obsolete function. Call TKCustomGrid.DefaultEditorKeyPreview instead.
DefaultSelect | KGrids | Obsolete function. Call TKCustomGrid.DefaultEditorSelect instead.
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.
EditKeyPreview | KGrids | Obsolete function. Call TKCustomGrid.DefaultEditKeyPreview instead.
EditSelect | KGrids | Obsolete function. Call TKCustomGrid.DefaultEditSelect instead.
Error | KFunctions | Raises a general exception with associated message Msg.
Exchange | KFunctions | Swaps values of two Word variables.
Exchange | KFunctions | Swaps values of two Double variables.
Exchange | KFunctions | Swaps values of two Char variables.
Exchange | KFunctions | Swaps values of two Integer variables.
Exchange | KFunctions | Swaps values of two Extended variables.
Exchange | KFunctions | Swaps values of two Byte variables.
Exchange | KFunctions | Swaps values of two ShortInt variables.
Exchange | KFunctions | Swaps values of two SmallInt variables.
Exchange | KFunctions | Swaps values of two Int64 variables.
Exchange | KFunctions | Swaps values of two Single variables.
Exchange | KFunctions | Swaps values of two Cardinal 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.
GetModuleIconCount | KIcon | Returns the total number of HW-independent icon resources in a module identified by ModuleName.
GetModuleIconCount | KIcon | Returns the total number of HW-independent icon resources in a module identified by Instance.
GetModuleResourceCount | KIcon | Returns the total number of resources of a type specified by ResType in a module identified by Instance.
GetShiftState | KFunctions | Returns current status of Shift, Alt and Ctrl keys.
GetWindowsFolder KFunctions
GridPoint | KGrids | Makes a TKGridCoord record from ACol and ARow.
GridRect | KGrids | Makes a TKGridRect record from ACell1 and ACell2. All the input parameters will be copied to the corresponding fields of the resulting grid rectangle.
GridRect | KGrids | Makes a TKGridRect record from ACol1, ARow1, ACol2 and ARow2. All the input parameters will be copied to the corresponding fields of the resulting grid rectangle.
GridRect | KGrids | Makes a TKGridRect record from ACell. Cell will be copied both to Cell1 and Cell2 fields of the resulting grid rectangle.
GridRectEqual | KGrids | Compares two grid rectangles. Returns True if all the corresponding fields in GridRect1 equal those in GridRect2.
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.
MakeCellSpan | KGrids | Makes a TKGridCellSpan record from AColumns and ARows.
MakeColorRec | KGraphics | Builds a TKColorRec structure.
MakeHandles | KIcon | Returns the str1ucture containing hXOR and hAND bitmaps.
MakeSelection | KHexEditor | Creates a selection structure from given Index and Digit parameters
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 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 Integer 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 ShortInt value so that it lies between Min and Max
NormalizeGridRect | KGrids | Makes Cell1 field of GridRect always top-left cell and Cell2 field always bottom-right cell.
PixelFormatFromBpp | KGraphics | Returns a pixel format that matches Bpp.
RectInRegion | KGraphics | In Lazarus this WinAPI function is missing.
RegisterKIcon | KIcon | Integrates KIcon into TPicture.
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
RowInGridRect | KGrids | Determines if the grid rectangle contains a subset of cells belonging to the row specified by ARow.
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.
ScrollBarKeyPreview | KGrids | Obsolete function. Call TKCustomGrid.DefaultScrollBarKeyPreview instead.
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.
TrimWhiteSpaces | KFunctions | Trims characters specified by ASet from the beginning and end of AText. New text length is returned by ALen.
UnregisterKIcon | KIcon | Removes KIcon from TPicture.
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.


KControls 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.
cActiveRecordDef | KDBGrids | Default value for the ActiveRecord property.
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
cAll | KGrids | This constant can be passed into the FirstCol or FirstRow parameter of the UpdateAxes method.
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 | 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.
cCellBkGndDef | KGrids | Default value for the CellBkGnd color property.
cCellLinesDef | KGrids | Default value for the CellLines color property.
cCellTextDef | KGrids | Default value for the CellText color 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.
cColCountDef | KGrids | Default value for the ColCount property.
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.
cDBOptionsDef | KDBGrids | Default value for the DBOptions property.
cDefaultColWidthDef | KGrids | Default value for the DefaultColWidth property.
cDefaultImageSet | KDBGrids | Used by default to distinguish image field type.
cDefaultRowHeightDef | KGrids | Default value for the DefaultRowHeight property.
cDefaultStringSet | KDBGrids | Used by default to distinguish string field type.
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 | KGrids | Default value for the DisabledDrawStyle property.
cDisabledDrawStyleDef | KHexEditor | Default value for the DisabledDrawStyle property
cDragStyleDef | KGrids | Default value for the DragStyle property.
cDragSuggestionBkGndDef | KGrids | Default value for the DragSuggestionBkGnd color property.
cDragSuggestionLineDef | KGrids | Default value for the DragSuggestionLine color property.
cDrawStylesDef | KHexEditor | Default value for the DrawStyles property
cEditorTransparencyDef | KGrids | Default value for the EditorTransparency property.
CellInGridRect | KGrids | Determines if the Cell specified by ACol and ARow lies within grid rectangle R.
cEllipsis | KFunctions | Text ellipsis string.
cFixedCellBkGndDef | KGrids | Default value for the FixedCellBkGnd color property.
cFixedCellIndicationDef | KGrids | Default value for the FixedCellIndication color property.
cFixedCellLinesDef | KGrids | Default value for the FixedCellLines color property.
cFixedCellTextDef | KGrids | Default value for the FixedCellText color property.
cFixedColsDef | KGrids | Default value for the FixedCols property.
cFixedRowsDef | KGrids | Default value for the FixedRows property.
cFixedThemedCellHighlightDef | KGrids | Default value for the FixedThemedCellHighlight color property.
cFixedThemedCellLinesDef | KGrids | Default value for the FixedThemedCellLines color property.
cFixedThemedCellShadowDef | KGrids | Default value for the FixedThemedCellShadow color property.
cFocusedCellBkGndDef | KGrids | Default value for the FocusedCellBkGnd color property.
cFocusedCellTextDef | KGrids | Default value for the FocusedCellText color property.
cFocusedRangeBkGndDef | KGrids | Default value for the FocusedRangeBkGnd color property.
cFocusedRangeTextDef | KGrids | Default value for the FocusedRangeText color property.
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
cGF_CaretToLeft | KGrids | This internal flag is set if caret should be moved to the left side of the inplace editor.
cGF_DBDataUpdating | KDBGrids | This internal flag is set if grid is being updated.
cGF_DBInternalChanging | KDBGrids | This internal flag is set if data record is being changed.
cGF_DesignHitTest | KGrids | This internal flag is set to allow column or row sizing at design time.
cGF_EditorModeActive | KGrids | This internal flag is set to remember inplace editor state if the grid has no input focus.
cGF_EditorUpdating | KGrids | This internal flag is set to prevent recursive calls while inplace editor is being updated.
cGF_EnterPressed | KGrids | This internal flag is set if enter key has been pressed and handled by the grid.
cGF_GridUpdates | KGrids | This internal flag is set if the Set.. methods in TKGridAxisItem and TKGridCell and their descendants must not call any grid methods that could cause infinite recursion.
cGF_SelCellsMerged | KGrids | This internal flag is set if a selectable grid area contains at least 1 merged cell.
cGF_SelectedByMouse | KGrids | This internal flag is set if a cell is selected by mouse click.
cGF_ThroughClick | KGrids | This internal flag is set if a cell is 'through-clicked'.
cGridLineWidthDef | KGrids | Default value for the GridLineWidth property.
CharInSetEx | KFunctions | Compiler independent Delphi2009-like CharInSet function for ANSI characters.
CharInSetEx | KFunctions | Compiler independent Delphi2009-like CharInSet function for Unicode characters.
cHeight | KHexEditor | Default value for the Height property
cHorzLinesDef | KHexEditor | Default value for the HorzLines color property
ciActiveRecord | KDBGrids | Index for the ActiveRecord 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.
ciCellBkGnd | KGrids | Index for the CellBkGnd property.
ciCellLines | KGrids | Index for the CellLines property.
ciCellText | KGrids | Index for the CellText property.
ciDBGridColorsMax | KDBGrids | Maximum color array index
ciDigitBkGnd | KHexEditor | Index for the DigitBkGnd color property
ciDigitTextEven | KHexEditor | Index for the DigitTextEven color property
ciDigitTextOdd | KHexEditor | Index for the DigitTextOdd color property
ciDragSuggestionBkGnd | KGrids | Index for the DragSuggestionBkGnd property.
ciDragSuggestionLine | KGrids | Index for the DragSuggestionLine property.
ciFixedCellBkGnd | KGrids | Index for the FixedCellBkGnd property.
ciFixedCellIndication | KGrids | Index for the FixedCellIndication property.
ciFixedCellLines | KGrids | Index for the FixedCellLines property.
ciFixedCellText | KGrids | Index for the FixedCellText property.
ciFixedThemedCellHighlight | KGrids | Index for the FixedThemedCellHighlight property.
ciFixedThemedCellLines | KGrids | Index for the FixedThemedCellLines property.
ciFixedThemedCellShadow | KGrids | Index for the FixedThemedCellShadow property.
ciFocusedCellBkGnd | KGrids | Index for the FocusedCellBkGnd property.
ciFocusedCellText | KGrids | Index for the FocusedCellText property.
ciFocusedRangeBkGnd | KGrids | Index for the FocusedRangeBkGnd property.
ciFocusedRangeText | KGrids | Index for the FocusedRangeText property.
ciGridColorsMax | KGrids | Maximum color array index
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 | KGrids | Constant for invalid column or row indexes. Currently, it is used internally. Functions InitialCol and InitialRow return this value in case of invalid parameters.
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.
ciSelectedCellBkGnd | KGrids | Index for the SelectedCellBkGnd property.
ciSelectedCellText | KGrids | Index for the SelectedCellText property.
ciSelectedFixedCellBkGnd | KGrids | Index for the TKGridColors.SelectedFixedCell property.
ciSelectedRangeBkGnd | KGrids | Index for the SelectedRangeBkGnd property.
ciSelectedRangeText | KGrids | Index for the SelectedRangeText 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
cMinColWidthDef | KGrids | Default value for the MinColWidth property.
cMinColWidthMin | KGrids | Minimum value for the MinColWidth property.
cMinRowHeightDef | KGrids | Default value for the MinRowHeight property.
cMinRowHeightMin | KGrids | Minimum value for the MinRowHeight property.
cMouseCellHintTimeDef | KGrids | Default value for the MouseCellHintTime property.
cMouseCellHintTimeMax | KGrids | Maximum value for the MouseCellHintTime property.
cMouseCellHintTimeMin | KGrids | Minimum value for the MouseCellHintTime property.
cMoveDirectionDef | KGrids | Default value for the MoveDirection property.
ColInGridRect | KGrids | Determines if the grid rectangle contains a subset of cells belonging to the column specified by ACol.
ColorToGrayScale | KGraphics | Makes a grayscale representation of the given color.
ComboKeyPreview | KGrids | Obsolete function. Call TKCustomGrid.DefaultComboKeyPreview instead.
ComboSelect | KGrids | Obsolete function. Call TKCustomGrid.DefaultComboSelect instead.
CompareAxisItems | KGrids | Compares two TKGridAxisItems arrays. The function returns True if the arrays are equal in length and all corresponding TKGridAxisItem instances within both arrays have equal property values.
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.
cOptionsDef | KGrids | Default value for the Options property.
cOptionsExDef | KGrids | Default value for the OptionsEx 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.
cRangeSelectStyleDef | KGrids | Default value for the RangeSelectStyle property.
crDragHandFree | KFunctions | Constant for uncaptured dragging cursor.
crDragHandGrip | KFunctions | Constant for captured dragging cursor.
CreateAlphaBitmapFromResIcon | KIcon | Creates an alpha bitmap from an icon object stored in application resources.
CreateBitmapFromResIcon | KIcon | Creates a bitmap from an icon object stored in application resources.
CreateEmptyRgn | KGraphics | Creates an empty rectangular region.
crHResize | KFunctions | Constant for horizontal resize cursor.
cRowCountDef | KGrids | Default value for the RowCount property.
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
cScrollBarsDef | KGrids | Default value for the ScrollBars property.
cScrollDelta | KControls | Constant for control scrollbars. It means: Use given Delta to update scrollbar.
cScrollModeDef | KGrids | Default value for the ScrollModeHorz and ScrollModeVert properties.
cScrollNoAction | KControls | Constant for control scrollbars. It means: Leave that scrollbar untouched.
cScrollSpeedDef | KHexEditor | Default value for the ScrollSpeed property
cScrollSpeedDef | KGrids | Default value for the ScrollSpeed property.
cScrollSpeedMax | KGrids | Maximum value for the ScrollSpeed property.
cScrollSpeedMax | KHexEditor | Maximum for the ScrollSpeed property
cScrollSpeedMin | KHexEditor | Minimum for the ScrollSpeed property
cScrollSpeedMin | KGrids | Minimum value 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.
cSelectedCellBkGndDef | KGrids | Default value for the SelectedCellBkGnd color property.
cSelectedCellTextDef | KGrids | Default value for the SelectedCellText color property.
cSelectedFixedCellBkGndDef | KGrids | Default value for then TKGridColors.SelectedFixedCell color property.
cSelectedRangeBkGndDef | KGrids | Default value for the SelectedRangeBkGnd color property.
cSelectedRangeTextDef | KGrids | Default value for the SelectedRangeText 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
cSizingStyleDef | KGrids | Default value for the SizingStyle property.
cSortStyleDef | KGrids | Default value for the SortStyle 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.
DefaultDrawCell | KGrids | Obsolete function. Implements default painting for TKCustomGrid cells. Call TKCustomGrid.CellPainter.DefaultDraw instead.
DefaultKeyPreview | KGrids | Obsolete function. Call TKCustomGrid.DefaultEditorKeyPreview instead.
DefaultSelect | KGrids | Obsolete function. Call TKCustomGrid.DefaultEditorSelect instead.
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.
EditKeyPreview | KGrids | Obsolete function. Call TKCustomGrid.DefaultEditKeyPreview instead.
EditSelect | KGrids | Obsolete function. Call TKCustomGrid.DefaultEditSelect instead.
Error | KFunctions | Raises a general exception with associated message Msg.
Exchange | KFunctions | Swaps values of two Cardinal variables.
Exchange | KFunctions | Swaps values of two Double variables.
Exchange | KFunctions | Swaps values of two Integer variables.
Exchange | KFunctions | Swaps values of two Single variables.
Exchange | KFunctions | Swaps values of two Char variables.
Exchange | KFunctions | Swaps values of two Word variables.
Exchange | KFunctions | Swaps values of two ShortInt variables.
Exchange | KFunctions | Swaps values of two Int64 variables.
Exchange | KFunctions | Swaps values of two Extended variables.
Exchange | KFunctions | Swaps values of two SmallInt variables.
Exchange | KFunctions | Swaps values of two Byte 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.
GetModuleIconCount | KIcon | Returns the total number of HW-independent icon resources in a module identified by ModuleName.
GetModuleIconCount | KIcon | Returns the total number of HW-independent icon resources in a module identified by Instance.
GetModuleResourceCount | KIcon | Returns the total number of resources of a type specified by ResType in a module identified by Instance.
GetShiftState | KFunctions | Returns current status of Shift, Alt and Ctrl keys.
GetWindowsFolder KFunctions
GridPoint | KGrids | Makes a TKGridCoord record from ACol and ARow.
GridRect | KGrids | Makes a TKGridRect record from ACell. Cell will be copied both to Cell1 and Cell2 fields of the resulting grid rectangle.
GridRect | KGrids | Makes a TKGridRect record from ACol1, ARow1, ACol2 and ARow2. All the input parameters will be copied to the corresponding fields of the resulting grid rectangle.
GridRect | KGrids | Makes a TKGridRect record from ACell1 and ACell2. All the input parameters will be copied to the corresponding fields of the resulting grid rectangle.
GridRectEqual | KGrids | Compares two grid rectangles. Returns True if all the corresponding fields in GridRect1 equal those in GridRect2.
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.
MakeCellSpan | KGrids | Makes a TKGridCellSpan record from AColumns and ARows.
MakeColorRec | KGraphics | Builds a TKColorRec structure.
MakeHandles | KIcon | Returns the str1ucture containing hXOR and hAND bitmaps.
MakeSelection | KHexEditor | Creates a selection structure from given Index and Digit parameters
MinMax | KFunctions | Returns a clipped Single 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 Double 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 ShortInt 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
MNGHeader KGraphics
NormalizeGridRect | KGrids | Makes Cell1 field of GridRect always top-left cell and Cell2 field always bottom-right cell.
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.
PKCursorHotSpot | KIcon | Pointer to the cursor hot spot structure
PKHexEditorChangeItem | KHexEditor | Pointer to TKHexEditorChangeItem
PKIconCursorDirEntry | KIcon | Pointer to the icon/cursor directory entry
PKIconCursorDirEntryInRes | KIcon | Pointer to the icon/cursor resource file directory entry
PKIconCursorInRes | KIcon | Pointer to the helper structure
PKIconData | KIcon | Pointer to the internal image description structure
PKIconHeader | KIcon | Pointer to the icon file header structure
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.
RegisterKIcon | KIcon | Integrates KIcon into TPicture.
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
RowInGridRect | KGrids | Determines if the grid rectangle contains a subset of cells belonging to the row specified by ARow.
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.
ScrollBarKeyPreview | KGrids | Obsolete function. Call TKCustomGrid.DefaultScrollBarKeyPreview instead.
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.
TIcon | KIcon | This class is necessary because of the TPicture streaming.
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.
TKCursorDir | KIcon | Helper structure for cursor specific data in resource file
TKCursorHotSpot | KIcon | Helper structure to typecast cursor hot spot coordinates
TKCustomControl | KControls | Base class for all visible controls in KControls.
TKCustomDBGrid | KDBGrids | KGrid data aware base component
TKCustomGrid | KGrids | KGrid base component
TKCustomHexEditor | KHexEditor | Hexadecimal editor base component
TKDBCustomGrid | KDBGrids | For backward compatibility.
TKDBGrid | KDBGrids | KDBGrid design-time component
TKDBGridCell | KDBGrids | Base cell class for TKDBGrid
TKDBGridCellPainter | KDBGrids | Cell painter class used by TKCustomDBGrid class
TKDBGridCol | KDBGrids | Column class for TKCustomDBGrid
TKDBGridColClass | KDBGrids | Metaclass for TKDBGridCol
TKDBGridColors | KDBGrids | Container for all colors used by TKCustomDBGrid class
TKDBGridDataLink | KDBGrids | Data link override for TKCustomDBGrid
TKDBGridOption | KDBGrids | Declares possible values for the DBOptions property.
TKDBGridOptions | KDBGrids | Set type for TKDBGridOption enumeration.
TKDragWindow | KGraphics | Encapsulates the drag window
TKDynColorRecs | KGraphics | Dynamic array for TKColorRec.
TKGraphicHint KGraphics
TKGrid | KGrids | KGrid design-time component
TKGridAttrTextCell | KGrids | Class for a textual cell with custom appearance
TKGridAxisInfo | KGrids | Declares a structure returned by the GetAxisInfoHorz or GetAxisInfoVert functions
TKGridAxisInfoBoth | KGrids | Declares a structure returned by the GetAxisInfoBoth function
TKGridAxisInfoMask | KGrids | Set type for TKGridAxisInfoMaskMembers enumeration.
TKGridAxisInfoMaskMembers | KGrids | Declares possible values for the Mask parameter in the GetAxisInfoHorz or GetAxisInfoVert functions.
TKGridAxisItem | KGrids | Base class to store column or row properties
TKGridAxisItemClass | KGrids | Metaclass for TKGridAxisItem
TKGridAxisItems | KGrids | Dynamic array type to store TKGridAxisItem instances
TKGridAxisUpdateFlag | KGrids | Declares possible values for the Flags parameter in the UpdateAxes method.
TKGridAxisUpdateFlags | KGrids | Set type for TKGridAxisUpdateFlags enumeration.
TKGridBeginDragEvent | KGrids | Declares event handler e.g. for the OnBeginColDrag event
TKGridBeginSizingEvent | KGrids | Declares event handler e.g. for the OnBeginColSizing event
TKGridCanResizeFunc | KGrids | Method type for the CanResize field in the TKGridAxisInfo structure.
TKGridCaptureState | KGrids | Declares possible values for the State parameter in the SuggestDrag or SuggestSizing functions.
TKGridCell | KGrids | Base class to store cell properties
TKGridCellClass | KGrids | Metaclass for TKGridCell
TKGridCellEvent | KGrids | Declares event handler for any cell notification events
TKGridCellHintEvent | KGrids | Declares event handler for the OnMouseCellHint event
TKGridCellPainter | KGrids | Wrapper for a versatile and easily extensible cell painting engine
TKGridCellPainterClass | KGrids | Metaclass for TKGridCellPainter
TKGridCellRow | KGrids | Dynamic array type to store row of TKGridCell instances
TKGridCells | KGrids | Dynamic array type to store the entire grid of TKGridCell instances
TKGridCellSpan | KGrids | Declares a structure that holds both column and row span of a cell
TKGridCellSpanEvent | KGrids | Declares event handler for the OnCellSpan event
TKGridCheckDragEvent | KGrids | Declares event handler e.g. for the OnCheckColDrag event
TKGridCol | KGrids | Class to store column properties
TKGridColClass | KGrids | Metaclass for TKGridCol
TKGridColorIndex | KGrids | Declares possible indexes e.g. for the Color property.
TKGridColors | KGrids | Container for all colors used by TKCustomGrid class
TKGridColorScheme | KGrids | Declares possible values for the ColorScheme property.
TKGridCompareCellInstancesEvent | KGrids | Declares event handler for the OnCompareCellInstances
TKGridCompareCellsEvent | KGrids | Declares event handler for the OnCompareCells
TKGridCompareProc | KGrids | Method type for the Compare parameter e.g. in the InternalQuickSortNR method.
TKGridCoord | KGrids | Declares a structure that hold both column and row index of a cell
TKGridCustomSortEvent | KGrids | Declares event handler for the OnCustomSortCols or OnCustomSortRows events
TKGridDisabledDrawStyle | KGrids | Declares possible values for the DisabledDrawStyle property.
TKGridDragStyle | KGrids | Declares possible values for the DragStyle property.
TKGridDrawCellEvent | KGrids | Declares event handler e.g. for the OnDrawCell event
TKGridDrawState | KGrids | Set type for TKGridDrawStateMembers enumeration.
TKGridDrawStateMembers | KGrids | Declares possible values for the State parameter in the TKGridDrawCellEvent event handler or DrawCell method.
TKGridEditorCreateEvent | KGrids | Declares event handler for the OnEditorCreate event
TKGridEditorDataEvent | KGrids | Declares event handler for the OnEditorDataFromGrid or OnEditorDataToGrid events
TKGridEditorDestroyEvent | KGrids | Declares event handler for the OnEditorDestroy event
TKGridEditorKeyPreviewEvent | KGrids | Declares event handler for the OnEditorKeyPreview event
TKGridEditorResizeEvent | KGrids | Declares event handler for the OnEditorResize event
TKGridEditorSelectEvent | KGrids | Declares event handler for the OnEditorSelect event
TKGridEditorTransparency | KGrids | Declares possible values for the EditorTransparency property.
TKGridEndDragEvent | KGrids | Declares event handler e.g. for the OnEndColDrag event
TKGridEndSizingEvent | KGrids | Declares event handler e.g. for the OnEndColSizing event
TKGridExchangeEvent | KGrids | Declares event handler for the OnExchangeCols or OnExchangeRows event
TKGridExchangeProc | KGrids | Method type for the Exchange parameter e.g. in the InternalQuickSortNR method.
TKGridExtentEvent | KGrids | Declares event handler for any cell extent notification events
TKGridGetExtentFunc | KGrids | Method type for the CellExtent field in the TKGridAxisInfo structure.
TKGridHCIBitmaps | KGrids | Declares a structure for hidden cell indicator glyphs.
TKGridInvisibleCells | KGrids | Declares possible values for the InvisibleCells parameter in the PointToCell method.
TKGridMeasureCellEvent | KGrids | Declares event handler e.g. for the OnMeasureCell event
TKGridMeasureCellPriority | KGrids | Declares possible values for the Priority parameter in the MeasureCell method.
TKGridMoveCommand | KGrids | Declares possible values for the Command parameter in the InternalMove method.
TKGridMovedEvent | KGrids | Declares event handler for the OnColumnMoved or OnRowMoved events
TKGridMoveDirection | KGrids | Declares possible values for the MoveDirection property.
TKGridObjectCell | KGrids | Class for an object cell
TKGridOption | KGrids | Declares possible values for the Options property.
TKGridOptionEx | KGrids | Declares possible values for the OptionsEx property.
TKGridOptions | KGrids | Set type for TKGridOption enumeration.
TKGridOptionsEx | KGrids | Set type for TKGridOptionEx enumeration.
TKGridRangeSelectStyle | KGrids | Declares possible values for the RangeSelectStyle property.
TKGridRect | KGrids | Declares the type e.g. for the Selection property
TKGridRow | KGrids | Class to store row properties
TKGridRowClass | KGrids | Metaclass for TKGridRow
TKGridScrollMode | KGrids | Declares possible values for the ScrollModeHorz and ScrollModeVert properties.
TKGridSelectCellEvent | KGrids | Declares event handler for the OnSelectCell event
TKGridSelectionExpandEvent | KGrids | Declares event handler for the OnSelectCell event
TKGridSelectionFlag | KGrids | Declares possible values for the Flags parameter in the SelectionMove method.
TKGridSelectionFlags | KGrids | Set type for TKGridSelectionFlag enumeration.
TKGridSelectionStage | KGrids | Declares possible values for the Stage parameter in the TKGridSelectionExpandEvent event handler or SelectionMove method.
TKGridSizeChange | KGrids | Declares possible values for the Change parameter in the TKGridSizeChangedEvent event handler.
TKGridSizeChangedEvent | KGrids | Declares event handler for the OnSizeChanged event
TKGridSizingStyle | KGrids | Declares possible values for the SizingStyle property.
TKGridSortMode | KGrids | Declares possible values for the SortMode property.
TKGridSortStyle | KGrids | Declares possible values for the SortStyle property.
TKGridState | KGrids | Declares possible values for the FGridState field.
TKGridTextCell | KGrids | Class for simple textual cell
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
TKIcon | KIcon | KIcon main class.
TKIconAlignStyle | KIcon | Controls how the image should be aligned when they are beeing resized
TKIconCursorDirEntry | KIcon | Icon/cursor directory entry. This structure decribes each icon/cursor image. These structures describing all images immediately follow the TKIconHeader structure in the icon file. After these the bitmap data for all images are stored (TBitmapInfoHeader, palette data, bitmap bits - XOR, AND).
TKIconCursorDirEntryInRes | KIcon | Icon/cursor directory entry as found in resource files
TKIconCursorDirInfo | KIcon | Helper structure identifying attributes that are different for icons and cursors
TKIconCursorInfo | KIcon | Helper structure merging icon and cursor specific data
TKIconCursorInRes | KIcon | Helper structure to access resource data
TKIconData | KIcon | Represents the internal data structure describing each icon/cursor image
TKIconDimension | KIcon | Specifies the width and height of an icon or cursor image
TKIconDrawStyle | KIcon | Specifies how the icon image(s) should be rendered. This feature can be used along with the MaskFromColor method to implement a ‘color picker’ for a new mask construction.
TKIconHandles | KIcon | Specifies the GDI handles for one icon/cursor image
TKIconHeader | KIcon | Icon file header
TKIconResdir | KIcon | Helper structure for icon specific data in resource file
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. New text length is returned by ALen.
TrimWhiteSpaces | KFunctions | Trims characters specified by ASet from the beginning and end of AText.
TShortInts | KFunctions | Static array for ShortInt.
TSingles | KFunctions | Static array for Single.
TSmallInts | KFunctions | Static array for SmallInt.
TUpdateLayeredWindowProc KGraphics
TWords | KFunctions | Static array for Word.
UnregisterKIcon | KIcon | Removes KIcon from TPicture.
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.


KControls help: Legend

Legend

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