ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TIETwainParams.ShowSettingsOnly

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Elemental Posted - May 02 2014 : 13:45:35
After a bit of testing, am I correct in assuming that when you set ShowSettingsOnly on a TIETwainParams object to True, and VisibleDialog to True, and then call Acquire, that the properties of TIETwainParams are NOT modified, despite the user being allowed to change TWAIN values in the dialog box?

My testing shows that a device CAN read and write its settings, but if you set those two properties to True so that the user can alter them, and the user clicks OK, none of the TWAIN parameters actually change.

1) Is this really the case?
2) If so, why?

"Roj"
13   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Nov 25 2014 : 12:08:12
Sounds like a good solution, nice work.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Elemental Posted - Nov 25 2014 : 08:29:40
Well, thank you for going out of your way to try this. What I've decided to do for the time being is provide my own dialog that asks the user whether or not they want to save their settings. If they click Yes, then I call MIO.TwainParams.Update and then save the settings to a file. If they click No, I don't do anything. And I set ShowSettingsOnly to False immediately after either operation. If their scanner has issues like mine does, then I will modify their .ini file manually and make sure it's not overwritten. It's an in-house application, so I have that option. Thank you, really, for trying to debug this. It's difficult for all of us when a device and/or driver doesn't conform to TWAIN standards like it ought to. Yours truly, "Roj"
xequte Posted - Nov 25 2014 : 01:54:56
Hi

We tested this on an HP 8270 scanner and confirmed that it works correctly.
Unfortunately we do not have an HP 200 or HP 5590 for testing.


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Elemental Posted - Nov 05 2014 : 16:50:12
Here is my code, where iemvDocViewer is a TImageEnMView. Note that SaveSettingsToFile is a helper function defined in iexTwainHelperFunctions.pas, but this is beside the point. The bigger picture is that, with some drivers, Acquire doesn't always return True when OK is clicked; and sometimes Update renders a program unresponsive. And if I comment out the call to Update, then the TIETwainParams object doesn't grab the values that the user chose in the dialog.


procedure TMyImageForm.GetTwainPreferences;
begin
  iemvDocViewer.MIO.TwainParams.ShowSettingsOnly := True;
  try
    if iemvDocViewer.MIO.Acquire then
    begin
      ///  This next line works great with my HP 5590, but only if I select the correct
      ///  of the three TWAIN drivers that represent it (1:HP Scanjet 5590 Doc TWAIN).
      ///  For the other one (2:hp scanjet 5590 TWAIN), this next line which calls Update
      ///  "freezes" the host application so that you can't even click on it.
      iemvDocViewer.MIO.TwainParams.Update;
      {$IFDEF DEBUG}
      ShowMessage( Format( 'X Resolution: %d; Pixel Depth: %d',
        [ Trunc( iemvDocViewer.MIO.TwainParams.XResolution.CurrentValue ),
          iemvDocViewer.MIO.TwainParams.PixelType.CurrentValue ] ) );
      {$ENDIF}
      iemvDocViewer.MIO.TwainParams.SaveSettingsToFile( TwainSettingsPath );
    end;
  finally
    iemvDocViewer.MIO.TwainParams.ShowSettingsOnly := False;
  end;
end;

xequte Posted - Nov 04 2014 : 21:19:18
Hi

Can you show us the code you are using for loading and saving of the settings?


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Elemental Posted - Oct 28 2014 : 17:20:32
I downloaded and installed 5.2.0 today (after uninstalling 5.1.1) Calling Acquire, after setting ShowSettingsOnly to True, still doesn't grab the new values I picked from the dialog. On my HP 200, it doesn't even show a dialog. If I call the Update method after picking my HP 5590, it leaves my application untouchable (I can't click on it and my mouse disappears when I mouse-over it). I have to Reset the application to get control again. Odd.

All I really want to do is have my application remember the user's TWAIN settings for this application. There seems to be a mysterious part of some drivers that remembers what the settings are anyway, even if don't do anything, and I wonder if my efforts are trying to trump those of manufacturer device drivers. I just want to know what to do so my users can select scan settings appropriate for my application, which might not be the settings they want in other applications.
xequte Posted - Aug 08 2014 : 13:37:09
Hi

For v5.1.2 we will make it that when ShowSettingsOnly = True, it returns True if the user clicks Ok/Save.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
xequte Posted - Aug 06 2014 : 16:26:52
Hi

I believe by design the result is only true if files are transferred, but that would not seem optimal for ShowSettingsOnly = True. I will investigate further...

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Elemental Posted - Aug 06 2014 : 11:53:49
Although that worked, I still can't tell if the user clicked OK or Cancel. If they click OK, I want to save the changes to a file. If they click Cancel, then I don't want to save the changes. Although I could save the changes either way (since Update won't pull new values on a Cancel click), I'd rather not put a new Date/Timestamp on a file that didn't need to be changed. Still, I'll consider this a solution and if I could award stars, I'd award one. :)
xequte Posted - Aug 05 2014 : 19:46:33
Hi

It may be some compatibility weirdness. Does it make any difference if you call:

ImageEnView1.IO.TwainParams.Update;

Before:

ShowMessage( FloatToStr( ImageEnView1.IO.TwainParams.XResolution.CurrentValue ) );



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Elemental Posted - Aug 04 2014 : 15:53:28
Follow the steps below to reproduce the issue:

1) In Delphi, create a new VCL Application. I am using Delphi XE 5.
2) Put a TButton and a TImageEnView on the form. I am using ImageEn 5.1.1.
3) Save everything to a new folder and call the units whatever you want.
4) In Button1's OnClick event handler, insert the following body:


  ImageEnView1.IO.TwainParams.SelectedSource := <A valid source index number>;
  ShowMessage( FloatToStr( ImageEnView1.IO.TwainParams.XResolution.CurrentValue ) );
  ImageEnView1.IO.TwainParams.ShowSettingsOnly := True;
  ImageEnView1.IO.TwainParams.VisibleDialog := True;
  if ImageEnView1.IO.Acquire then
    ShowMessage( FloatToStr( ImageEnView1.IO.TwainParams.XResolution.CurrentValue ) );


On my HP scanner, the first ShowMessage reads 300. Then I see the scanner properties. I change the resolution to 200 and click OK. Acquire does not come back as True, so the second ShowMessage never comes. The same is true if I click Cancel.

If I take out the "if" and "then" (so that ShowMessage is called regardless), the second ShowMessage shows 300 before AND after I change it to 200.

If I restart the application, then the ShowMessages show the new value I selected.

This behavior, as I've coded it, is not consistent with what the user expects. If the user chooses new values for his or her Twain device, the components should know that, and I can do other things according to their preferences. As a programmer, I should be told whether the user clicked OK or not, and if the user clicked OK, the TwainParams object should be modified.

Should I be calling other methods or properties to get this to work as expected?
xequte Posted - Aug 04 2014 : 14:46:26
Hi Roj

Can you show me some of your code where you show the Twain dialog and read the settings.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Elemental Posted - Aug 04 2014 : 09:08:15
I would like to bump this thread. If the user wants to modify their scanning preferences without performing a scan, I'd like to save their changes if they hit OK on the dialog. Can TIETwainParams be modified so that clicking OK does change TIETwainParams properties?