Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

iwadvdbgrid image column

 Post Reply Post Reply
Author
Bordin Marco View Drop Down
New Member
New Member
Avatar

Joined: 06 Nov 2017
Posts: 14
Post Options Post Options   Quote Bordin Marco Quote  Post ReplyReply Direct Link To This Post Topic: iwadvdbgrid image column
    Posted: 22 May 2019 at 11:49am
Hi, how put an image that it is not in a dataset into an image column?
Back to Top
Bart Holvoet View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2108
Post Options Post Options   Quote Bart Holvoet Quote  Post ReplyReply Direct Link To This Post Posted: 22 May 2019 at 3:43pm
Hi,

You can add a Column of Type ctImage, then use the OnGetCellData event to set the cell value.

Example:
procedure TformDBGrid.TIWDBAdvWebGrid1GetCellData(Sender: TObject; RowIndex,
  ColumnIndex: Integer; var AValue: string);
begin
  if ColumnIndex = 0 then
    AValue := 'image.png';
end;
Back to Top
Bordin Marco View Drop Down
New Member
New Member
Avatar

Joined: 06 Nov 2017
Posts: 14
Post Options Post Options   Quote Bordin Marco Quote  Post ReplyReply Direct Link To This Post Posted: 22 May 2019 at 3:58pm
Thank you. sorry for posted twice
Back to Top
Bordin Marco View Drop Down
New Member
New Member
Avatar

Joined: 06 Nov 2017
Posts: 14
Post Options Post Options   Quote Bordin Marco Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2019 at 11:12am
Hi, still not working.
this is de column definition:
Columns = <
          item
            CheckTrue = 'true'
            CheckFalse = 'false'
            ColumnHeaderFont.Color = clNone
            ColumnHeaderFont.Size = 10
            ColumnHeaderFont.Style = []
            ColumnType = ctImage
            DefaultDynEdit = '0'
            DefaultDynText = '0'
            DetailFont.Color = clNone
            DetailFont.Size = 10
            DetailFont.Style = []
            ImageIndex = 0
            Font.Color = clNone
            Font.Size = 10
            Font.Style = []
            FooterFormat = '%g'
            Name = 'EDIT'
            SpinEditMaxValue = 100
            SpinEditMinValue = 0
            Width = 32
          end
and this is the code:
procedure TFStampeSLP.grdElencoGetCellData(Sender: TObject; RowIndex, ColumnIndex: Integer; var AValue: string);
var ImagesPath: string;
begin

//  ImagesPath := TPath.combine(WebApplication.ApplicationPath, 'Immagini');
  ImagesPath := 'Immagini';
  if ColumnIndex = 0 then
    if dsDocuments.DataSet.FieldByName('DATA_LETTURA').IsNull and dsDocuments.DataSet.FieldByName('DATA_STAMPA').IsNull
    then
      AValue := TPath.Combine(ImagesPath,'flag_mark_red.png')
    else
      AValue := TPath.Combine(ImagesPath,'flag_mark_green.png');
end;

and this is the result in the grid

Other question could be possible to load the png image from an IWImageList? and if yes how?
Back to Top
Bart Holvoet View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2108
Post Options Post Options   Quote Bart Holvoet Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2019 at 2:38pm
- Can you please make sure the path to the image is correct?
By default an IntraWeb application expects the files to be inside a subfolder of the application called "wwwroot".
- You can assign a TIWImageList to the Images property, the set the Columns.ImageIndex property to the desired image index.
Back to Top
Bordin Marco View Drop Down
New Member
New Member
Avatar

Joined: 06 Nov 2017
Posts: 14
Post Options Post Options   Quote Bordin Marco Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2019 at 3:51pm
Yes, I have already checked the path that seems to be correct
Back to Top
Bart Holvoet View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2108
Post Options Post Options   Quote Bart Holvoet Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2019 at 4:00pm
We are not aware of any issues with displaying an image in a Column of ColumnType ctImage.
Can you please check in the browser's page source if the correct path has been added in the cell as expected?

If the problem persists, please provide the following information so I can further investigate this:
- The version of Delphi you are using
- The version of IntraWeb you are using
- The name and version of the browser you are using
- A ready to run sample project that demonstrates the issue
Back to Top
Bordin Marco View Drop Down
New Member
New Member
Avatar

Joined: 06 Nov 2017
Posts: 14
Post Options Post Options   Quote Bordin Marco Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2019 at 4:44pm
You are right, putting the image folder under wwwroot is working as expected.
Thank you.
Back to Top
Bart Holvoet View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2108
Post Options Post Options   Quote Bart Holvoet Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2019 at 4:47pm
Thank you for notifying this was resolved.
Back to Top
Bordin Marco View Drop Down
New Member
New Member
Avatar

Joined: 06 Nov 2017
Posts: 14
Post Options Post Options   Quote Bordin Marco Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2019 at 4:54pm
now another problem occurs, when I click on a grid row after the grdElencoAsyncRowSelect detected seems that the GetCellData event is not executed and so the column loose the images
Back to Top
Bart Holvoet View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2108
Post Options Post Options   Quote Bart Holvoet Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2019 at 5:09pm
I have not been able to reproduce this, please provide the following information so I can further investigate this:
- The version of Delphi you are using
- The version of IntraWeb you are using
- The name and version of the browser you are using
- A ready to run sample project that demonstrates the issue
Back to Top
Bordin Marco View Drop Down
New Member
New Member
Avatar

Joined: 06 Nov 2017
Posts: 14
Post Options Post Options   Quote Bordin Marco Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2019 at 5:28pm
RadStudio XE7 using Delphi
Intraweb 15.0.17
Firefox Quantum 66.0.5.

Please Tell me how can I send you the sample project
Back to Top
Bart Holvoet View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2108
Post Options Post Options   Quote Bart Holvoet Quote  Post ReplyReply Direct Link To This Post Posted: 24 May 2019 at 8:46am
You can send the sample project by email to: mailto:help@tmssoftware.com

Back to Top
Bordin Marco View Drop Down
New Member
New Member
Avatar

Joined: 06 Nov 2017
Posts: 14
Post Options Post Options   Quote Bordin Marco Quote  Post ReplyReply Direct Link To This Post Posted: 16 Jul 2019 at 7:15pm
Hi, if I reload the page with F5 key, then the images are shown correctly
Back to Top
Bart Holvoet View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2108
Post Options Post Options   Quote Bart Holvoet Quote  Post ReplyReply Direct Link To This Post Posted: 17 Jul 2019 at 8:32am
Hi,

Can you please try changing your code as indicated below?

 

procedure TFStampeSLP.grdElencoGetCellData(Sender: TObject; RowIndex, ColumnIndex: Integer; var AValue: string);

var

  ImagesPath: string;

begin

  ImagesPath := 'Immagini';

  if ColumnIndex = 0 then

    if dsDocuments.DataSet.FieldByName('DATA_LETTURA').IsNull and dsDocuments.DataSet.FieldByName('DATA_STAMPA').IsNull

    then

      AValue := ImagesPath + '/flag_mark_red.png'

    else

      AValue := ImagesPath + '/flag_mark_green.png';

end;


Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down