View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005519 | JEDI VCL | 00 JVCL Components | public | 2011-03-23 18:44 | 2011-09-21 14:10 |
Reporter | SGlienke | Assigned To | obones | ||
Priority | normal | Severity | feature | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.40 | ||||
Target Version | Fixed in Version | 3.45 | |||
Summary | 0005519: TJvWizardRouteMapSteps - Multiline for long page captions | ||||
Description | Normally if a caption is to long it is cut and the '...' are added. Added a property Multiline and changed Paint method to show the captions as multiline if they are too long. | ||||
Additional Information | Changed Paint method as follows: procedure TJvWizardRouteMapSteps.Paint; var ARect, TextRect, ArrowRect, DividerRect: TRect; ActivePageIndex, TotalPageCount: Integer; StepHeight: Integer; APage: TJvWizardCustomPage; S: string; begin ARect := ClientRect; TotalPageCount := DetectPageCount(ActivePageIndex); Canvas.Brush.Color := Color; if HasPicture then Image.PaintTo(Canvas, ARect); TextRect := GetActiveStepRect; Canvas.Font.Assign(Font); Canvas.Font.Style := [fsBold]; Canvas.Brush.Style := bsClear; S := Format(ActiveStepFormat, [ActivePageIndex, TotalPageCount]); StepHeight := DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_LEFT or DT_SINGLELINE or DT_END_ELLIPSIS or DT_VCENTER); // Display Active Page Description Canvas.Font.Style := []; OffsetRect(TextRect, 0, StepHeight); S := Pages[PageIndex].Caption; if Multiline then begin DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_CALCRECT or DT_LEFT or DT_WORDBREAK); TextRect.Right := ARect.Right; DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_LEFT or DT_WORDBREAK); end else begin DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_LEFT or DT_SINGLELINE or DT_END_ELLIPSIS or DT_VCENTER); end; Canvas.Font.Style := []; if FShowDivider then begin SetRect(DividerRect, Left + FIndent, TextRect.Bottom + 5, Width - FIndent, TextRect.Bottom + 6); Windows.DrawEdge(Canvas.Handle, DividerRect, EDGE_RAISED, BF_FLAT or BF_BOTTOM); end; { do the previous step } // YW - Ignore all disabled pages at run time APage := Wizard.FindNextPage(PageIndex, -1, not (csDesigning in ComponentState)); if Assigned(APage) and (PageIndex <> -1) and ShowNavigation then begin TextRect := GetPreviousStepRect; ArrowRect := GetPreviousArrowRect; Canvas.Font.Style := []; if ShowNavigators then begin if TextRect.Left + FIndent + ArrowRect.Right - ArrowRect.Left < Width then OffsetRect(TextRect, ArrowRect.Right, 0); if (csDesigning in ComponentState) or (bkBack in Wizard.WizardPages[PageIndex].EnabledButtons) then DrawFrameControl(Canvas.Handle, ArrowRect, DFC_SCROLL, DFCS_SCROLLLEFT or DFCS_FLAT); end; S := FPreviousStepText; StepHeight := DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_LEFT or DT_SINGLELINE or DT_END_ELLIPSIS or DT_VCENTER); OffsetRect(TextRect, 0, StepHeight); S := APage.Caption; if Multiline then begin DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_CALCRECT or DT_LEFT or DT_WORDBREAK); TextRect.Right := ARect.Right; DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_LEFT or DT_WORDBREAK); end else begin DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_LEFT or DT_SINGLELINE or DT_END_ELLIPSIS or DT_VCENTER); end; end; { do the next step } // YW - Ignore all disabled pages at run time APage := Wizard.FindNextPage(PageIndex, 1, not (csDesigning in ComponentState)); if Assigned(APage) and (PageIndex <> -1) and ShowNavigation then begin TextRect := GetNextStepRect; ArrowRect := GetNextArrowRect; Canvas.Font.Style := []; if ShowNavigators then begin OffsetRect(TextRect, ArrowRect.Right, 0); if (csDesigning in ComponentState) or (bkNext in Wizard.WizardPages[PageIndex].EnabledButtons) then DrawFrameControl(Canvas.Handle, ArrowRect, DFC_SCROLL, DFCS_SCROLLRIGHT or DFCS_FLAT); end; if Multiline then begin S := APage.Caption; StepHeight := DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_CALCRECT or DT_LEFT or DT_WORDBREAK); TextRect.Right := ARect.Right; OffsetRect(TextRect, 0, -StepHeight - FIndent); end; S := FNextStepText; StepHeight := DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_LEFT or DT_SINGLELINE or DT_END_ELLIPSIS or DT_VCENTER); OffsetRect(TextRect, 0, StepHeight); S := APage.Caption; if Multiline then begin DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_CALCRECT or DT_LEFT or DT_WORDBREAK); TextRect.Right := ARect.Right; DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_LEFT or DT_WORDBREAK); end else begin DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_LEFT or DT_SINGLELINE or DT_END_ELLIPSIS or DT_VCENTER); end; end; end; | ||||
Tags | No tags attached. | ||||
|
Better fix - last one still got some bug: procedure TJvWizardRouteMapSteps.Paint; var LRect, TextRect, ArrowRect, DividerRect: TRect; ActivePageIndex, TotalPageCount: Integer; StepHeight: Integer; APage: TJvWizardCustomPage; S: string; LDrawProperties: Cardinal; begin LRect := ClientRect; TotalPageCount := DetectPageCount(ActivePageIndex); Canvas.Brush.Color := Color; if HasPicture then Image.PaintTo(Canvas, LRect); TextRect := GetActiveStepRect; LRect := Rect(TextRect.TopLeft, TextRect.BottomRight); Canvas.Font.Assign(Font); Canvas.Font.Style := [fsBold]; Canvas.Brush.Style := bsClear; if Multiline then begin S := Pages[PageIndex].Caption; Canvas.Font.Style := []; StepHeight := DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_CALCRECT or DT_LEFT or DT_WORDBREAK); TextRect.Right := LRect.Right; OffsetRect(TextRect, 0, Round((-0.5) * StepHeight + Canvas.TextHeight('Wq'))); end; Canvas.Font.Style := [fsBold]; S := Format(ActiveStepFormat, [ActivePageIndex, TotalPageCount]); if Multiline then begin LDrawProperties := DT_LEFT or DT_WORDBREAK; end else begin LDrawProperties := DT_LEFT or DT_SINGLELINE or DT_END_ELLIPSIS or DT_VCENTER; end; StepHeight := DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, LDrawProperties); // Display Active Page Description Canvas.Font.Style := []; OffsetRect(TextRect, 0, StepHeight); S := Pages[PageIndex].Caption; if Multiline then begin LDrawProperties := DT_LEFT or DT_WORDBREAK; end else begin LDrawProperties := DT_LEFT or DT_SINGLELINE or DT_END_ELLIPSIS or DT_VCENTER; end; DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, LDrawProperties); Canvas.Font.Style := []; if Self.ShowDivider then begin SetRect(DividerRect, Left + Indent, TextRect.Bottom + 5, Width - Indent, TextRect.Bottom + 6); Windows.DrawEdge(Canvas.Handle, DividerRect, EDGE_RAISED, BF_FLAT or BF_BOTTOM); end; { do the previous step } // YW - Ignore all disabled pages at run time APage := Wizard.FindNextPage(PageIndex, -1, not (csDesigning in ComponentState)); if Assigned(APage) and (PageIndex <> -1) and ShowNavigation then begin TextRect := GetPreviousStepRect; ArrowRect := GetPreviousArrowRect; Canvas.Font.Style := []; if ShowNavigators then begin if TextRect.Left + Indent + ArrowRect.Right - ArrowRect.Left < Width then OffsetRect(TextRect, ArrowRect.Right, 0); if (csDesigning in ComponentState) or (bkBack in Wizard.WizardPages[PageIndex].EnabledButtons) then DrawFrameControl(Canvas.Handle, ArrowRect, DFC_SCROLL, DFCS_SCROLLLEFT or DFCS_FLAT); end; S := PreviousStepText; StepHeight := DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_LEFT or DT_WORDBREAK or DT_END_ELLIPSIS); OffsetRect(TextRect, 0, StepHeight); S := APage.Caption; if Multiline then begin DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_CALCRECT or DT_LEFT or DT_WORDBREAK); TextRect.Right := LRect.Right; LDrawProperties := DT_LEFT or DT_WORDBREAK; end else begin LDrawProperties := DT_SINGLELINE or DT_LEFT or DT_END_ELLIPSIS or DT_VCENTER; end; DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, LDrawProperties); end; { do the next step } // YW - Ignore all disabled pages at run time APage := Wizard.FindNextPage(PageIndex, 1, not (csDesigning in ComponentState)); if Assigned(APage) and (PageIndex <> -1) and ShowNavigation then begin TextRect := GetNextStepRect; ArrowRect := GetNextArrowRect; Canvas.Font.Style := []; if ShowNavigators then begin OffsetRect(TextRect, ArrowRect.Right, 0); if (csDesigning in ComponentState) or (bkNext in Wizard.WizardPages[PageIndex].EnabledButtons) then DrawFrameControl(Canvas.Handle, ArrowRect, DFC_SCROLL, DFCS_SCROLLRIGHT or DFCS_FLAT); end; if Multiline then begin S := APage.Caption; StepHeight := DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_CALCRECT or DT_LEFT or DT_WORDBREAK); TextRect.Right := LRect.Right; OffsetRect(TextRect, 0, (-1) * StepHeight + Canvas.TextHeight('Wq')); end; S := NextStepText; StepHeight := DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_LEFT or DT_WORDBREAK); OffsetRect(TextRect, 0, StepHeight); S := APage.Caption; if Multiline then begin DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, DT_CALCRECT or DT_LEFT or DT_WORDBREAK); TextRect.Right := LRect.Right; LDrawProperties := DT_LEFT or DT_WORDBREAK; end else begin LDrawProperties := DT_SINGLELINE or DT_LEFT or DT_END_ELLIPSIS or DT_VCENTER; end; DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, LDrawProperties); end; end; |
|
Can you submit it in a patch file as created by TortoiseSVN? If not, at least in a file that follows the diff format |
2011-06-08 16:00
|
JVWizardRouteMapSteps.patch (9,878 bytes)
Index: JvWizardRouteMapSteps.pas =================================================================== --- JvWizardRouteMapSteps.pas (revision 13044) +++ JvWizardRouteMapSteps.pas (working copy) @@ -51,6 +51,7 @@ FShowDivider: Boolean; FShowNavigators: Boolean; FShowNavigation: Boolean; + FMultiline: Boolean; function GetActiveStepRect: TRect; function GetPreviousStepRect: TRect; function GetNextStepRect: TRect; @@ -68,6 +69,7 @@ function StoreNextStepText: Boolean; function StorePreviousStepText: Boolean; procedure SetShowNavigation(const Value: Boolean); + procedure SetMultiline(const Value: Boolean); protected procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; function PageAtPos(Pt: TPoint): TJvWizardCustomPage; override; @@ -81,6 +83,7 @@ property Indent: Integer read FIndent write SetIndent default 5; property PreviousStepText: string read FPreviousStepText write SetPreviousStepText stored StorePreviousStepText; property ActiveStepFormat: string read FActiveStepFormat write SetActiveStepFormat stored StoreActiveStepFormat; + property Multiline: Boolean read FMultiline write SetMultiline default False; property NextStepText: string read FNextStepText write SetNextStepText stored StoreNextStepText; property ShowDivider: Boolean read FShowDivider write SetShowDivider default True; property ShowNavigators: Boolean read FShowNavigators write SetShowNavigators default True; @@ -218,93 +221,155 @@ procedure TJvWizardRouteMapSteps.Paint; var - ARect, TextRect, ArrowRect, DividerRect: TRect; + LRect, TextRect, ArrowRect, DividerRect: TRect; ActivePageIndex, TotalPageCount: Integer; StepHeight: Integer; APage: TJvWizardCustomPage; S: string; + LDrawProperties: Cardinal; begin + LRect := ClientRect; + TotalPageCount := DetectPageCount(ActivePageIndex); + Canvas.Brush.Color := Color; + if HasPicture then + Image.PaintTo(Canvas, LRect); - ARect := ClientRect; - TotalPageCount := DetectPageCount(ActivePageIndex); - Canvas.Brush.Color := Color; - if HasPicture then - Image.PaintTo(Canvas, ARect); + TextRect := GetActiveStepRect; + LRect := Rect(TextRect.TopLeft, TextRect.BottomRight); + Canvas.Font.Assign(Font); + Canvas.Font.Style := [fsBold]; + Canvas.Brush.Style := bsClear; - TextRect := GetActiveStepRect; - Canvas.Font.Assign(Font); - Canvas.Font.Style := [fsBold]; - Canvas.Brush.Style := bsClear; - - S := Format(ActiveStepFormat, [ActivePageIndex, TotalPageCount]); + if Multiline then + begin + S := Pages[PageIndex].Caption; + Canvas.Font.Style := []; StepHeight := DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, - DT_LEFT or DT_SINGLELINE or DT_END_ELLIPSIS or DT_VCENTER); + DT_CALCRECT or DT_LEFT or DT_WORDBREAK); + TextRect.Right := LRect.Right; + OffsetRect(TextRect, 0, Round((-0.5) * StepHeight + Canvas.TextHeight('Wq'))); + end; + Canvas.Font.Style := [fsBold]; + S := Format(ActiveStepFormat, [ActivePageIndex, TotalPageCount]); + if Multiline then + begin + LDrawProperties := DT_LEFT or DT_WORDBREAK; + end + else + begin + LDrawProperties := DT_LEFT or DT_SINGLELINE or DT_END_ELLIPSIS or DT_VCENTER; + end; + StepHeight := DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, + LDrawProperties); + // Display Active Page Description + Canvas.Font.Style := []; + OffsetRect(TextRect, 0, StepHeight); + S := Pages[PageIndex].Caption; + if Multiline then + begin + LDrawProperties := DT_LEFT or DT_WORDBREAK; + end + else + begin + LDrawProperties := DT_LEFT or DT_SINGLELINE or DT_END_ELLIPSIS or DT_VCENTER; + end; + DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, LDrawProperties); + + Canvas.Font.Style := []; + if Self.ShowDivider then + begin + SetRect(DividerRect, Left + Indent, TextRect.Bottom + 5, Width - Indent, + TextRect.Bottom + 6); + Windows.DrawEdge(Canvas.Handle, DividerRect, EDGE_RAISED, BF_FLAT or BF_BOTTOM); + end; + + { do the previous step } + + // YW - Ignore all disabled pages at run time + APage := Wizard.FindNextPage(PageIndex, -1, not (csDesigning in ComponentState)); + if Assigned(APage) and (PageIndex <> -1) and ShowNavigation then + begin + TextRect := GetPreviousStepRect; + ArrowRect := GetPreviousArrowRect; Canvas.Font.Style := []; - OffsetRect(TextRect, 0, StepHeight); - S := Pages[PageIndex].Caption; - DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, - DT_LEFT or DT_SINGLELINE or DT_END_ELLIPSIS or DT_VCENTER); - Canvas.Font.Style := []; - if FShowDivider then + if ShowNavigators then begin - SetRect(DividerRect, Left + FIndent, TextRect.Bottom + 5, Width - FIndent, - TextRect.Bottom + 6); - Windows.DrawEdge(Canvas.Handle, DividerRect, EDGE_RAISED, BF_FLAT or BF_BOTTOM); + if TextRect.Left + Indent + ArrowRect.Right - ArrowRect.Left < Width then + OffsetRect(TextRect, ArrowRect.Right, 0); + if (csDesigning in ComponentState) or (bkBack in Wizard.WizardPages[PageIndex].EnabledButtons) then + DrawFrameControl(Canvas.Handle, ArrowRect, DFC_SCROLL, + DFCS_SCROLLLEFT or DFCS_FLAT); end; - { do the previous step } + S := PreviousStepText; + StepHeight := DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, + DT_LEFT or DT_WORDBREAK or DT_END_ELLIPSIS); - // YW - Ignore all disabled pages at run time - APage := Wizard.FindNextPage(PageIndex, -1, not (csDesigning in ComponentState)); - if Assigned(APage) and (PageIndex <> -1) and ShowNavigation then + OffsetRect(TextRect, 0, StepHeight); + S := APage.Caption; + if Multiline then begin - TextRect := GetPreviousStepRect; - ArrowRect := GetPreviousArrowRect; - Canvas.Font.Style := []; - if ShowNavigators then - begin - if TextRect.Left + FIndent + ArrowRect.Right - ArrowRect.Left < Width then - OffsetRect(TextRect, ArrowRect.Right, 0); - if (csDesigning in ComponentState) or (bkBack in Wizard.WizardPages[PageIndex].EnabledButtons) then - DrawFrameControl(Canvas.Handle, ArrowRect, DFC_SCROLL, - DFCS_SCROLLLEFT or DFCS_FLAT); - end; - S := FPreviousStepText; - StepHeight := DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, - DT_LEFT or DT_SINGLELINE or DT_END_ELLIPSIS or DT_VCENTER); - OffsetRect(TextRect, 0, StepHeight); - S := APage.Caption; DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, - DT_LEFT or DT_SINGLELINE or DT_END_ELLIPSIS or DT_VCENTER); + DT_CALCRECT or DT_LEFT or DT_WORDBREAK); + TextRect.Right := LRect.Right; + + LDrawProperties := DT_LEFT or DT_WORDBREAK; + end + else + begin + LDrawProperties := DT_SINGLELINE or DT_LEFT or DT_END_ELLIPSIS or DT_VCENTER; end; + DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, LDrawProperties); + end; { do the next step } // YW - Ignore all disabled pages at run time - APage := Wizard.FindNextPage(PageIndex, 1, not (csDesigning in ComponentState)); - if Assigned(APage) and (PageIndex <> -1) and ShowNavigation then + APage := Wizard.FindNextPage(PageIndex, 1, not (csDesigning in ComponentState)); + if Assigned(APage) and (PageIndex <> -1) and ShowNavigation then + begin + TextRect := GetNextStepRect; + ArrowRect := GetNextArrowRect; + Canvas.Font.Style := []; + if ShowNavigators then begin - TextRect := GetNextStepRect; - ArrowRect := GetNextArrowRect; - Canvas.Font.Style := []; - if ShowNavigators then - begin - OffsetRect(TextRect, ArrowRect.Right, 0); - if (csDesigning in ComponentState) or (bkNext in Wizard.WizardPages[PageIndex].EnabledButtons) then - DrawFrameControl(Canvas.Handle, ArrowRect, DFC_SCROLL, - DFCS_SCROLLRIGHT or DFCS_FLAT); - end; - S := FNextStepText; + OffsetRect(TextRect, ArrowRect.Right, 0); + if (csDesigning in ComponentState) or (bkNext in Wizard.WizardPages[PageIndex].EnabledButtons) then + DrawFrameControl(Canvas.Handle, ArrowRect, DFC_SCROLL, + DFCS_SCROLLRIGHT or DFCS_FLAT); + end; + + if Multiline then + begin + S := APage.Caption; StepHeight := DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, - DT_LEFT or DT_SINGLELINE or DT_END_ELLIPSIS or DT_VCENTER); - OffsetRect(TextRect, 0, StepHeight); - S := APage.Caption; + DT_CALCRECT or DT_LEFT or DT_WORDBREAK); + TextRect.Right := LRect.Right; + OffsetRect(TextRect, 0, (-1) * StepHeight + Canvas.TextHeight('Wq')); + end; + + S := NextStepText; + StepHeight := DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, + DT_LEFT or DT_WORDBREAK); + + OffsetRect(TextRect, 0, StepHeight); + S := APage.Caption; + if Multiline then + begin DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, - DT_LEFT or DT_SINGLELINE or DT_END_ELLIPSIS or DT_VCENTER); + DT_CALCRECT or DT_LEFT or DT_WORDBREAK); + TextRect.Right := LRect.Right; + + LDrawProperties := DT_LEFT or DT_WORDBREAK; + end + else + begin + LDrawProperties := DT_SINGLELINE or DT_LEFT or DT_END_ELLIPSIS or DT_VCENTER; end; - + DrawText(Canvas.Handle, PChar(S), Length(S), TextRect, LDrawProperties); + end; end; procedure TJvWizardRouteMapSteps.SetShowDivider(const Value: Boolean); @@ -325,6 +390,15 @@ end; end; +procedure TJvWizardRouteMapSteps.SetMultiline(const Value: Boolean); +begin + if FMultiline <> Value then + begin + FMultiline := Value; + Invalidate; + end; +end; + procedure TJvWizardRouteMapSteps.SetNextStepText(const Value: string); begin if FNextStepText <> Value then |
|
Added a patch file created by TortoiseSVN |
|
Thanks, this is now in SVN |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-03-23 18:44 | SGlienke | New Issue | |
2011-03-24 11:25 | SGlienke | Note Added: 0018472 | |
2011-06-07 17:46 | obones | Status | new => acknowledged |
2011-06-08 15:29 | obones | Note Added: 0018677 | |
2011-06-08 16:00 | FBiehn | File Added: JVWizardRouteMapSteps.patch | |
2011-06-08 16:01 | FBiehn | Note Added: 0018683 | |
2011-06-08 16:37 | obones | Note Added: 0018695 | |
2011-06-08 16:37 | obones | Status | acknowledged => resolved |
2011-06-08 16:37 | obones | Fixed in Version | => Daily / SVN |
2011-06-08 16:37 | obones | Resolution | open => fixed |
2011-06-08 16:37 | obones | Assigned To | => obones |
2011-09-21 14:10 | obones | Fixed in Version | Daily / SVN => 3.45 |