This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ Saving from TMemo.Lines does not honor the TrailingLineBreak option of | |
TStrings. } | |
procedure TfSavingMemoLines.aSaveLinesExecute(Sender: TObject); | |
var | |
LMode: Word; // in case we need to create the file | |
LFileStream: TFileStream; // handle the writing | |
begin | |
if not FileExists(LogFileName) then // test for file exists | |
LMode := fmCreate // not present need to create |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE EXTERNAL FUNCTION GUIDFROMANSI | |
CHAR(38) CHARACTER SET ISO8859_1 | |
RETURNS CHAR(16) CHARACTER SET OCTETS FREE_IT | |
ENTRY_POINT 'GUIDfromANSI' MODULE_NAME 'UtilGUID'; | |
DECLARE EXTERNAL FUNCTION GUIDTOANSI | |
CHAR(16) CHARACTER SET OCTETS | |
RETURNS CHAR(38) CHARACTER SET ISO8859_1 FREE_IT | |
ENTRY_POINT 'GUIDtoANSI' MODULE_NAME 'UtilGUID'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Domain definitions */ | |
CREATE DOMAIN ENTITYNAME AS VARCHAR(36) CHARACTER SET UTF8 NOT NULL; | |
CREATE DOMAIN ENTRYINACTIVE AS BOOLEAN | |
DEFAULT False NOT NULL; | |
CREATE DOMAIN ID_GUID AS CHAR(16) CHARACTER SET OCTETS NOT NULL; | |
/* Table: CM_CLIENTMASTER, Owner: SYSDBA */ | |
CREATE TABLE CM_CLIENTMASTER | |
( | |
CM_ID ID_GUID NOT NULL, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TUDFUtil = class | |
private | |
protected | |
class procedure BinToHex(var ASource, ATarget: IBDataArray; const ASourceByteCount: integer; var ASourceOffset: integer; var ATargetOffset: integer); | |
// Binary to Hexadecimal control routine | |
class procedure HexToBin(var ASource, ATarget: IBDataArray; const ATargetByteCount: integer; var ASourceOffset: integer; var ATargetOffset: integer); | |
// Hexadecimal to Binary control routine | |
public | |
class procedure GUIDtoANSI(var ASource, ATarget: IBDataArray); // from 128-bit number to formatted hexadecimal | |
class procedure ANSItoGUID(var ASource, ATarget: IBDataArray); // from formatted hexadecimal to 128-bit number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PGUID = ^TGUID; | |
TGUID = record | |
D1: Cardinal; | |
D2: Word; | |
D3: Word; | |
D4: array[0..7] of Byte; | |
end; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program AutoFreeTest; | |
{$APPTYPE CONSOLE} | |
{$R *.res} | |
uses | |
System.SysUtils, | |
System.Classes; | |
type | |
IAutoFree = interface |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure TVLBO.FormCreate(Sender: TObject); | |
begin | |
MDLBO := TMDLBO.MDLBOGet; | |
end; | |
procedure TVLBO.FormDestroy(Sender: TObject); | |
begin | |
MDLBO.Free; | |
end; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ When the Adapter Bind Source for Branches is created, this event handler creates the | |
necessry BranchListBSWrapper and passes it back to the Bind Source Adapter. } | |
procedure TMDLBO.absBranchesCreateAdapter( | |
Sender: TObject; | |
var ABindSourceAdapter: TBindSourceAdapter); | |
begin | |
{ Begin by creating the BranchWrapper and saving it in the current form } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ When the Branch list changes, either because of a scroll, or add or delete, this routine adjusts the | |
Employee list to display the appropriate employees } | |
procedure TMDLBO.AfterBranchScroll(ABindSourceAdapter: TBindSourceAdapter); | |
var | |
LBranch: TBranch; // currently displayed Branch | |
begin | |
{ A series of casts extracts the current TBranch object being displayed } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ These Type Aliases accomplish two things: | |
1. They eliminate the need to key the cumbersome generic notation every time the type is used | |
2. They provide meaningful names in place of confusing names used by Live Bindings } | |
CorpObjectBSWrapper = TObjectBindSourceAdapter<TCorp>; // the corporate object wrapper | |
BranchListBSWrapper = TListBindSourceAdapter<TBranch>; // the branch object list wrapper | |
EmployeeListBSWrapper = TListBindSourceAdapter<TEmployee>; // the employee object list wrapper |
NewerOlder