Initialise image item [message #336388] |
Sat, 26 July 2008 04:49 |
dillango
Messages: 145 Registered: January 2008
|
Senior Member |
|
|
Dear All,
I have tabular form records. When I click particular record (say for example employee number), I should display the corresponding picture of that employee which already been stored in the local directory.
Some of the employee don't have picture.
Now the problem is, If there is no picture available for a employee, instead of showing blank, it still showing the previous picture. How to initialise the image item?
This is my code written in when-mouse-click trigger.
Declare
bmp_image_dir varchar2(80) := 'D:\IMAGES\';
photo_filename varchar2(80);
begin
photo_filename := bmp_image_dir || lower(:pending.eno) || '.bmp';
Read_Image_file(photo_filename,'BMP','MANAGER_VIEW.empphoto');
if not form_success then
Message('This employee does not have a photo on file directory');message(' ');
end if;
end;
|
|
|
|
Re: Initialise image item [message #336401 is a reply to message #336399] |
Sat, 26 July 2008 08:01 |
dillango
Messages: 145 Registered: January 2008
|
Senior Member |
|
|
Mr.Littlefoot,
Thank you for your effort to explain with the examples. However, I have no other trigger except when-mouse-click to call this particular block.
I am also getting an error message but picture is not cleared.
Alternatively, If I know how to blank the image manually, I can use it after the message display.
ILANGO
|
|
|
Re: Initialise image item [message #336408 is a reply to message #336401] |
Sat, 26 July 2008 09:23 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
I think I understand what's bothering you ...
Well, the fact is that you can't refer to an image item in PL/SQL code, such as :block.image_item := null; or something like that.
However, you might hide or display this item, depending on whether there is (or not) an image for an item.
So, your WHEN-MOUSE-CLICK trigger would look like this:Declare
bmp_image_dir varchar2(80) := 'D:\IMAGES\';
photo_filename varchar2(80);
begin
set_item_property('manager_view.empphoto', visible, property_true);
photo_filename := bmp_image_dir || lower(:pending.eno) || '.bmp';
Read_Image_file(photo_filename,'BMP','MANAGER_VIEW.empphoto');
end;
Furthermore, create the ON-ERROR trigger asif error_type = 'FRM' and error_code = 47109 then
set_item_property('manager_view.empphoto', visible, property_false);
end if; (Include a message if you wish, but not displaying an image is just enough in my opinion; who'd want to acknowledge a message every time an employee doesn't have an image?)
|
|
|
Re: Initialise image item [message #336425 is a reply to message #336388] |
Sat, 26 July 2008 12:38 |
dillango
Messages: 145 Registered: January 2008
|
Senior Member |
|
|
Fantastic,
As you said, first option was throwing an error as bad bind variable. Second idea is working fine( visible false). This idea did not strike me.
Thank you very much
ILANGO
|
|
|