Welcome, Guest
Username: Password: Remember me
CodeTyphon MS Windows (Win7, Win8.x, Win10 and Win11) OS Development, discussions and problems
  • Page:
  • 1

TOPIC:

TRxDBGrid 3 years 10 months ago #15491

  • Adrijan
  • Adrijan's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 7
  • Thank you received: 0
Hi,

Images in TRxDBGrid Titles just won't show:

     grdData.TitleImageList:=imgDataTypes;
     grdData.Columns[0].Title.ImageIndex:=2; 

 

This code works fine with TDBGrid. The same is in design state too.
I tried but cannot figure this out, although in both examples column titles descend from TGridColumnTitle...?

I'm using CT 7.30 on Windows 10.
Please help.
Attachments:

Please Log in or Create an account to join the conversation.

TRxDBGrid 3 years 10 months ago #15493

  • Matis A.
  • Matis A.'s Avatar
  • Away
  • Moderator
  • Moderator
  • Posts: 1105
  • Thank you received: 161
Please, a sample project with the problem, for LAB testing.
PilotLogic Core Programmer

Please Log in or Create an account to join the conversation.

Last edit: by Matis A..

TRxDBGrid 3 years 10 months ago #15494

  • Adrijan
  • Adrijan's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 7
  • Thank you received: 0
Thanks for reply, here it is.

 

File Attachment:

File Name: test_grid.zip
File Size:203 KB


 
Attachments:

Please Log in or Create an account to join the conversation.

TRxDBGrid 3 years 10 months ago #15496

  • Matis A.
  • Matis A.'s Avatar
  • Away
  • Moderator
  • Moderator
  • Posts: 1105
  • Thank you received: 161
Thanks, please give us time to test and report
PilotLogic Core Programmer

Please Log in or Create an account to join the conversation.

TRxDBGrid 3 years 10 months ago #15497

  • Matis A.
  • Matis A.'s Avatar
  • Away
  • Moderator
  • Moderator
  • Posts: 1105
  • Thank you received: 161
Don't work Sir
PilotLogic Core Programmer

Please Log in or Create an account to join the conversation.

TRxDBGrid 3 years 10 months ago #15498

  • Adrijan
  • Adrijan's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 7
  • Thank you received: 0
The project does not work or cannot figure out why TRxDbgrid refuses to show images in Titles?

Please Log in or Create an account to join the conversation.

TRxDBGrid 3 years 10 months ago #15499

  • Matis A.
  • Matis A.'s Avatar
  • Away
  • Moderator
  • Moderator
  • Posts: 1105
  • Thank you received: 161
TRxDbgrid refuses to show images
someone must put code to TRxDbgrid
PilotLogic Core Programmer

Please Log in or Create an account to join the conversation.

TRxDBGrid 3 years 10 months ago #15500

  • Adrijan
  • Adrijan's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 7
  • Thank you received: 0
Yes, the code is missing.
Since I use my classes anyway, this is the way I resolved it for my purposes:

type
TLunRxDBGrid = class(TRxDBGrid)
public
    procedure  DrawCell(aCol, aRow: integer; aRect: TRect; aState: TGridDrawState);  override;

procedure TLunRxDBGrid.DrawCell(aCol, aRow: integer; aRect: TRect; aState: TGridDrawState);
var xbitmap:TBitMap;
    xindex:integer;
begin
     if (aRow = 0) and (aCol > 0) and Assigned(TitleImageList) then begin
         inherited DrawCell(aCol, aRow, aRect, aState);
         try
           xbitmap := TBitmap.Create;
           try
              xindex:=Self.Columns[aCol].Title.ImageIndex;
           except
             xindex:=-1;
           end;
           if xindex > -1 then begin
              TitleImageList.GetBitmap(xindex,xbitmap);
              Canvas.Draw(aRect.Left+1,aRect.Top+1,xbitmap);
           end;
         finally
           xbitmap.Free;
         end;
     end else begin
         inherited DrawCell(aCol, aRow, aRect, aState);
     end;
end;

I know this is far from correct and generic solution, but I pasted it here in case anybody needs it as a quick fix.

Sir, thank you for your effort.

 

Please Log in or Create an account to join the conversation.

TRxDBGrid 3 years 10 months ago #15509

  • Matis A.
  • Matis A.'s Avatar
  • Away
  • Moderator
  • Moderator
  • Posts: 1105
  • Thank you received: 161
Thanks
we will try to put your code to LAB CT
PilotLogic Core Programmer

Please Log in or Create an account to join the conversation.

  • Page:
  • 1