mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 21:01:14 +02:00
MG: fixed update bottomitem on wmsize
git-svn-id: trunk@1477 -
This commit is contained in:
parent
8e4ae5f28d
commit
64825ceb38
@ -26,8 +26,8 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLLinux, Forms, Controls, Buttons, StdCtrls, ComCtrls,
|
||||
ExtCtrls, Menus, LResources, Graphics, ImgList, SynEdit, DefineTemplates,
|
||||
CodeToolManager, CodeToolsOptions;
|
||||
ExtCtrls, Menus, LResources, Graphics, Dialogs, ImgList, SynEdit,
|
||||
DefineTemplates, CodeToolManager, CodeToolsOptions;
|
||||
|
||||
type
|
||||
TCodeToolsDefinesEditor = class(TForm)
|
||||
@ -111,6 +111,7 @@ type
|
||||
procedure DeleteFilePathBitBtnClick(Sender: TObject);
|
||||
procedure InsertFilePathBitBtnClick(Sender: TObject);
|
||||
procedure InsertNodeMenuItemClick(Sender: TObject);
|
||||
procedure ProjectSpecificCheckBoxClick(Sender: TObject);
|
||||
private
|
||||
FDefineTree: TDefineTree;
|
||||
FLastSelectedNode: TTreeNode;
|
||||
@ -119,10 +120,11 @@ type
|
||||
procedure RebuildDefineTreeView;
|
||||
procedure AddDefineNodes(ANode: TDefineTemplate; AParent: TTreeNode;
|
||||
WithChilds,WithNextSiblings: boolean);
|
||||
procedure SetNodeImages(ANode: TTreeNode);
|
||||
procedure SetNodeImages(ANode: TTreeNode; WithSubNodes: boolean);
|
||||
procedure ValueAsPathToValueAsText;
|
||||
procedure SaveSelectedValues;
|
||||
procedure SaveSelectedValues(ATreeNode: TTreeNode);
|
||||
procedure ShowSelectedValues;
|
||||
procedure SetTypeLabel;
|
||||
function ValueToFilePathText(const AValue: string): string;
|
||||
procedure InsertNewNode(Behind: boolean; Action: TDefineAction);
|
||||
public
|
||||
@ -293,8 +295,8 @@ procedure TCodeToolsDefinesEditor.MoveFilePathUpBitBtnClick(Sender: TObject);
|
||||
var y: integer;
|
||||
begin
|
||||
if ValueAsFilePathsSynEdit.ReadOnly then exit;
|
||||
y:=ValueAsFilePathsSynEdit.CaretY;
|
||||
if (y>1) and (y<=ValueAsFilePathsSynEdit.Lines.Count) then
|
||||
y:=ValueAsFilePathsSynEdit.CaretY-1;
|
||||
if (y>0) and (y<ValueAsFilePathsSynEdit.Lines.Count) then
|
||||
ValueAsFilePathsSynEdit.Lines.Move(y,y-1);
|
||||
end;
|
||||
|
||||
@ -302,8 +304,8 @@ procedure TCodeToolsDefinesEditor.MoveFilePathDownBitBtnClick(Sender: TObject);
|
||||
var y: integer;
|
||||
begin
|
||||
if ValueAsFilePathsSynEdit.ReadOnly then exit;
|
||||
y:=ValueAsFilePathsSynEdit.CaretY;
|
||||
if (y>=1) and (y<ValueAsFilePathsSynEdit.Lines.Count) then
|
||||
y:=ValueAsFilePathsSynEdit.CaretY-1;
|
||||
if (y>=0) and (y<ValueAsFilePathsSynEdit.Lines.Count-1) then
|
||||
ValueAsFilePathsSynEdit.Lines.Move(y,y+1);
|
||||
end;
|
||||
|
||||
@ -311,8 +313,8 @@ procedure TCodeToolsDefinesEditor.DeleteFilePathBitBtnClick(Sender: TObject);
|
||||
var y: integer;
|
||||
begin
|
||||
if ValueAsFilePathsSynEdit.ReadOnly then exit;
|
||||
y:=ValueAsFilePathsSynEdit.CaretY;
|
||||
if (y>=1) and (y<=ValueAsFilePathsSynEdit.Lines.Count) then
|
||||
y:=ValueAsFilePathsSynEdit.CaretY-1;
|
||||
if (y>=0) and (y<ValueAsFilePathsSynEdit.Lines.Count) then
|
||||
ValueAsFilePathsSynEdit.Lines.Delete(y);
|
||||
end;
|
||||
|
||||
@ -320,8 +322,8 @@ procedure TCodeToolsDefinesEditor.InsertFilePathBitBtnClick(Sender: TObject);
|
||||
var y: integer;
|
||||
begin
|
||||
if ValueAsFilePathsSynEdit.ReadOnly then exit;
|
||||
y:=ValueAsFilePathsSynEdit.CaretY;
|
||||
if (y>=1) and (y<=ValueAsFilePathsSynEdit.Lines.Count) then
|
||||
y:=ValueAsFilePathsSynEdit.CaretY-1;
|
||||
if (y>=0) and (y<ValueAsFilePathsSynEdit.Lines.Count) then
|
||||
ValueAsFilePathsSynEdit.Lines.Insert(y,'');
|
||||
end;
|
||||
|
||||
@ -353,6 +355,25 @@ begin
|
||||
InsertNewNode(Behind,Action);
|
||||
end;
|
||||
|
||||
procedure TCodeToolsDefinesEditor.ProjectSpecificCheckBoxClick(Sender: TObject);
|
||||
var
|
||||
SelTreeNode: TTreeNode;
|
||||
SelDefNode: TDefineTemplate;
|
||||
begin
|
||||
if not SelectedItemGroupBox.Enabled then exit;
|
||||
SelTreeNode:=DefineTreeView.Selected;
|
||||
if SelTreeNode=nil then exit;
|
||||
SelDefNode:=TDefineTemplate(SelTreeNode.Data);
|
||||
if ProjectSpecificCheckBox.Checked=(dtfProjectSpecific in SelDefNode.Flags)
|
||||
then exit;
|
||||
if ProjectSpecificCheckBox.Checked then
|
||||
Include(SelDefNode.Flags,dtfProjectSpecific)
|
||||
else
|
||||
Exclude(SelDefNode.Flags,dtfProjectSpecific);
|
||||
SetNodeImages(SelTreeNode,true);
|
||||
SetTypeLabel;
|
||||
end;
|
||||
|
||||
procedure TCodeToolsDefinesEditor.CreateComponents;
|
||||
|
||||
procedure CreateWinControl(var AWinControl: TWinControl;
|
||||
@ -535,6 +556,7 @@ begin
|
||||
SelectedItemGroupBox);
|
||||
ProjectSpecificCheckBox.Caption:=
|
||||
'Node and its children are only valid for this project';
|
||||
ProjectSpecificCheckBox.OnClick:=@ProjectSpecificCheckBoxClick;
|
||||
|
||||
CreateWinControl(NameLabel,TLabel,'NameLabel',SelectedItemGroupBox);
|
||||
NameLabel.Caption:='Name:';
|
||||
@ -619,7 +641,7 @@ begin
|
||||
//writeln(' AAA ',StringOfChar(' ',ANode.Level*2),' ',ANode.Name,' ',WithChilds,',',WithNextSiblings);
|
||||
DefineTreeView.Items.BeginUpdate;
|
||||
NewTreeNode:=DefineTreeView.Items.AddChildObject(AParent,ANode.Name,ANode);
|
||||
SetNodeImages(NewTreeNode);
|
||||
SetNodeImages(NewTreeNode,false);
|
||||
if WithChilds and (ANode.FirstChild<>nil) then begin
|
||||
AddDefineNodes(ANode.FirstChild,NewTreeNode,true,true);
|
||||
end;
|
||||
@ -629,7 +651,8 @@ begin
|
||||
DefineTreeView.Items.EndUpdate;
|
||||
end;
|
||||
|
||||
procedure TCodeToolsDefinesEditor.SetNodeImages(ANode: TTreeNode);
|
||||
procedure TCodeToolsDefinesEditor.SetNodeImages(ANode: TTreeNode;
|
||||
WithSubNodes: boolean);
|
||||
var ADefineTemplate: TDefineTemplate;
|
||||
begin
|
||||
ADefineTemplate:=TDefineTemplate(ANode.Data);
|
||||
@ -648,17 +671,24 @@ begin
|
||||
ANode.ImageIndex:=-1;
|
||||
end;
|
||||
ANode.SelectedIndex:=ANode.ImageIndex;
|
||||
if dtfAutoGenerated in ADefineTemplate.Flags then begin
|
||||
if dtfProjectSpecific in ADefineTemplate.Flags then
|
||||
if ADefineTemplate.IsAutoGenerated then begin
|
||||
if ADefineTemplate.IsProjectSpecific then
|
||||
ANode.StateIndex:=13
|
||||
else
|
||||
ANode.StateIndex:=11;
|
||||
end else begin
|
||||
if dtfProjectSpecific in ADefineTemplate.Flags then
|
||||
if ADefineTemplate.IsProjectSpecific then
|
||||
ANode.StateIndex:=12
|
||||
else
|
||||
ANode.StateIndex:=10;
|
||||
end;
|
||||
if WithSubNodes then begin
|
||||
ANode:=ANode.GetFirstChild;
|
||||
while ANode<>nil do begin
|
||||
SetNodeImages(ANode,true);
|
||||
ANode:=ANode.GetNextSibling;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCodeToolsDefinesEditor.ValueAsPathToValueAsText;
|
||||
@ -694,22 +724,21 @@ begin
|
||||
ValueAsTextSynEdit.Text:=s;
|
||||
end;
|
||||
|
||||
procedure TCodeToolsDefinesEditor.SaveSelectedValues;
|
||||
procedure TCodeToolsDefinesEditor.SaveSelectedValues(ATreeNode: TTreeNode);
|
||||
var
|
||||
SelTreeNode: TTreeNode;
|
||||
SelDefNode: TDefineTemplate;
|
||||
ADefNode: TDefineTemplate;
|
||||
s: string;
|
||||
l: integer;
|
||||
begin
|
||||
SelTreeNode:=DefineTreeView.Selected;
|
||||
if (SelTreeNode<>nil) then begin
|
||||
SelDefNode:=TDefineTemplate(SelTreeNode.Data);
|
||||
if (not SelDefNode.IsAutoGenerated) then begin
|
||||
if (ATreeNode<>nil) then begin
|
||||
ADefNode:=TDefineTemplate(ATreeNode.Data);
|
||||
if (not ADefNode.IsAutoGenerated) then begin
|
||||
if ProjectSpecificCheckBox.Checked then
|
||||
Include(SelDefNode.Flags,dtfProjectSpecific);
|
||||
SelDefNode.Name:=NameEdit.Text;
|
||||
SelDefNode.Variable:=VariableEdit.Text;
|
||||
SelDefNode.Description:=DescriptionEdit.Text;
|
||||
Include(ADefNode.Flags,dtfProjectSpecific);
|
||||
ADefNode.Name:=NameEdit.Text;
|
||||
ATreeNode.Text:=ADefNode.Name;
|
||||
ADefNode.Variable:=VariableEdit.Text;
|
||||
ADefNode.Description:=DescriptionEdit.Text;
|
||||
s:=ValueAsTextSynEdit.Text;
|
||||
l:=length(s);
|
||||
if (l>0) and (s[l] in [#13,#10]) then begin
|
||||
@ -719,7 +748,7 @@ begin
|
||||
dec(l);
|
||||
SetLength(s,l);
|
||||
end;
|
||||
SelDefNode.Value:=s;
|
||||
ADefNode.Value:=s;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -728,21 +757,14 @@ procedure TCodeToolsDefinesEditor.ShowSelectedValues;
|
||||
var
|
||||
SelTreeNode: TTreeNode;
|
||||
SelDefNode: TDefineTemplate;
|
||||
s: string;
|
||||
begin
|
||||
SelTreeNode:=DefineTreeView.Selected;
|
||||
if SelTreeNode<>FLastSelectedNode then begin
|
||||
SaveSelectedValues;
|
||||
SaveSelectedValues(FLastSelectedNode);
|
||||
end;
|
||||
if SelTreeNode<>nil then begin
|
||||
SelDefNode:=TDefineTemplate(SelTreeNode.Data);
|
||||
SelectedItemGroupBox.Enabled:=true;
|
||||
s:='Action: '+DefineActionNames[SelDefNode.Action];
|
||||
if SelDefNode.IsAutoGenerated then
|
||||
s:=s+', auto generated';
|
||||
if SelDefNode.IsProjectSpecific then
|
||||
s:=s+', project specific';
|
||||
TypeLabel.Caption:=s;
|
||||
ProjectSpecificCheckBox.Checked:=dtfProjectSpecific in SelDefNode.Flags;
|
||||
NameEdit.Text:=SelDefNode.Name;
|
||||
DescriptionEdit.Text:=SelDefNode.Description;
|
||||
@ -760,17 +782,36 @@ begin
|
||||
ValueAsFilePathsSynEdit.ReadOnly:=ValueAsTextSynEdit.ReadOnly;
|
||||
end else begin
|
||||
SelectedItemGroupBox.Enabled:=false;
|
||||
TypeLabel.Caption:='none selected';
|
||||
ProjectSpecificCheckBox.Enabled:=false;
|
||||
NameEdit.Text:='';
|
||||
DescriptionEdit.Text:='';
|
||||
VariableEdit.Text:='';
|
||||
ValueAsTextSynEdit.Text:='';
|
||||
ValueAsFilePathsSynEdit.Text:='';
|
||||
end;
|
||||
SetTypeLabel;
|
||||
FLastSelectedNode:=SelTreeNode;
|
||||
end;
|
||||
|
||||
procedure TCodeToolsDefinesEditor.SetTypeLabel;
|
||||
var
|
||||
SelTreeNode: TTreeNode;
|
||||
SelDefNode: TDefineTemplate;
|
||||
s: string;
|
||||
begin
|
||||
SelTreeNode:=DefineTreeView.Selected;
|
||||
if SelTreeNode<>nil then begin
|
||||
SelDefNode:=TDefineTemplate(SelTreeNode.Data);
|
||||
s:='Action: '+DefineActionNames[SelDefNode.Action];
|
||||
if SelDefNode.IsAutoGenerated then
|
||||
s:=s+', auto generated';
|
||||
if SelDefNode.IsProjectSpecific then
|
||||
s:=s+', project specific';
|
||||
end else begin
|
||||
s:='none selected';
|
||||
end;
|
||||
TypeLabel.Caption:=s;
|
||||
end;
|
||||
|
||||
function TCodeToolsDefinesEditor.ValueToFilePathText(const AValue: string
|
||||
): string;
|
||||
var i: integer;
|
||||
@ -793,10 +834,11 @@ begin
|
||||
ParentNode:=nil;
|
||||
if SelTreeNode<>nil then begin
|
||||
// there is an selected node
|
||||
if Behind then
|
||||
if Behind then begin
|
||||
// insert behind selected node
|
||||
NodeInFront:=SelTreeNode
|
||||
else begin
|
||||
NodeInFront:=SelTreeNode;
|
||||
ParentNode:=NodeInFront.Parent;
|
||||
end else begin
|
||||
// insert as last child of selected node
|
||||
ParentNode:=SelTreeNode;
|
||||
NodeInFront:=ParentNode.GetFirstChild;
|
||||
@ -808,12 +850,15 @@ begin
|
||||
end else begin
|
||||
// no node selected, add as last root node
|
||||
NodeInFront:=DefineTreeView.Items.GetLastNode;
|
||||
if NodeInFront<>nil then begin
|
||||
while NodeInFront.GetNextSibling<>nil do
|
||||
NodeInFront:=NodeInFront.GetNextSibling;
|
||||
end;
|
||||
end;
|
||||
// find a unique name
|
||||
if (ParentNode<>nil) and (TDefineTemplate(ParentNode.Data).IsAutoGenerated)
|
||||
then begin
|
||||
MessageDlg('Invalid Parent','Auto created nodes can not be edited,'#13
|
||||
+'nor can they have non auto created child nodes.',mtInformation,[mbCancel]
|
||||
,0);
|
||||
exit;
|
||||
end;
|
||||
// find an unique name
|
||||
if ParentNode<>nil then
|
||||
FirstNode:=ParentNode.GetFirstChild
|
||||
else
|
||||
@ -839,15 +884,14 @@ begin
|
||||
NewDefNode:=TDefineTemplate.Create(NewName,NewDescription,NewVariable,
|
||||
NewValue,Action);
|
||||
// add node to treeview
|
||||
if ParentNode<>nil then
|
||||
// add as last child
|
||||
NewTreeNode:=DefineTreeView.Items.AddChildObject(ParentNode,NewName,
|
||||
NewDefNode)
|
||||
else if (NodeInFront<>nil) and (NodeInFront.GetNextSibling<>nil) then
|
||||
if (NodeInFront<>nil) then
|
||||
// insert in front
|
||||
NewTreeNode:=DefineTreeView.Items.InsertObjectBehind(
|
||||
NodeInFront,NewName,NewDefNode);
|
||||
SetNodeImages(NewTreeNode);
|
||||
NodeInFront,NewName,NewDefNode)
|
||||
else
|
||||
// add as last child
|
||||
NewTreeNode:=DefineTreeView.Items.AddChildObject(ParentNode,NewName,
|
||||
NewDefNode);
|
||||
|
||||
// add node to define tree
|
||||
if NodeInFront<>nil then
|
||||
@ -856,6 +900,9 @@ begin
|
||||
TDefineTemplate(ParentNode.Data).AddChild(NewDefNode)
|
||||
else
|
||||
FDefineTree.Add(NewDefNode);
|
||||
|
||||
SetNodeImages(NewTreeNode,true);
|
||||
DefineTreeView.Selected:=NewTreeNode;
|
||||
end;
|
||||
|
||||
procedure TCodeToolsDefinesEditor.Assign(ACodeToolBoss: TCodeToolManager;
|
||||
|
@ -1505,6 +1505,8 @@ type
|
||||
function GetMaxScrollTop: integer;
|
||||
function GetNodeAtInternalY(Y: Integer): TTreeNode;
|
||||
function GetNodeAtY(Y: Integer): TTreeNode;
|
||||
function GetNodeDrawAreaWidth: integer;
|
||||
function GetNodeDrawAreaHeight: integer;
|
||||
procedure GetSelectedIndex(Node: TTreeNode); virtual;
|
||||
function IsCustomDrawn(Target: TCustomDrawTarget;
|
||||
Stage: TCustomDrawStage): Boolean;
|
||||
@ -1521,6 +1523,7 @@ type
|
||||
procedure SetDragMode(Value: TDragMode); override;
|
||||
procedure SetOptions(NewOptions: TTreeViewOptions);
|
||||
procedure WndProc(var Message: TLMessage); override;
|
||||
|
||||
property AutoExpand: Boolean read GetAutoExpand write SetAutoExpand default False;
|
||||
property BorderStyle: TBorderStyle
|
||||
read FBorderStyle write SetBorderStyle default bsSingle;
|
||||
@ -1754,6 +1757,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.23 2002/03/04 13:07:21 lazarus
|
||||
MG: fixed update bottomitem on wmsize
|
||||
|
||||
Revision 1.22 2002/03/04 07:28:53 lazarus
|
||||
MG: find declaration: fixed function in with context
|
||||
|
||||
|
@ -595,11 +595,8 @@ begin
|
||||
Result:=Result.Parent;
|
||||
if Result<>nil then Result:=Result.GetNextSibling;
|
||||
end;
|
||||
//writeln('TTreeNode.GetNextVisible A ',HexStr(Cardinal(Result),8));
|
||||
if (Result<>nil) and (TreeView<>nil) and (not TreeView.IsNodeVisible(Result))
|
||||
then
|
||||
if (Result<>nil) and (not Result.IsVisible) then
|
||||
Result:=nil;
|
||||
//writeln('TTreeNode.GetNextVisible B ',HexStr(Cardinal(Result),8));
|
||||
end;
|
||||
|
||||
function TTreeNode.GetPrevVisible: TTreeNode;
|
||||
@ -950,8 +947,12 @@ writeln('');
|
||||
taInsert:
|
||||
begin
|
||||
// insert node in front of ANode
|
||||
//writeln('[TTreeNode.InternalMove] ANode.Index=',ANode.Index);
|
||||
Owner.MoveTopLvlNode(-1,ANode.Index,Self);
|
||||
//writeln('[TTreeNode.InternalMove] ANode.Index=',ANode.Index,' ANode=',HexStr(Cardinal(ANode),8));
|
||||
FNextBrother:=ANode;
|
||||
FPrevBrother:=ANode.GetPrevSibling;
|
||||
if Owner<>nil then begin
|
||||
Owner.MoveTopLvlNode(-1,ANode.Index,Self);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -1011,11 +1012,11 @@ procedure TTreeNode.MoveTo(Destination: TTreeNode; Mode: TNodeAttachMode);
|
||||
{
|
||||
TNodeAttachMode = (naAdd, naAddFirst, naAddChild, naAddChildFirst, naInsert);
|
||||
|
||||
naAdd: add as last sibling of Destination
|
||||
naAddFirst: add as first sibling of Destnation
|
||||
naAddChild: add as last child of Destination
|
||||
naAdd: add as last sibling of Destination
|
||||
naAddFirst: add as first sibling of Destnation
|
||||
naAddChild: add as last child of Destination
|
||||
naAddChildFirst: add as first child of Destination
|
||||
naInsert: insert in front of Destination
|
||||
naInsert: insert in front of Destination
|
||||
}
|
||||
var
|
||||
AddMode: TAddMode;
|
||||
@ -1581,7 +1582,7 @@ begin
|
||||
if (PrevNode<>nil) and (PrevNode.GetNextSibling<>nil) then
|
||||
Result:=InternalAddObject(PrevNode.GetNextSibling,S,Data,taInsert)
|
||||
else
|
||||
Result:=AddObject(nil,S,Data);
|
||||
Result:=AddObject(PrevNode,S,Data);
|
||||
end;
|
||||
|
||||
function TTreeNodes.InternalAddObject(Node: TTreeNode; const S: string;
|
||||
@ -1611,6 +1612,7 @@ writeln('');
|
||||
Owner.Invalidate;
|
||||
ok:=true;
|
||||
finally
|
||||
// this construction creates nicer exception output
|
||||
if not ok then
|
||||
Result.Free;
|
||||
end;
|
||||
@ -1863,10 +1865,10 @@ writeln('[TTreeNodes.MoveTopLvlNode] TopLvlFromIndex=',TopLvlFromIndex,
|
||||
TreeNodeError('TTreeNodes.MoveTopLvlNode inserting nil');
|
||||
// insert node
|
||||
if FTopLvlCount=FTopLvlCapacity then GrowTopLvlItems;
|
||||
inc(FTopLvlCount);
|
||||
for i:=FTopLvlCount-1 downto TopLvlToIndex+1 do
|
||||
FTopLvlItems[i]:=FTopLvlItems[i-1];
|
||||
FTopLvlItems[TopLvlToIndex]:=Node;
|
||||
inc(FTopLvlCount);
|
||||
end else begin
|
||||
// nothing to do
|
||||
end;
|
||||
@ -2038,8 +2040,10 @@ begin
|
||||
if (i>0) and (FTopLvlItems[i].FPrevBrother<>FTopLvlItems[i-1]) then
|
||||
exit(-9);
|
||||
if (i<FTopLvlCount-1) and (FTopLvlItems[i].FNextBrother<>FTopLvlItems[i+1])
|
||||
then
|
||||
then begin
|
||||
writeln(' CONSISTENCY i=',i,' FTopLvlCount=',FTopLvlCount,' FTopLvlItems[i]=',HexStr(Cardinal(FTopLvlItems[i]),8),' FTopLvlItems[i].FNextBrother=',HexStr(Cardinal(FTopLvlItems[i].FNextBrother),8),' FTopLvlItems[i+1]=',HexStr(Cardinal(FTopLvlItems[i+1]),8));
|
||||
exit(-10);
|
||||
end;
|
||||
if (i=FTopLvlCount-1) and (FTopLvlItems[i].FNextBrother<>nil) then
|
||||
exit(-11);
|
||||
end;
|
||||
@ -2909,6 +2913,16 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCustomTreeView.GetNodeDrawAreaWidth: integer;
|
||||
begin
|
||||
Result:=ClientWidth-ScrollBarWidth-BorderWidth*2;
|
||||
end;
|
||||
|
||||
function TCustomTreeView.GetNodeDrawAreaHeight: integer;
|
||||
begin
|
||||
Result:=ClientHeight-ScrollBarWidth-BorderWidth*2;
|
||||
end;
|
||||
|
||||
function TCustomTreeView.GetNodeAt(X, Y: Integer): TTreeNode;
|
||||
//var HitTest: TTVHitTestInfo;
|
||||
begin
|
||||
@ -3030,7 +3044,6 @@ begin
|
||||
//writeln('[TCustomTreeView.IsNodeVisible] A Node=',HexStr(Cardinal(ANode),8),
|
||||
//' ANode.AreParentsExpanded=',ANode.AreParentsExpanded);
|
||||
if Result then begin
|
||||
UpdateAllTops;
|
||||
//writeln('[TCustomTreeView.IsNodeVisible] B Node=',HexStr(Cardinal(ANode),8),
|
||||
//' ',FScrolledTop,'>=',ANode.Top,'+',ANode.Height,' or ',FScrolledTop,'+',ClientHeight,'<',ANode.Top);
|
||||
if (FScrolledTop>=ANode.Top+ANode.Height)
|
||||
@ -3141,9 +3154,10 @@ procedure TCustomTreeView.SetSelection(Value: TTreeNode);
|
||||
begin
|
||||
if FSelectedNode=Value then exit;
|
||||
FSelectedNode:=Value;
|
||||
if Value <> nil then
|
||||
if Value <> nil then begin
|
||||
Value.Selected := True;
|
||||
// TreeView_SelectItem(Handle, nil);
|
||||
Value.MakeVisible;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
@ -3899,14 +3913,16 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCustomTreeView.EnsureNodeIsVisible(ANode: TTreeNode);
|
||||
var b: integer;
|
||||
begin
|
||||
if ANode=nil then exit;
|
||||
ANode.ExpandParents;
|
||||
UpdateAllTops;
|
||||
if ANode.Top<ScrolledTop then
|
||||
ScrolledTop:=ANode.Top
|
||||
else if ANode.Top+ANode.Height>ScrolledTop+(ClientHeight-ScrollBarWidth) then
|
||||
ScrolledTop:=ANode.Top+ANode.Height-(ClientHeight-ScrollBarWidth);
|
||||
else begin
|
||||
b:=ANode.Top+ANode.Height-GetNodeDrawAreaHeight;
|
||||
if ScrolledTop<b then ScrolledTop:=b;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCustomTreeView.CreateNode: TTreeNode;
|
||||
@ -4243,7 +4259,7 @@ end;
|
||||
|
||||
procedure TCustomTreeView.WMSize(var Msg: TLMSize);
|
||||
begin
|
||||
Include(FStates,tvsScrollbarChanged);
|
||||
FStates:=FStates+[tvsScrollbarChanged,tvsBottomItemNeedsUpdate];
|
||||
inherited;
|
||||
end;
|
||||
|
||||
@ -4312,7 +4328,7 @@ begin
|
||||
if FTreeNodes=nil then exit(-6);
|
||||
Result:=FTreeNodes.ConsistencyCheck;
|
||||
if Result<>0 then begin
|
||||
dec(Result,100);
|
||||
dec(Result,1000);
|
||||
exit;
|
||||
end;
|
||||
if FUpdateCount<0 then exit(-7);
|
||||
|
Loading…
Reference in New Issue
Block a user