Splash Screen with message in FireMonkey - firemonkey

I want a splash screen with a tLabel on it. This tLabel will be used to show the progress of the initialization tasks for the application, such as: "Starting up databases", "Setting up forms", etc.
I have tried the following code, in the project file:
Application.Initialize;
FormSplash := TFormSplash.Create( Application );
FormSplash.OpenSplash;
FormSplash.ShowProgress;
Application.Run;
It shows the splash-screen properly. However, the tLabel that should show each text posted to it in sequence when the splash-screen appears, shows only the last text posted. This happens even if I put a Sleep command after each text posted. I tried to post the texts on the FormCreate, FormShow and FormActivate events with the same result.
The application is for Windows 32.

Between changing the contents of your label you should allow the application to react to those changes. The simplest possibility is to use Application.ProcessMessages.

Related

How do I debug a firefox extension, it seemingly crashes silently

I cannot figure out how to debug my simple extension. Script (a content script) loads (because the first console.log call shows in the tab's console) but then nothing. There's no error what so ever and no second console.log call.
My question is not about solving my code issue (there surely is one, if only firefox would tell me where), it's about finding the place where warnings/errors about the add-on are in firefox (like 'sdfsdf has no object property ...')
about:debugging is no help, the console it can open shows some errors (example: 'Error: Service "domainInfo" is not available. Make sure it appears in the "requiresServices" property of the module's background where is it used.') that have nothing to do with what I'm trying to do (I can tell from the source and nature of errors)
// start of file
console.log('I AM LOADING');
// simple DOM manipulation code here...
console.log('I AM LOADED');
// end of file
The content scripts are supposed to be debugged with the DevTools instance attached to the web page.
However, as you noticed, the errors in the content script are not reported in the tab's Web Console due to a bug. (As of Firefox 70.)
As a workaround you can:
use try..catch with logging,
check the Browser Console (which does show error in the content script)
use the Debugger's "pause on exceptions" option.

CEF4Delphi - My program doesn't get visible again using Alt-Tab when browser is active

I have a Windows program, let's call it 'MyApp', written in Delphi, with embedded chromium on a certain tab. I use CEF4Delphi and I have a problem.
When I use 'MyApp' and the embedded browser is active, I can activate another program (using Alt-Tab or click the icon in the task bar). That's no problem. But when I want to activate 'MyApp' again, it won't get visible or brought to the front. I can not see 'MyApp'. The other program remains visible, however the icon in the taskbar is highlighted. To use 'MyApp', I will have to minimize the other program, so I will see it again.
This problem only occurs when the embedded browser in 'MyApp' is activated.
The chromium is running as a different process and created like recommended in the documentation: https://www.briskbard.com/index.php?lang=en&pageid=cef#usage
The dpr looks like this:
program MyApp;
{$R *.dres}
// uses files
{$SetPEFlags IMAGE_FILE_RELOCS_STRIPPED or IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP or IMAGE_FILE_NET_RUN_FROM_SWAP}
{$SetPEOptFlags IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE}
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
begin
NullStrictConvert := System.false;
GlobalCEFApp := TCefApplication.Create;
if GlobalCEFApp.StartMainProcess then
begin
PauseMadExcept;
Application.Initialize;
// ... create forms ...
Application.Run;
It seems to be a Windows 10 bug!
Try this (which helped me with another software, Magix Video Edit Pro):
Disable the "Snap windows" under System > Settings > Multitasking and now the ALT + TAB works again. The software gets focused.
Update: The bug reappeared but still, it worked some time after disabling "Snap windwos". Anyone with some more hints, please comment below.

parent & child browsers view got switched during automated execution by HP UFT

I am facing a strange issue with my test automation scripts when executed through HP UFT 12.01
Our AUT is a web based application developed in actimize. During my test flow, lets say at 5th step i need to invoke a popup browser (child) from my main page. The new popup browser will not have any menus or back/fwd buttons.
3 out of 10 executions, during 5th step my main browser gets refreshed to invoke the popup and when popup rendered fully, contents and views got switched now. i.e., main browser has the contents which are supposed to display in popup window (with menu bar and back/fwd buttons) and pop-up window has main page contents (without menu bar, back/fwd buttons) & state when i performed click operation.
This is strange and i could not really conclude if its browser issue or UFT issue. I have also checked with functional team and they never faced, so this is happening only through UFT execution and speculating it could be UFT issue.. any help pls?
This sounds like it could be either:
1) an actual bug in your UAT
2) a problem with QTP object identification.
If it's #2, here's some things to check. First, make sure that QTP can correctly and reliably identify the two different "browsers". (i.e. while both are on the screen, use the "Highlight in Application" button found the Object Repository window while each of the objects is selected. I would try this for both a normal run and immediately after the browsers get switched (use a break point if necessary)
If there is a problem with QTP identifying the windows incorrectly, then you might want to add additional Description properties to the test object in the OR so that it can lock onto the right one more reliably. I usually use GUISpy to spy on something on the page, then in Object hierarchy I click on the top object (the browser), then click "Copy identification properties to the Clipboard" button, then paste the results into a notepad. Find one of those properties that uniquely identifies the browser objects from anything else. Sometimes I have to use the URL property (with some REGEX magic to isolate the specific page without making it TOO specific)

Should ShellExecute be used to open default mail program and how can be properly done?

I have found in my company's codebase a code to open default mail program using ShellExecute. The code is written long time ago, but I've notice strange behavior on it, the problem only occurs when the debugger is not attached.
if ShellExecute(Handle, PChar('open'), PChar('mailto:donotreply#nonono.com'), nil, nil, SW_SHOWDEFAULT) <= 32 then
begin
//...
end;
Above is the relevant part of the code. Handle is the Form handle.
To reproduce the problem, simply create a new project, add a button on it and call this code on the button onClick event handler. It is also necessary to not have a default mail installed, so windows will display an message warning about that.
When debugging, the message Z order is higher than the application, so the message box is properly displayed and the user can close this message.
When not debugging, the message Z order is lower than the application, so the user has to alt+tab to see that message.
I don't have enough knowledge to understand what is happening nor to state if that behavior is correct or not.
Is there anything I can do to properly display the message box in a higher Z order than my application?
Is this code deprecated? Should I move forward to a different way of doing this, if so, how?

Google App Script Debugger not working on ClickHandler callback

I've followed the Google app script tutorial here which is a very simple script with two functions. showDialog (which presents a dialog box with a text field and submit button ) and respondToSubmit(e) which handles the submit button and adds the entered data to the spreadsheet.
It works fine.
What doesn't seem to work is the debugger on the callback. So I place a breakpoint in both functons and start the showDialog function. The debugger kicks in and stops execution at the breakpoint. I click continue so I can interact with the newly opened dialog box. However when I click the submit button the debugger does not start again. The respondtoSubmit(e) function is executed. The debugger just does not stop on the breakpoint(s).
Is there a problem with debugging callbacks like this or can you only debug one function at a time?
For reference Utilities.jsonStringify(e) is depricated, use JSON.stringify() and JSON.parse() instead.
As of right now, the debugger has some unexpected behaviours. Mostly, it seems to only respect breakpoints during calls from the script editor, so to debug your event handler you must call it from the debugger, not the UI. If you need to peek into variables such as the event object passed to the function, for example, try adding this line to your handler where you'd normally put a breakpoint:
Logger.log(Utilities.jsonStringify(e));
Then view the log from the script editor after execution.
It seems to me that the Logger does not work either, unless run from the script editor. I did manage Browser.msgbox(Utilities.jsonStringify(e)) which had brought the (expected) result:
{"parameter":{"clientY":"45","clientX":"37","eventType":"click","ctrl":"false","meta":"false","source":"u12053277590","button":"1","alt":"false","myTextBox":"babi","screenY":"381","screenX":"598","shift":"false","y":"13","x":"33"}}

Resources