View Issue Details

IDProjectCategoryView StatusLast Update
0006510JEDI VCL00 JVCL Componentspublic2016-08-04 20:55
ReporterCDamettoAssigned ToAHUser 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.48 
Target VersionFixed in VersionDaily / GIT 
Summary0006510: The selected item appearance in lookup list of TJvDBLookupCombo is not themed
DescriptionSee attached screenshot obtained by setting the theme Amethyst Kamry in Project->Options->Application->Appearance->Default style
Additional InformationI solved adding few lines in procedure TJvDBLookupList.Paint of file JvDBLookup.pas
See attachments
TagsNo tags attached.

Activities

2016-04-28 17:02

 

CorrectAspect.jpg (111,776 bytes)
CorrectAspect.jpg (111,776 bytes)

2016-04-28 17:03

 

Patch.txt (5,141 bytes)
procedure TJvDBLookupList.Paint;
var
  I, J, TextHeight, TextMargin: Integer;
  Image: TGraphic;
  Bmp: TBitmap;
  R, ImageRect: TRect;
  Selected: Boolean;
begin
  Bmp := TBitmap.Create;
  try
    Canvas.Font := Font;
    TextHeight := GetTextHeight;
    if ColorToRGB(Color) <> ColorToRGB(clBtnFace) then
      Canvas.Pen.Color := clBtnFace
    else
      Canvas.Pen.Color := clBtnShadow;
    for I := 0 to FRowCount - 1 do
    begin
      J := I - Ord(EmptyRowVisible);
      Canvas.Font.Color := Font.Color;
      Canvas.Brush.Color := Color;
      Selected := not FKeySelected and (I = 0) and not EmptyRowVisible;
      R.Top := I * TextHeight;
      R.Bottom := R.Top + TextHeight;
      if I < FRecordCount + Ord(EmptyRowVisible) then
      begin
        if (I = 0) and (J = -1) then
        begin
          if ValueIsEmpty(FValue) then
            {$IFDEF JVCLStylesEnabled}                                              //ADDED
            if StyleServices.Enabled and TStyleManager.IsCustomStyleActive then     //ADDED
            begin                                                                   //ADDED
              Canvas.Font.Color  := StyleServices.GetSystemColor(clHighlightText);  //ADDED
              Canvas.Brush.Color := StyleServices.GetSystemColor(clHighlight);      //ADDED
              Selected := True;                                                     //ADDED
            end                                                                     //ADDED
            else                                                                    //ADDED
            {$ENDIF JVCLStylesEnabled}                                              //ADDED
            begin
              Canvas.Font.Color := clHighlightText;
              Canvas.Brush.Color := clHighlight;
              Selected := True;
            end
          else
            Canvas.Brush.Color := EmptyItemColor;
          R.Left := 0;
          R.Right := ClientWidth;
          Image := GetPicture(False, True, TextMargin);
          if TextMargin > 0 then
          begin
            Bmp.Canvas.Font := Canvas.Font;
            Bmp.Canvas.Brush := Canvas.Brush;
            Bmp.Canvas.Pen := Canvas.Pen;
            Bmp.Width := RectWidth(R);
            Bmp.Height := RectHeight(R);
            ImageRect := Bounds(0, 0, TextMargin, RectHeight(R));
            Bmp.Canvas.FillRect(ImageRect);
            if Image <> nil then
              DrawPicture(Bmp.Canvas, ImageRect, Image);
            DrawItemText(Bmp.Canvas, Bounds(TextMargin, 0, RectWidth(R) - TextMargin,
              RectHeight(R)), Selected, True);
            Canvas.Draw(R.Left, R.Top, Bmp);
          end
          else
            DrawItemText(Canvas, R, Selected, True);
        end
        else
        begin
          FLookupLink.ActiveRecord := J;
          if not ValueIsEmpty(FValue) and (FKeyField.AsString = FValue) then
          {$IFDEF JVCLStylesEnabled}                                             //ADDED
          if StyleServices.Enabled and TStyleManager.IsCustomStyleActive then    //ADDED
          begin                                                                  //ADDED
            Canvas.Font.Color  := StyleServices.GetSystemColor(clHighlightText); //ADDED
            Canvas.Brush.Color := StyleServices.GetSystemColor(clHighlight);     //ADDED
            Selected := True;                                                    //ADDED
          end                                                                    //ADDED
          else                                                                   //ADDED
          {$ENDIF JVCLStylesEnabled}                                             //ADDED
          begin
            Canvas.Font.Color := clHighlightText;
            Canvas.Brush.Color := clHighlight;
            Selected := True;
          end;
          R.Left := 0;
          R.Right := ClientWidth;
          Image := GetPicture(False, False, TextMargin);
          if TextMargin > 0 then
          begin
            Bmp.Canvas.Font := Canvas.Font;
            Bmp.Canvas.Brush := Canvas.Brush;
            Bmp.Canvas.Pen := Canvas.Pen;
            Bmp.Width := RectWidth(R);
            Bmp.Height := RectHeight(R);
            ImageRect := Bounds(0, 0, TextMargin, RectHeight(R));
            Bmp.Canvas.FillRect(ImageRect);
            if Image <> nil then
              DrawPicture(Bmp.Canvas, ImageRect, Image);
            DrawItemText(Bmp.Canvas, Bounds(TextMargin, 0, RectWidth(R) - TextMargin,
              RectHeight(R)), Selected, False);
            Canvas.Draw(R.Left, R.Top, Bmp);
          end
          else
            DrawItemText(Canvas, R, Selected, False);
        end;
      end;
      R.Left := 0;
      R.Right := ClientWidth;
      if J >= FRecordCount then
        Canvas.FillRect(R);
      if Selected and (FFocused or FPopup) then
        Canvas.DrawFocusRect(R);
    end;
  finally
    Bmp.Free;
  end;
  if FRecordCount <> 0 then
    FLookupLink.ActiveRecord := FRecordIndex;
end;
Patch.txt (5,141 bytes)

AHUser

2016-08-04 20:55

developer   ~0021330

Added to master branch.

Issue History

Date Modified Username Field Change
2016-04-28 17:02 CDametto New Issue
2016-04-28 17:02 CDametto File Added: CorrectAspect.jpg
2016-04-28 17:03 CDametto File Added: Patch.txt
2016-08-04 20:55 AHUser Note Added: 0021330
2016-08-04 20:55 AHUser Status new => resolved
2016-08-04 20:55 AHUser Fixed in Version => Daily / GIT
2016-08-04 20:55 AHUser Resolution open => fixed
2016-08-04 20:55 AHUser Assigned To => AHUser