(*********************************************************
* Author : Crome969
* Unit : UOProperty
* Languange : Pascal Script
* Version : 1.0
*********************************************************
Version 1.0 : Finished Work for BaseComponents
*********************************************************)
unit UOProperty;
interface
Type
TSuperPropertyEntry = record
ClilocID : Cardinal;
ClilocText : string;
Params : array of Variant;
end;
TSuperProperty = record
Entries: array of TSuperPropertyEntry;
Count: Integer;
Timestamp: TDateTime;
end;
function GetProperty(ObjID: Cardinal; var ToolTip: string): Boolean;
function GetPropertyEx(ObjID: Cardinal; var ToolTip: TClilocRec): Boolean;
function GetSuperProperty(ClilocToolTip: TClilocRec; var ToolTip: TSuperProperty): Boolean;
function GetSuperPropertyEx(ObjID: Cardinal; var ToolTip: TSuperProperty): Boolean;
Function GetEntry(ToolTip: TSuperProperty;ClilocID:Cardinal;var Entry : TSuperPropertyEntry):Boolean;
implementation
function GetProperty(ObjID: Cardinal; var ToolTip: string): Boolean;
begin
ToolTip := GetTooltip(ObjID);
Result := (Trim(ToolTip) <> '');
end;
function GetPropertyEx(ObjID: Cardinal; var ToolTip: TClilocRec): Boolean;
begin
ToolTip := GetToolTipRec(ObjID);
Result := (ToolTip.Count > 0);
end;
function GetSuperProperty(ClilocToolTip: TClilocRec; var ToolTip: TSuperProperty): Boolean;
var
SubProperty: TClilocItemRec;
a: Integer;
b: Integer;
SubEntry: TSuperPropertyEntry;
StubEntry: TSuperPropertyEntry;
begin
ToolTip.Count := ClilocToolTip.Count;
SetLength(ToolTip.Entries, 0);
StubEntry.ClilocID := 0;
StubEntry.ClilocText := '';
SetLength(StubEntry.Params, 0);
SetLength(ToolTip.Entries, ToolTip.Count);
for a := 0 to (ToolTip.Count - 1) do
begin
SubEntry := StubEntry;
SubProperty := ClilocToolTip.Items[a];
SubEntry.ClilocID := SubProperty.ClilocID;
SubEntry.ClilocText := GetClilocByID(SubEntry.ClilocID);
SetLength(SubEntry.Params, Length(SubProperty.Params));
for b := 0 to (Length(SubProperty.Params) - 1) do
begin
SubEntry.Params[b] := SubProperty.Params[b];
end;
ToolTip.Entries[a] := SubEntry;
end;
ToolTip.Timestamp := Now;
Result := (ToolTip.Count > 0);
end;
function GetSuperPropertyEx(ObjID: Cardinal; var ToolTip: TSuperProperty): Boolean;
var
SuperStub: TSuperProperty;
Stub: TClilocRec;
begin
ToolTip := SuperStub;
if (GetPropertyEx(ObjID, Stub)) then
begin
GetSuperProperty(Stub, ToolTip);
end;
Result := (ToolTip.Count > 0);
end;
Function GetEntry(ToolTip: TSuperProperty;ClilocID:Cardinal;var Entry : TSuperPropertyEntry):Boolean;
var
fStub : TSuperPropertyEntry;
fIndex : Integer;
begin
Result := False;
Entry := fStub;
for fIndex := 0 to Length(ToolTip.Entries) - 1 do
begin
if (ToolTip.Entries[fIndex].ClilocID = ClilocID) then
begin
Entry := ToolTip.Entries[fIndex];
Result := True;
Exit;
end;
end;
end;
end.