Class TSetsMatch (unit SetMatch)

Inherits from

TCustomControl

Constructors


constructor Create(AOwner:TComponent);

Public declarations

-----------------------------------------------------------------------------



Functions

procedure AutoListMatch;


destructor Destroy;


function GetHighlightCoor(HighlightNumber:integer):TPoint;


function GetPartner(HighlightNumber:integer):integer;

Returns Coor of Highlight point {+HighlightNumber - left, -HighlightNumber-right

function GetYCenter(ItemNo:integer; PCoor:TList):integer;

Clear assignment for initial point

procedure InvertBox(ItemNo:integer; LBox:TListBox);

Re-dimension array if necessary

function ItemFromPoint(MousePoint:TPoint):integer;

Right point search

procedure Paint;

Protected declarations

procedure DeleteItem(ItemNo:integer; IsLeft:boolean);


procedure DrawRect(Canvas:TCanvas; Rect:TRect);


function GetMatch(index:cardinal):integer;


function GetMatchCount:integer;


procedure HookLeft;

Utility functions

procedure HookRight;


procedure HookWndProcLeft(var Message: TMessage);


procedure HookWndProcRight(var Message: TMessage);


procedure InsertItem(BeforeIndex:integer; IsLeft:boolean);

Matching - list box is started from zero index

procedure ProcessHighlight(MousePoint:TPoint);

Returns highlight number from point

procedure RecalculateCoordinates(LBox:TListBox; Coor:TList);


procedure SetLeft(Value:TListBox);

if FLastHighlight>0 then InvertBox(FLastHighlight-1,FLeftList);

procedure SetMatch(index:cardinal; Value:integer);


procedure SetRight(Value:TListBox);

if FLastHighlight>0 then InvertBox(FLastHighlight-1,FRightList);

procedure UnhookLeft;


procedure UnhookRight;


procedure WMLButtonDown(var Message:TWMLButtonDown);

External counter 0.

procedure WMLButtonUp(var Message:TWMLButtonUp);


procedure WMMouseMove(var Message:TWMMouseMove);


Properties

property Color :


property DragNotify : TDragNotifyEvent

Published declarations

property LeftList : TListBox


property RightList : TListBox


property Match : integer


property MatchCount : integer


Events

Variables

CoupledPairs : TList;


FCanDrop : boolean;


FDragging : boolean;


FDragNotify : TDragNotifyEvent;


FDragPoint : TPoint;


FLastHighlight : integer;


FLeftList : TListBox;


FLeftParentCoor : TList;

Private declarations

FPartnerStoreNumber : integer;


FRightList : TListBox;


FRightParentCoor : TList;


FStartDragPoint : TPoint;


NewWndProcLeft : Pointer;


NewWndProcRight : Pointer;


OldWndProcLeft : TFarProc;


OldWndProcRight : TFarProc;



Constructors


constructor Create(AOwner:TComponent);

Public declarations

-----------------------------------------------------------------------------


Functions


procedure AutoListMatch;


destructor Destroy;


function GetHighlightCoor(HighlightNumber:integer):TPoint;


function GetPartner(HighlightNumber:integer):integer;

Returns Coor of Highlight point {+HighlightNumber - left, -HighlightNumber-right


function GetYCenter(ItemNo:integer; PCoor:TList):integer;

Clear assignment for initial point


procedure InvertBox(ItemNo:integer; LBox:TListBox);

Re-dimension array if necessary


function ItemFromPoint(MousePoint:TPoint):integer;

Right point search


procedure Paint;

Protected declarations


procedure DeleteItem(ItemNo:integer; IsLeft:boolean);


procedure DrawRect(Canvas:TCanvas; Rect:TRect);


function GetMatch(index:cardinal):integer;


function GetMatchCount:integer;


procedure HookLeft;

Utility functions


procedure HookRight;


procedure HookWndProcLeft(var Message: TMessage);


procedure HookWndProcRight(var Message: TMessage);


procedure InsertItem(BeforeIndex:integer; IsLeft:boolean);

Matching - list box is started from zero index


procedure ProcessHighlight(MousePoint:TPoint);

Returns highlight number from point


procedure RecalculateCoordinates(LBox:TListBox; Coor:TList);


procedure SetLeft(Value:TListBox);

if FLastHighlight>0 then InvertBox(FLastHighlight-1,FLeftList);


procedure SetMatch(index:cardinal; Value:integer);


procedure SetRight(Value:TListBox);

if FLastHighlight>0 then InvertBox(FLastHighlight-1,FRightList);


procedure UnhookLeft;


procedure UnhookRight;


procedure WMLButtonDown(var Message:TWMLButtonDown);

External counter 0..Count-1


procedure WMLButtonUp(var Message:TWMLButtonUp);


procedure WMMouseMove(var Message:TWMMouseMove);


Properties


property Color :


property DragNotify : TDragNotifyEvent

Published declarations


property LeftList : TListBox


property RightList : TListBox


property Match : integer


property MatchCount : integer


Events


Variables


CoupledPairs : TList;


FCanDrop : boolean;


FDragging : boolean;


FDragNotify : TDragNotifyEvent;


FDragPoint : TPoint;


FLastHighlight : integer;


FLeftList : TListBox;


FLeftParentCoor : TList;

Private declarations


FPartnerStoreNumber : integer;


FRightList : TListBox;


FRightParentCoor : TList;


FStartDragPoint : TPoint;


NewWndProcLeft : Pointer;


NewWndProcRight : Pointer;


OldWndProcLeft : TFarProc;


OldWndProcRight : TFarProc;