tvplanit: Improved positioning of hint window for contact grid.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5203 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-09-23 13:29:12 +00:00
parent b46c6f5ab2
commit 9a553e8b08
3 changed files with 23 additions and 13 deletions

View File

@ -57,7 +57,7 @@ object MainForm: TMainForm
Height = 528 Height = 528
Top = 48 Top = 48
Width = 834 Width = 834
PageIndex = 0 PageIndex = 2
Align = alClient Align = alClient
TabOrder = 1 TabOrder = 1
TabStop = True TabStop = True
@ -373,7 +373,7 @@ object MainForm: TMainForm
object Contacts: TPage object Contacts: TPage
object VpContactButtonBar1: TVpContactButtonBar object VpContactButtonBar1: TVpContactButtonBar
Left = 0 Left = 0
Height = 532 Height = 528
Top = 0 Top = 0
Width = 40 Width = 40
BorderWidth = 3 BorderWidth = 3
@ -386,16 +386,16 @@ object MainForm: TMainForm
end end
object VpContactGrid1: TVpContactGrid object VpContactGrid1: TVpContactGrid
Left = 40 Left = 40
Height = 532 Height = 528
Top = 0 Top = 0
Width = 813 Width = 794
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow Color = clWindow
Align = alClient Align = alClient
TabStop = True TabStop = True
TabOrder = 1 TabOrder = 1
AllowInPlaceEditing = True AllowInPlaceEditing = True
BarWidth = 3 BarWidth = 1
BarColor = clSilver BarColor = clSilver
ColumnWidth = 200 ColumnWidth = 200
ContactHeadAttributes.Color = clSilver ContactHeadAttributes.Color = clSilver

View File

@ -925,7 +925,7 @@ var
txt: String; txt: String;
i: Integer; i: Integer;
contact: TVpContact; contact: TVpContact;
R: TRect; R, RHint,RCont, RScr: TRect;
begin begin
if FHintMode = hmPlannerHint then if FHintMode = hmPlannerHint then
begin begin
@ -943,9 +943,21 @@ begin
// Build and show the hint window // Build and show the hint window
if FHintWindow = nil then if FHintWindow = nil then
FHintWindow := THintWindow.Create(nil); FHintWindow := THintWindow.Create(nil);
APoint := ClientToScreen(APoint); RScr := Screen.WorkAreaRect;
R := FHintWindow.CalcHintRect(MaxWidth, txt, nil); RCont.TopLeft := ClientToScreen(cgContactArray[AContactIndex].WholeRect.TopLeft);
OffsetRect(R, APoint.X - WidthOf(R), APoint.Y); RCont.BottomRight := ClientToScreen(cgContactArray[AContactIndex].WholeRect.BottomRight);
RHint := FHintWindow.CalcHintRect(MaxWidth, txt, nil);
R := RHint;
OffsetRect(R, RCont.Left - WidthOf(R), RCont.Top);
if R.Left < RScr.Left then begin
R := RHint;
OffsetRect(R, RCont.Right, RCont.Top);
end;
RHint := R;
if (R.Bottom > RScr.Bottom) then begin
R := RHint;
OffsetRect(R, 0, R.Bottom - RScr.Bottom);
end;
FHintWindow.ActivateHint(R, txt); FHintWindow.ActivateHint(R, txt);
end else end else
// Hide the hint window // Hide the hint window

View File

@ -1688,10 +1688,8 @@ begin
); );
TVpContactGridOpener(FContactGrid).cgBarArray[BarCount].Index := BarCount; TVpContactGridOpener(FContactGrid).cgBarArray[BarCount].Index := BarCount;
for I := 1 to FContactGrid.BarWidth do begin for I := 1 to FContactGrid.BarWidth do begin
TPSMoveTo (RenderCanvas, Angle, RenderIn, TPSMoveTo(RenderCanvas, Angle, RenderIn, BarPos, RealTop + 2 + TextMargin * 2);
BarPos, RealTop + 2 + TextMargin * 2); TPSLineTo(RenderCanvas, Angle, RenderIn, BarPos, RealBottom - TextMargin * 2);
TPSLineTo (RenderCanvas, Angle, RenderIn,
BarPos, RealBottom - TextMargin * 2);
Inc(BarPos); Inc(BarPos);
end; end;
Inc(BarPos, RealColumnWidth); Inc(BarPos, RealColumnWidth);