Topic: How to display an image when it is highlighted in a row?

Hello, I would just like to ask how to show an image like a preview when it is highlighted in a box.

I tried to make it work so that every time the image is highlighted on the row on frmReceivingmain, Hrdschiefmain, frmEmployee1, frmEmployee2, frmEmployee3 and frmEmployee4 it will show a preview but unfortunately it is not working.

Derek provided me a similar code on one of my previous projects,

 procedure frmReceivingmain_TableGrid1_OnKeyUp (Sender: TObject; var Key: Word; Shift, Alt, Ctrl: boolean);
begin
  frmReceivingmain.DBImage1.loadfromdatabase('receiving','attachment1', frmReceivingmain.TableGrid1.dbitemid);
end;

procedure frmReceivingmain_TableGrid1_OnClick (Sender: TObject);
begin
  frmReceivingmain.DBImage1.loadfromdatabase('receiving','attachment1', frmReceivingmain.TableGrid1.dbitemid);
end;

May I ask what I did wrong here and how can I correct it and apply it to the forms.

Thank you.

Post's attachments

Attachment icon Paper routing.rar 535.43 kb, 351 downloads since 2019-05-01 

Re: How to display an image when it is highlighted in a row?

OnCellClick

Post's attachments

Attachment icon Paper routing.7z 129.81 kb, 410 downloads since 2019-05-01 

Re: How to display an image when it is highlighted in a row?

Awesome! Thank you so much.

Re: How to display an image when it is highlighted in a row?

I would just like to ask one more thing.

I would like to do this with an attachment as well, if I highlighted a row with an attachment there is a corresponding box on the right side of the screen
similar to the preview of the image and I can click it to open the document.

I tried to replace the script with this one so that when I press enter on the keyboard it will show but it is not working and shows an undeclared error. (DBFile2)

procedure frmEmployee1_TableGrid1_OnEnter(Sender: TObject; ACol, ARow: Integer);
begin
    frmEmployee1.DBFile1.loadfromdatabase('receiving','attachment2', frmEmployee1.TableGrid1.dbitemid);
end;

I tried to create a specific button to show the attachment but to no avail. Can you please help me the exact procedure for one form? Thank you.

Post's attachments

Attachment icon Paper routing.rar 1.18 mb, 371 downloads since 2019-05-02 

Re: How to display an image when it is highlighted in a row?

Hi,
Not sure if I'm understanding your requirement correctly - from your code, it looks like you're actually trying to load documents into MVD to view them.  Or do you just want to be able to click a button and open documents using their default programs (Word, Excel etc)?
I would imagine it's the latter - using MVD to log where your document is held, what its status is etc etc but linking with an external call to the source document to work on it.  That's pretty much the basis of most document flow programs that I've seen. 
If this is the case, then just use the 'openfile' command in the script together with the location of the document that you are entering in form 'frmreceiving' and storing in the 'receiving' table as 'attachment2'  (see lines 7-10 in the script in the attachment).
Can I ask what the purpose of the 'filedto' table is?
Regards,
Derek.

Post's attachments

Attachment icon Paper routing.zip 1.85 mb, 423 downloads since 2019-05-02 

6 (edited by g0dmenuelz 2019-05-02 22:52:57)

Re: How to display an image when it is highlighted in a row?

Hi Derek. It is working perfectly.

After all the workflow is done with the document we will then print a hard copy of the "action taken/attachment 2"  then store it in a real folder (filedto)

Thanks again. smile

Re: How to display an image when it is highlighted in a row?

dimm1745 wrote:

Здравствуйте. Два дня изучал скрипт, но так ничего не получилось. Изображение не появляется, как предварительный просмотр. Что же я делаю не так?

Post's attachments

Attachment icon new pasport.7z 83.52 kb, 310 downloads since 2020-03-10