MG: fixed splitter

git-svn-id: trunk@1644 -
This commit is contained in:
lazarus 2002-04-27 15:35:01 +00:00
parent be7e4beacc
commit 5c2a8c45ff

View File

@ -129,7 +129,8 @@ type
FExpandingRow:TOIPropertyGridRow; FExpandingRow:TOIPropertyGridRow;
FTopY:integer; FTopY:integer;
FDefaultItemHeight:integer; FDefaultItemHeight:integer;
FSplitterX:integer; FSplitterX:integer; // current splitter position
FPreferredSplitterX: integer; // best splitter position
FIndent:integer; FIndent:integer;
FBackgroundColor:TColor; FBackgroundColor:TColor;
FNameFont,FValueFont:TFont; FNameFont,FValueFont:TFont;
@ -215,6 +216,7 @@ type
function TopMax:integer; function TopMax:integer;
property DefaultItemHeight:integer read FDefaultItemHeight write FDefaultItemHeight; property DefaultItemHeight:integer read FDefaultItemHeight write FDefaultItemHeight;
property SplitterX:integer read FSplitterX write SetSplitterX; property SplitterX:integer read FSplitterX write SetSplitterX;
property PrefferedSplitterX:integer read FPreferredSplitterX write FPreferredSplitterX;
property Indent:integer read FIndent write FIndent; property Indent:integer read FIndent write FIndent;
property BackgroundColor:TColor property BackgroundColor:TColor
read FBackgroundColor write SetBackgroundColor default clBtnFace; read FBackgroundColor write SetBackgroundColor default clBtnFace;
@ -326,6 +328,7 @@ begin
// visible values // visible values
FTopY:=0; FTopY:=0;
FSplitterX:=100; FSplitterX:=100;
FPreferredSplitterX:=FSplitterX;
FIndent:=9; FIndent:=9;
FBackgroundColor:=clBtnFace; FBackgroundColor:=clBtnFace;
FNameFont:=TFont.Create; FNameFont:=TFont.Create;
@ -403,9 +406,9 @@ begin
ScrollInfo.fMask := SIF_ALL or SIF_DISABLENOSCROLL; ScrollInfo.fMask := SIF_ALL or SIF_DISABLENOSCROLL;
ScrollInfo.nMin := 0; ScrollInfo.nMin := 0;
ScrollInfo.nTrackPos := 0; ScrollInfo.nTrackPos := 0;
ScrollInfo.nMax := TopMax+ClientWidth; ScrollInfo.nMax := TopMax+ClientHeight;
ScrollInfo.nPage := ClientWidth; ScrollInfo.nPage := ClientHeight;
if ScrollInfo.nPage<=0 then ScrollInfo.nPage:=1; if ScrollInfo.nPage<1 then ScrollInfo.nPage:=1;
ScrollInfo.nPos := TopY; ScrollInfo.nPos := TopY;
SetScrollInfo(Handle, SB_VERT, ScrollInfo, True); SetScrollInfo(Handle, SB_VERT, ScrollInfo, True);
ShowScrollBar(Handle,SB_VERT,True); ShowScrollBar(Handle,SB_VERT,True);
@ -941,6 +944,7 @@ begin
if FDragging then begin if FDragging then begin
Cursor:=crDefault; Cursor:=crDefault;
FDragging:=false; FDragging:=false;
FPreferredSplitterX:=FSplitterX;
if FCurrentEdit<>nil then FCurrentEdit.SetFocus; if FCurrentEdit<>nil then FCurrentEdit.SetFocus;
end; end;
end; end;
@ -977,7 +981,7 @@ begin
if (SplitterX<5) and (aWidth>20) then if (SplitterX<5) and (aWidth>20) then
SplitterX:=100 SplitterX:=100
else else
SplitterX:=SplitterX; SplitterX:=FPreferredSplitterX;
AlignEditComponents; AlignEditComponents;
end; end;
end; end;
@ -1589,8 +1593,8 @@ begin
FTop:=AnObjInspector.Top; FTop:=AnObjInspector.Top;
FWidth:=AnObjInspector.Width; FWidth:=AnObjInspector.Width;
FHeight:=AnObjInspector.Height; FHeight:=AnObjInspector.Height;
FPropertyGridSplitterX:=AnObjInspector.PropertyGrid.SplitterX; FPropertyGridSplitterX:=AnObjInspector.PropertyGrid.PrefferedSplitterX;
FEventGridSplitterX:=AnObjInspector.EventGrid.SplitterX; FEventGridSplitterX:=AnObjInspector.EventGrid.PrefferedSplitterX;
FGridBackgroundColor:=AnObjInspector.PropertyGrid.BackgroundColor; FGridBackgroundColor:=AnObjInspector.PropertyGrid.BackgroundColor;
FShowHints:=AnObjInspector.PropertyGrid.ShowHint; FShowHints:=AnObjInspector.PropertyGrid.ShowHint;
end; end;
@ -1598,12 +1602,12 @@ end;
procedure TOIOptions.AssignTo(AnObjInspector: TObjectInspector); procedure TOIOptions.AssignTo(AnObjInspector: TObjectInspector);
begin begin
if FSaveBounds then begin if FSaveBounds then begin
writeln('[TOIOptions.AssignTo] ',AnObjInspector.Name,' ',FLeft,',',FTop,',',FWidth,',',FHeight);
AnObjInspector.SetBounds(FLeft,FTop,FWidth,FHeight); AnObjInspector.SetBounds(FLeft,FTop,FWidth,FHeight);
AnObjInspector.PropertyGrid.SplitterX:=FPropertyGridSplitterX; AnObjInspector.PropertyGrid.SplitterX:=FPropertyGridSplitterX;
AnObjInspector.PropertyGrid.PrefferedSplitterX:=FPropertyGridSplitterX;
AnObjInspector.EventGrid.SplitterX:=FEventGridSplitterX; AnObjInspector.EventGrid.SplitterX:=FEventGridSplitterX;
AnObjInspector.EventGrid.PrefferedSplitterX:=FPropertyGridSplitterX;
end; end;
writeln(' RRRR ',FGridBackgroundColor);
AnObjInspector.PropertyGrid.BackgroundColor:=FGridBackgroundColor; AnObjInspector.PropertyGrid.BackgroundColor:=FGridBackgroundColor;
AnObjInspector.PropertyGrid.ShowHint:=FShowHints; AnObjInspector.PropertyGrid.ShowHint:=FShowHints;
AnObjInspector.EventGrid.BackgroundColor:=FGridBackgroundColor; AnObjInspector.EventGrid.BackgroundColor:=FGridBackgroundColor;