Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0005519 [JEDI VCL] 00 JVCL Components feature always 2011-03-23 18:44 2011-09-21 14:10
Reporter SGlienke View Status public  
Assigned To obones
Priority normal Resolution fixed Platform
Status resolved   OS
Projection none   OS Version
ETA none Fixed in Version 3.45 Product Version 3.40
  Target Version Product Build
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.
Steps To Reproduce
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.
Attached Files ? file icon JVWizardRouteMapSteps.patch [^] (9,878 bytes) 2011-06-08 16:00

- Relationships

-  Notes
(0018472)
SGlienke (reporter)
2011-03-24 11:25

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;
(0018677)
obones (administrator)
2011-06-08 15:29

Can you submit it in a patch file as created by TortoiseSVN?
If not, at least in a file that follows the diff format
(0018683)
FBiehn (reporter)
2011-06-08 16:01

Added a patch file created by TortoiseSVN
(0018695)
obones (administrator)
2011-06-08 16:37

Thanks, this is now in SVN

- Issue History
Date Modified Username Field Change
2011-03-23 18:44 SGlienke New Issue
2011-03-24 11:20 FBiehn Issue Monitored: FBiehn
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


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker