T O P I C R E V I E W |
Elemental |
Posted - Mar 26 2014 : 10:18:25 I have a project which suffers from the same problem that one of the demos does. The demo project is Multi\Multi.dproj. If you go to Scanner > Acquire Pages, it brings up a dialog, which is great. But if I click Cancel on that dialog, the TImageEnMView gets a new, black box page.
To attempt to solve the problem, I've tried adding a TImageEnMIO component to the form and hooking it to the TImageEnMView. I handle the OnAcquireBitmap method, testing for different kinds of situations, like ImageEnMIO1.Aborting, not ABitmap.IsAllBlack, and not ABitmap.IsEmpty, but I still get that little box.
However, this doesn't seem to occur when connecting to a scanner that doesn't have a Cancel button in its acquire dialog (though it does have a Close button like most Windows windows).
"Roj"
|
4 L A T E S T R E P L I E S (Newest First) |
xequte |
Posted - Mar 27 2014 : 14:12:44 Hi
In my testing, I could not reproduce this via Twain or WIA. It might be a weirdness with the driver for HP devices, but I lack one for testing.
Will investigate further.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
w2m |
Posted - Mar 26 2014 : 13:59:19 If you change mine to ImageEnMView1.RemoveBlankPages(0.0001, False, False); then you will not see the black page at all.
William Miller Adirondack Software & Graphics Email: w2m@frontiernet.net EBook: http://www.imageen.com/ebook/ Apprehend: http://www.frontiernet.net/~w2m/index.html Custom ImageEn Development |
Elemental |
Posted - Mar 26 2014 : 13:36:06 I wasn't able to get that code to work for me; it would delete all the images that I already had in the view. Here is the scan code I needed, without handling any events:
ImageEnMIO1.AcquireParams.VisibleDialog := True;
if ImageEnMIO1.SetAcquireSource( ieaTwain, Default_Device ) then
if not ImageEnMIO1.Acquire then
ImageEnMView1.RemoveBlankPages( 0.0001, False, False );
The black box appears briefly, then disappears. By supplying a very small tolerance, I can rest pretty assured that it won't remove other valid pages from my component. By supplying False for the second parameter, it only deleted one image, no more. By supplying False as the third parameter, the empty-page-check begins at the end instead of the beginning, saving time, and ensuring the right image is removed.
"Roj" |
w2m |
Posted - Mar 26 2014 : 13:18:20 This was tested with an HP8600:
private
{ Private declarations }
AAborting: Boolean;
procedure TForm1.FormCreate(Sender: TObject);
begin
AAborting := False;
ImageEnMView1.SetModernStyling;
end;
procedure TForm1.Acquirepages1Click(Sender: TObject);
{ Menu, scanner | acquire pages }
begin
ImageEnMView1.Deselect;
if ImageEnMView1.MIO.AcquireParams.SelectedSourceApi = ieaTwain then
begin
ImageEnMView1.MIO.TwainParams.FeederEnabled := true;
ImageEnMView1.MIO.TwainParams.AutoFeed := true;
ImageEnMView1.MIO.TwainParams.DuplexEnabled := False;
end;
if not ImageEnMView1.MIO.Acquire then
AAborting := True
else
AAborting := False;
end;
procedure TForm1.ImageEnMView1AfterEvent(Sender: TObject; Event: TIEAfterEvent);
{ Occurs immediately after ImageEn has processed an event. }
begin
if Event = ieaePaint then
if AAborting then
{ Remove blank pages }
ImageEnMView1.RemoveBlankPages(1, True, True);
end; I did not get a blank page when cancelling a WIA dialog but I did get a blank black page when canceling a TWain dialog. It seems like if ImageEnMView1.MIO.Acquire = False then ImageEnMView should not create a blank page at all. Anyway... this seems to work.
William Miller Adirondack Software & Graphics Email: w2m@frontiernet.net EBook: http://www.imageen.com/ebook/ Apprehend: http://www.frontiernet.net/~w2m/index.html Custom ImageEn Development |
|
|