Suppose you include a pascal scripting IDE in your application and a script is created that generates a modal form with a button on it and in the button onclick event, you place a debugger breakpoint.
The result, when that button is pressed, will be a deadlocked program that only task manager can kill.
Obviously you don't want to do that, but it would be difficult to control what end users do.
So I was wondering if there was any way to suspend connected modal forms when the pascalscript debugger breakpoint was hit.?
You cannot suspend window modality. It's not a flag.
Modal window runs its own message pump. Which is many levels up in a call stack from the event handler. You cannot change call stack.
Related
What is the best way to update FMX control without using Apllication.Processmessages method, וn main form.
Apllication.Processmessages call can cause to unwanted asynchrony user events to come in before operation completed.
We have old delphi XE5 in ms windows 10, i tried repaint and invalidate but it not help.
Have the OnClick handler disable the button, start a background thread/task to do the actual work, show the "please wait" message, and then exit the OnClick handler. Do not block the main thread at all. Let it run so it can process UI work normally as needed.
When your background work is finished, have the thread/task notify the main thread, which can then dismiss the "please wait" message and re-enable the button.
DO NOT do the actual work in the OnClick handler itself, and DO NOT call Application.ProcessMessages() at all.
In an application, we have multiple forms. Now we want to refresh a form 'X' when user sees the form 'x' either by restoring it from taskbar or with 'alt+tab'. How to recognize this through event.
The events 'OnActivate','OnShow' get called only once when the form is created. So they are not useful here.
Your claim that the TForm.OnActivate and TForm.OnShow events are fired only once per TForm instance is not true.
The TForm.OnActivate event is fired when a TForm window gains input focus for the first time, and afterwards whenever input focus is transferred to that window from another TForm window, while the app is in the foreground.
Note that there are also TApplication.OnActivate and TApplicationEvents.OnActivate events that are fired when your app comes into the foreground for the first time, and afterwards whenever focus moves to another app and then back to your app.
The TForm.OnShow event is fired when a TForm window becomes visible for the first time, and afterwards whenever that window becomes hidden and then is reshown.
This is my first post here on stackoverflow so forgive me for anything I'm doing wrong.
I'm making a kind of guide to the users without any computer knowledge of my application where I show him how to use it by signalizing what he should do, more specifically where to click. I want to that by moving a "fake" cursor to the button and simulate a click, and here is where I got my problem, I have to simulate just the animation of the click, and not the event itself but I couldn't find a way to do that, can anyone help me?
What you're describing is exactly what WH_JOURNALPLAYBACK is for. It populates the message queue with the mouse and keyboard messages you want to occur, and the OS interprets them. In your case, activate the playback hook and perform the mouse events necessary for performing a click.
In preparation, you'll probably want to use WH_JOURNALRECORD to discover what messages you need. Once you have them, you can probably winnow them down to a reasonably sized list prior to shipping your product to customers. (In particualr, you'll probably record many more mouse-move messages than you really need.)
In your button's click handler, check whether playback is active. Only perform the rest of the event handler when playback isn't active. That way, your program will behave just as though the button were clicked (including any animation), but it won't execute the real event code.
what I thought should be simple, doesn't seem so simple...
I have a BT application, so if BT is off on launch, the default warning "Turn On Bluetooth to Allow...", which has the options "Settings" and "OK" as the options. Since this is a default dialog, how do I get the button index clicked?
I am working with the iOS 8 SDK, so I assume this dialog is making use of the new UIAlertController, which now uses a completion block instead of a delegate method.
In my application, I have actions/buttons that are linked to queries that load new forms and populate tables with data. I would like to have an animated spinner animate while the queries load.
My current code has by default the TaniIndicator.visible/enabled properties set to false and then when the button is pressed to load the new form, the procedure begins by enabling both of those TaniIndicator properties, however, in my application, the spinner never shows and only is faint to see once the queries are finished and the new form is ready to appear. help ?
Using Delphi xe4, developing an iOS application.
It is because you perform your query on the main thread, and UI updates is blocked while the query is executing. You should start indicator, detach a new background thread or queue, launch task on that thread. Once it is done, switch back to main thread and hide or stop the indicator.
I just coded:
application.processMessages
as the article suggested by #LU RD guides to...
Was no need to create another Thread.