Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodCode SnippetDelphiDemoFiremonkeyIOS

Build A Dialog Like UIActivityIndicatorView For Delphi XE5 Firemonkey

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi XE5 Firemonkey Working Dialog | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSI put together a demo of a Working Dialog form for Delphi XE5 Firemonkey mobile projects. I mainly built it for IOS to look like UIActivityIndicatorView but I’ve modified it so that it also works on Android. Basically it has a form called TWorkingForm that you can display any time you want to do an operation that may freeze up the app. The dialog is designed to look like the native IOS working dialog. The Transparency property is set to True and the BorderStyle is set to bsNone on the TWorkingForm. On IOS this allows you to have a transparent form that floats over your main form. The main reason why you would want to use a form like this instead of just having a TLayout on your main form is because of TWebBrowser or any other native control. TWebBrowser wraps around UIWebView which hovers over your form and above any TLayout as far as I can tell. This also applies to any of the native controls from TMS iCL. When you use the TWorkingForm dialog it will be above the TWebBrowser. For Android I couldn’t get the transparent form working so instead it takes a screenshot using MakeScreenShot and uses that as the background of TWorkingForm. You could take the WorkingPanel which is a TRectangle from the TWorkingForm and just add it to your own project if you don’t use any native controls that it has to float over. Here is the function that you can use to call TWorkingForm:
procedure TTabbedwithNavigationForm.WorkingMsg(Text: String; Working: Boolean);
begin
if Working=True then
begin
Application.ProcessMessages;
{$IFDEF ANDROID}
WorkingForm.bgImage.Bitmap.Assign(TabControl1.MakeScreenshot);
{$ENDIF}
WorkingForm.Show;
WorkingForm.AniIndicator.Enabled := True;
WorkingForm.WorkingLBL.Text := Text;
end
else
begin
WorkingForm.AniIndicator.Enabled := False;
WorkingForm.WorkingLBL.Text := Text;
WorkingForm.Close;
{$IFDEF ANDROID}
WorkingForm.bgImage.Bitmap.Assign(nil);
{$ENDIF}
TabbedwithNavigationForm.Show;
end;
end;

In the demo the example work is a TRESTClient that uses ExecuteAsync. When ExecuteAsync comes back in the OnAfterExecute event you hide the TWorkingForm. I did not use an extra thread to make this TWorkingForm happen (check out our other post for a multithreaded working dialog). You could combine this working form with the multithreaded working form to get the best of both.

Download The Delphi XE5 Firemonkey Working Dialog Demo

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts
DelphiDemoFiremonkeyLinuxOSXShowcaseWindows

AutoBlogAI: FireMonkey Client To Leverage LLMs And Generative AI For Blogging

DelphiFiremonkeyShowcaseUtilityWindows

Unleashing Creativity With Song Writer AI: A Deep Dive

DelphiFiremonkeyShowcaseWindows

How To Build Stable Diffusion Text To Image Prompts

AndroidC++BuilderDelphiFiremonkeyIOSOSXWindows

FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes

Sign up for our Newsletter and
stay informed

Leave a Reply