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

AndroidAppmethodCode SnippetDelphiDemoFiremonkeyIOSOSXWindows

Dynamic Runtime Menus With Actionlists For Delphi XE5 Firemonkey On Android And IOS

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

Delphi XE5 Firemonkey Ipad Listview Menu | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSAndrea Magni has a blog post up where he demonstrates how to dynamically create a menu from an ActionList at runtime and how to use ApplyStyleLookup to customize TListView it background colors. The supplied source code should work for Delphi XE5 Firemonkey on Android and IOS. The main content of the application is contained inside of a TTabControl and then the menu itself pulls down from the top of the application. An arrow and rectangle are setup at the top of the app. When you click the arrow the menu drops down revealing the TListView. The listview is populated from a TActionList which allows you to easily use the Delphi IDE to manage your menu items. The next trick used is in the ApplyStyleLookup event of the TListView. The item background colors are customized using the following code:
procedure TMainForm.MenuListViewApplyStyleLookup(Sender: TObject);
var
LStyleObject: TFmxObject;
begin
// hack the ListView style to have a dark background
LStyleObject := MenuListView.FindStyleResource('itembackground');
if LStyleObject is TColorObject then
TColorObject(LStyleObject).Color := TAlphaColorRec.Slategray;
end;

Head over, read the full blog post about the dynamic menu and custom styles, and download the source code.

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