Procedure

TfrmOrders.lstOrdersDrawItem

Module

fOrders

Last Modified

7/15/2014 3:26:42 PM

Visibility

Public/Published

Owner

TfrmOrders

Declaration

procedure lstOrdersDrawItem(Control: TWinControl; Index: Integer;
  TheRect: TRect; State: TOwnerDrawState);

Calls Hierarchy


TfrmOrders.lstOrdersDrawItem
 ├TfrmOrders.GetOrderText
 │ ├LoadFlagReason
 │ ├TfrmOrders.GetStartStopText
 │ └NameOfStatus
 └TChanges.Exist

Calls

Name Declaration Comments
TChanges.Exist function Exist(ItemType: Integer; const AnID: string): Boolean; -
TfrmOrders.GetOrderText function GetOrderText(AnOrder: TOrder; Index: integer; Column: integer): string; -


Source

1426  procedure TfrmOrders.lstOrdersDrawItem(Control: TWinControl; Index: Integer; TheRect: TRect;
1427    State: TOwnerDrawState);
1428  var
1429    i, RightSide: Integer;
1430    FirstColumnDisplayed: Integer;
1431    x: string;
1432    ARect: TRect;
1433    AnOrder: TOrder;
1434    SaveColor: TColor;
1435  begin
1436    inherited;
1437    with lstOrders do
1438    begin
1439      ARect := TheRect;
1440      if odSelected in State then
1441      begin
1442        Canvas.Brush.Color := clHighlight;
1443        Canvas.Font.Color := clHighlightText
1444      end;
1445      Canvas.FillRect(ARect);
1446      Canvas.Pen.Color := Get508CompliantColor(clSilver);
1447      Canvas.MoveTo(ARect.Left, ARect.Bottom - 1);
1448      Canvas.LineTo(ARect.Right, ARect.Bottom - 1);
1449      RightSide := -2;
1450  
1451      for i := 0 to 9 do
1452      begin
1453        RightSide := RightSide + hdrOrders.Sections[i].Width;
1454        Canvas.MoveTo(RightSide, ARect.Bottom - 1);
1455        Canvas.LineTo(RightSide, ARect.Top);
1456      end;
1457  
1458      if Index < Items.Count then
1459      begin
1460        AnOrder := TOrder(Items.Objects[Index]);
1461        if hdrOrders.Sections[0].Text = 'Event' then
1462          FirstColumnDisplayed := 0
1463        else
1464          FirstColumnDisplayed := 1;
1465        if AnOrder <> nil then with AnOrder do for i := FirstColumnDisplayed to 9 do
1466        begin
1467          if i > FirstColumnDisplayed then
1468            ARect.Left := ARect.Right + 2
1469          else
1470            ARect.Left := 2;
1471          ARect.Right := ARect.Left + hdrOrders.Sections[i].Width - 6;
1472          x := GetOrderText(AnOrder, Index, i);
1473          SaveColor := Canvas.Brush.Color;
1474          if i = FirstColumnDisplayed then
1475          begin
1476            if Flagged then
1477            begin
1478              Canvas.Brush.Color := Get508CompliantColor(clRed);
1479              Canvas.FillRect(ARect);
1480            end;
1481          end;
1482          if i = 2 then
1483          begin
1484            Canvas.Font.Style := [];
1485            if Changes.Exist(CH_ORD, AnOrder.ID) then Canvas.Font.Style := [fsBold];
1486            if not (odSelected in State) and (AnOrder.Signature = OSS_UNSIGNED) then
1487            begin
1488              if FHighContrast2Mode then
1489                Canvas.Font.Color := clBlue
1490              else
1491                Canvas.Font.Color := Get508CompliantColor(clBlue);
1492            end;
1493          end;
1494          if (i = 2) or (i = 3) or (i = 0) then
1495            DrawText(Canvas.Handle, PChar(x), Length(x), ARect, DT_LEFT or DT_NOPREFIX or DT_WORDBREAK)
1496          else DrawText(Canvas.Handle, PChar(x), Length(x), ARect, DT_LEFT or DT_NOPREFIX );
1497          Canvas.Brush.Color := SaveColor;
1498          ARect.Right := ARect.Right + 4;
1499        end;
1500      end;
1501    end;
1502  end;