I'm using Delphitwain (delphitwain.sourceforge.net) to add scan functionality to my app. Everything was fine, when i click scan button on my app it will show scan mode with scanner's Properties such as Page Size, Scanning Side (canon dr-3010c) and there is a Scan button and Cancel button. If i click cancel of course all the properties back to it's value before.
How can I show this Scanner's Properties only to change properties without Scan, since i can do scan without showing properties
Twain.LoadLibrary;
Twain.LoadSourceManager;
Twain.Source[CurrentSource].Loaded := TRUE;
Twain.Source[CurrentSource].TransferMode := TTwainTransferMode(0);
Twain.Source[CurrentSource].EnableSource(True, True);
while Twain.Source[CurrentSource].Enabled do Application.ProcessMessages;
Twain.UnloadLibrary;
Twain.Source[CurrentSource].EnableSource(True, True);
The first True for ShowUI and the second True for Modal
I know it can be achieved 'cos i've seen another application that can show scanner's properties without scan, only OK and Cancel button, i've searched google all over but no luck, or maybe it just the limitation of the delphitwain component? Thanks, any suggestion appreciated
It has a boolean property in TTwainSource class named ShowUI. Using that property, you can control whether native UI of the scanner should be shown or not.
But take note that some scanners show their UI forcefully whether you set ShowUI to True or False.
Related
I have a button that allows to hide itself and another widget when pressed. When it is hidden, a new button appears on the screen which can undo (show) the previous button and widget again.
I'm pretty sure my implementation for this works because I've tested it on multiple devices without any problems, but whenever I try to write a formal test for it, something goes wrong. I'm using the following code to test my widget:
await tester.tap(find.widgetWithText(GestureDetector, "HIDE"));
expect(testContainerState.ifContainerWithOptionsIsDisplayed, false);
print(find.byType(GestureDetector));
await tester.tap(find.widgetWithText(GestureDetector, "SHOW"));
expect(testContainerState.ifContainerWithOptionsIsDisplayed, true);
The first two lines are there to tap the button and check whether ifContainerWithOptionsIsDisplayed changed. In my implementation, this is done in a setState method and should repaint to hide the widget and button and show the new button.
In the third line, I check how many GestureDetectors I can still find after what should be a repaint. The output of that print statement still shows me that all of the GestureDetectors of the widget that should now be hidden are still being found.
In the 4th line, I try to find my SHOW button that should now be visible because of the repaint. But no element is found.
Again, I'm pretty sure the code for my widgets are correct because I've tested this test case manually without any issues. Perhaps I'm missing some knowledge about Flutter tests. Could someone please fill me in?
await tester.pump();
or just
tester.pump();
should do that
See also
https://docs.flutter.io/flutter/flutter_test/WidgetTester/pump.html
https://docs.flutter.io/flutter/flutter_test/WidgetTester/pumpAndSettle.html
https://flutter.institute/flutter-and-widget-tests/
I have two display monitors connected to my pc.
I am using DirectX 10. I have a basic app, when I press space button I call;
swapChain->SetFullscreenState(true, 0);
to make it fullscreen.
It works well on my main monitor, but when I move the app to other monitor and press space button it does not work. Also throws first-chance exception.
Is it enough to just call SetFullscreenState function ? Or do I have to make sth else ?
Thanks for help.
Edit : I solved this problem.
You must assign your monitor to an IDXGIOutput type variable and pass it to SetFullscreenState function as second parameter.
swapChain->SetFullscreenState(true, &curr_monitor);
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
OpenEdge ABL automatically close a yes/no message after a certon amount of time has pasted
I have a yes/no message box that I want to clear after 14 seconds have past. I believe the first step to do this is to get the message box's handle so that I can make it disappear
I'm afraid the simple answer is "You can't".
This is not a limitation of Progress, it is inherent in Windows message boxes no matter what programming language you use. The message box is modal to the parent application, meaning that your application freezes until the message box is closed. No matter what coding you write to close the message box, it will not run while the message box is open.
The not so simple answer offers two possibilities: To have part of your application NOT freeze when modal forms are displayed displayed requires multi-threading, which we don't talk about in polite company. The other option is to display the message box as non-modal, i.e. it does not freeze your app. To achieve this, you cannot use MESSAGE VIEW-AS ALERT-BOX, because that will ALWAYS be modal. You will have to create your own message box - a window or frame that you can display and hide as you need.
I prefer using a Frame rather than a Window. Disable the default frame, show the Message frame which contains Yes/No buttons. Your app is not frozen, but the user can only interact with the message frame. When the user clicks a button or the time is up, hide the message frame and enable the default frame again.
FRAME Message-Frame:VISIBLE = TRUE.
FRAME default-frame:SENSITIVE = FALSE.
/* do your thing */
FRAME Message-Frame:VISIBLE = FALSE.
FRAME default-frame:SENSITIVE = TRUE.
Remember to set the TOP-ONLY attribute of the message frame to TRUE, or it won't appear above the default frame.
One can use a widget's handle, or manage it directly, like so:
DEF VAR ch-field AS CHARACTER.
DEF FRAME f-test
ch-field.
ch-field:Visible = yes.
pause 14 no-message.
ch-field:visible = no.
OR - get the widget's handle, and then set it's "Visible" attribute as needed.
Whenever i press the Back or previous button on the blackberry simulator everytime it asks whether to save cancel or discard? I don't want that to be shown at all .Please anybody help me to remove that.
ok you can do the following to remove it.
protected boolean onSavePrompt() {
return true;
}
You consume the event by returning true. Hence the prompt is not shown
In my Delphi application I have a custom Yes, No, Cancel dialogue, which will be called from the main form to confirm saving the changes made to the current file edited. This would normally be achieved by messageDlg() but I wanted this dialogue to have customised looks, so I am trying to achieve this functionality by
case myDialogue.showModal of
mrYes: <<save changes>>;
mrNo: <<quit application without saving changes>>
mrCancel: <<set the closeAction to caNone and do nothing>>
end;
The problem is that, by default, the form reacts to pressing the Escape key by returning mrNo TModalResult. And you can see how BAAAD this is, since your intuition tells you that Esc-aping the modal dialogue will CANCEL the intended Quit Application process, but in fact what happens is you issue a Don't save any changes command and application quits.
I have not noticed this behaviour until I lost an hour's work in this fashion. No FormKeyPressed event handler or anything responding to key presses was put into the myModalDialogue code. It just so works that pressing the Esc in forms shown using showModal will return mrNo. How can I override this default behaviour?
You need to make sure that the Cancel property of the "No" button is False, and that the Cancel property of the "Cancel" button is True.
Set the Cancel and Default properties of the buttons in your dialog.