View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006280 | JEDI VCL | 00 JVCL Components | public | 2014-05-07 18:47 | 2015-09-21 17:47 |
Reporter | lomo74 | Assigned To | AHUser | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | Daily / GIT | ||||
Target Version | Fixed in Version | 3.49 | |||
Summary | 0006280: TJvOutlookBar draws button highlight incorrectly when a page has ParentFont = False and different font size | ||||
Description | When a TJvOutlookBar page has ParentFont = False and a font size that is different from that of the TJvOutlookBar component itself, button highlight rects (starting at the second button) are drawn incorrectly. This is because TJvCustomOutlookBar.GetTextHeight calculates the button caption's height according to the main component's font, instead of the page's font. Patch attached. | ||||
Tags | No tags attached. | ||||
2014-05-07 18:47
|
patch.txt (855 bytes)
--- JvOutlookBar.pas.orig Tue May 06 11:48:52 2014 +++ JvOutlookBar.pas Wed May 07 18:36:06 2014 @@ -2060,12 +2060,22 @@ ButtonIndex: Integer): Integer; var R: TRect; + oldFont: TFont; begin if (Pages[PageIndex].ButtonSize = olbsLarge) and FWordWrap then begin R := Rect(0, 0, Max(ClientWidth - (2 * cTextMargins), cMinTextWidth), 0); + if Pages[PageIndex].ParentFont then + oldFont := nil + else + begin + oldFont := Canvas.Font; + Canvas.Font := Pages[PageIndex].Font; + end; Result := DrawText(Canvas.Handle, PChar(Pages[PageIndex].Buttons[ButtonIndex].Caption), -1, R, DT_WORDBREAK or DT_CALCRECT or DT_CENTER or DT_VCENTER); + if oldFont <> nil then + Canvas.Font := oldFont; end else Result := Abs(Pages[PageIndex].Font.Height); |
|
Please provide the zipped sources of a sample application showing this |
2014-09-03 12:10
|
issue6280.zip (577,983 bytes) |
|
Sorry, I reviewed my patch. The originally submitted solution was buggy and was the cause of a subsequent issue (# 6281). |
2014-09-03 13:53
|
patch1.txt (1,389 bytes)
--- JvOutlookBar.pas.orig Tue May 06 11:48:52 2014 +++ JvOutlookBar.pas Wed Sep 03 13:39:58 2014 @@ -308,6 +308,7 @@ FDisabledFontColor1:TColor; //clWhite; FDisabledFontColor2:TColor; FWordWrap: Boolean; + FOldFont: TFont; procedure SetPages(const Value: TJvOutlookBarPages); procedure DoChangeLinkChange(Sender: TObject); @@ -1420,6 +1421,7 @@ begin inherited Create(AOwner); + FOldFont := TFont.Create; FWordWrap := True; FPageBtnProps := TJvPageBtnProps.Create(self); DoubleBuffered := True; @@ -1504,6 +1506,7 @@ destructor TJvCustomOutlookBar.Destroy; begin + FOldFont.Free; FEdit.Free; FLargeChangeLink.Free; FSmallChangeLink.Free; @@ -2064,8 +2067,15 @@ if (Pages[PageIndex].ButtonSize = olbsLarge) and FWordWrap then begin R := Rect(0, 0, Max(ClientWidth - (2 * cTextMargins), cMinTextWidth), 0); + if not Pages[PageIndex].ParentFont then + begin + FOldFont.Assign(Canvas.Font); + Canvas.Font := Pages[PageIndex].Font; + end; Result := DrawText(Canvas.Handle, PChar(Pages[PageIndex].Buttons[ButtonIndex].Caption), -1, R, DT_WORDBREAK or DT_CALCRECT or DT_CENTER or DT_VCENTER); + if not Pages[PageIndex].ParentFont then + Canvas.Font := FOldFont; end else Result := Abs(Pages[PageIndex].Font.Height); |
Date Modified | Username | Field | Change |
---|---|---|---|
2014-05-07 18:47 | lomo74 | New Issue | |
2014-05-07 18:47 | lomo74 | File Added: patch.txt | |
2014-09-03 11:36 | obones | Note Added: 0021028 | |
2014-09-03 11:36 | obones | Status | new => feedback |
2014-09-03 12:10 | lomo74 | File Added: issue6280.zip | |
2014-09-03 13:48 | lomo74 | Note Added: 0021043 | |
2014-09-03 13:53 | lomo74 | File Added: patch1.txt | |
2014-10-01 10:49 | AHUser | Status | feedback => resolved |
2014-10-01 10:49 | AHUser | Fixed in Version | => Daily / GIT |
2014-10-01 10:49 | AHUser | Resolution | open => fixed |
2014-10-01 10:49 | AHUser | Assigned To | => AHUser |
2015-09-21 17:47 | obones | Fixed in Version | Daily / GIT => 3.49 |