Delphi 7.0 Windows XP 2 で Mike Lischke による TVirtualStringTree (バージョン 4.8.7) をテストしました。正常に動作します。同じ TVirtualStringTree (v.4.8.7) を別のマシン (Delphi 7.0 Windows XP 3 システム) にインストールし、同じプロジェクトを Windows XP 3 システムでテストしました。ヘッダーをクリックすると、エラーが表示されました。Delphi 7.0 Windows XP 3 から TVirtualStringTree (バージョン 4.8.7) を削除し、より新しいバージョンの TVirtualStringTree (バージョン 5.3.0) を Windows XP 3 にインストールしました。同じ問題がまだ存在していました。
Windows XP 3 でプロジェクトをビルドすると、以下のプロンプトが表示されました。
The vtHeaderClick method referenced by vt.Onheaderclick has an incompatible parameter list. Remove the reference?
[いいえ] をクリックして、テスト プログラムを実行しました。ヘッダーをクリックすると、「... でのアクセス違反」というメッセージが表示されました。
そして、それは以下のエラーを促しました:
function TVTHeader.HandleMessage(var Message: TMessage): Boolean;
// The header gets here the opportunity to handle certain messages before they reach the tree. This is important
// because the tree needs to handle various non-client area messages for the header as well as some dragging/tracking
// events.
// By returning True the message will not be handled further, otherwise the message is then dispatched
// to the proper message handlers.
var
P: TPoint;
R: TRect;
I: TColumnIndex;
OldPosition: Integer;
HitIndex: TColumnIndex;
NewCursor: HCURSOR;
Button: TMouseButton;
Menu: TPopupMenu;
IsInHeader,
IsHSplitterHit,
IsVSplitterHit: Boolean;
//--------------- local function --------------------------------------------
function HSPlitterHit: Boolean;
var
NextCol: TColumnIndex;
......
......
case Message.Msg of
WM_LBUTTONUP:
with TWMLButtonUp(Message) do
begin
if FColumns.FDownIndex > NoColumn then
FColumns.HandleClick(Point(XPos, YPos), mbLeft, False, False);
if FStates <> [] then // this line is highlighted
FOwner.DoHeaderMouseUp(mbLeft, KeysToShiftState(Keys), XPos, YPos);
end;
WM_NCLBUTTONUP:
with TWMNCLButtonUp(Message) do
begin
......
......
どうすればこれを解決できますか?