Page 1 of 1

Modal scan driver dialog

Posted: Tue Feb 16, 2016 7:07 pm
by DanielLW
Hello Vintasoft-team,

i've recognized a problem with the scan driver dialogs. I've set the properties "ShowUI" and "ModalUI" of the Vintasoft.Twain.Device to true, but i still can switch between the scan driver UI and the main application windows.

Example code:

Code: Select all

            
            bool bFinished = false;
            Vintasoft.Twain.Device deTest = null;
            Vintasoft.Twain.AcquireModalState amsTest;

            this.dmTest.Open();

            deTest = this.dmTest.DefaultDevice;

            deTest.ShowUI = true;
            deTest.ModalUI = true;
            deTest.ShowIndicators = false;
            deTest.DisableAfterAcquire = false;

            deTest.TransferMode = Vintasoft.Twain.TransferMode.Native;

            deTest.Open();

            deTest.XferCount = -1;
            deTest.DocumentFeeder.Enabled = true;

            // modal acquiring loop
            do
            {
                amsTest = deTest.AcquireModal();

                switch (amsTest)
                {
                    case Vintasoft.Twain.AcquireModalState.ImageAcquired:
                        if (this.pictureBox1.Image != null)
                            this.pictureBox1.Image.Dispose();

                        this.pictureBox1.Image = deTest.AcquiredImage.GetAsBitmap(true);

                        deTest.AcquiredImage.Dispose();

                        break;
                    case Vintasoft.Twain.AcquireModalState.ScanCanceled:
                    case Vintasoft.Twain.AcquireModalState.ScanCompleted:
                    case Vintasoft.Twain.AcquireModalState.ScanFailed:
                    case Vintasoft.Twain.AcquireModalState.UserInterfaceClosed:
                        bFinished = true;
                        break;
                }
            }
            while (!bFinished);

            deTest.Close();

            this.dmTest.Close();
The underlying Vintasoft.Twain.DeviceManager is created with the main application window as parameter in the constructor.

Is this perhaps a known behaviour? Or do i have to call some other method/property to force the twain driver window to be shown as a modal dialog?

Thank you.

Best regards
Daniel

Re: Modal scan driver dialog

Posted: Wed Feb 17, 2016 9:30 am
by Alex
Hello Daniel,

SDK just notifies TWAIN driver that modal UI must be used, the further behaviour depends from TWAIN driver. Unfortunately many TWAIN drivers ignore modal flag. In our demos we disable application UI before image scan and enable application UI when scan is finished.

Best regards, Alexander