Delphi XE 5 / XE 6 Firemonkey custom component display problem

Hi everybody,

I've a problem and I would like to know if you have encountered the same type of problem, and better, if you have solved it. Let's go for the explanation!

With Firemonkey if you chose to create a new component derived from TListBox class with the wizard and you build and install it on a custom palet there is no problem. I mean that you can drag your own new component on a form and all is OK!

But if you are doing the same thing with the TCustomListBox class as ancestor you can create your component without problem but when you drag this new one on a form you have a blank component (more precisely a grey component "same color as the form by default" and nothing more even if you add some items).

When I use the two same methods on VCL that works perfect so I'm wondering what I'm doing wrong.

I've done many tests and played a lot with google but I'm always in the same situation (this monkey in fire make me crazy ;) ). The only clue that I found is that it could be a problem of styles but I don't know where and why.

For the most brave of you, here is the code of my simple component:
unit EricListBox;


  System.SysUtils, System.Classes, FMX.Types, FMX.Controls, FMX.ListBox, System.UITypes;

  TEricListBox = class(TCustomListBox)
    { Déclarations privées }
    { Déclarations protégées }
    { Déclarations publiques }
    { Déclarations publiées }
    property Align;
    property AllowDrag;
    property AlternatingRowBackground;
    property Anchors;
    property CanFocus;
    property CanParentFocus;
    property ClipChildren default False;
    property ClipParent default False;
    property Columns;
    property Cursor default crDefault;
    property DesignVisible default True;
    property DisableFocusEffect default True;
    property DragMode default TDragMode.dmManual;
    property EnableDragHighlight default True;
    property Enabled default True;
    property Locked default False;
    property Height;
    property HitTest default True;
    property ItemIndex;
    property ItemHeight;
    property Items;
    property ItemWidth;
    property DefaultItemStyles;
    property GroupingKind;
    property ListStyle;
    property Padding;
    property MultiSelect;
    property Opacity;
    property Margins;
    property PopupMenu;
    property Position;
    property RotationAngle;
    property RotationCenter;
    property Scale;
    property ShowCheckboxes;
    property Sorted;
    property StyleLookup;
    property TabOrder;
    property Visible default True;
    property Width;

    property OnApplyStyleLookup;
    property OnChange;
    property OnChangeCheck;
    property OnCompare;
    {Drag and Drop events}
    property OnDragChange;
    property OnDragEnter;
    property OnDragLeave;
    property OnDragOver;
    property OnDragDrop;
    property OnDragEnd;
    {Keyboard events}
    property OnKeyDown;
    property OnKeyUp;
    {Mouse events}
    property OnCanFocus;
    property OnItemClick;

    property OnEnter;
    property OnExit;
    property OnMouseDown;
    property OnMouseMove;
    property OnMouseUp;
    property OnMouseWheel;
    property OnMouseEnter;
    property OnMouseLeave;

    property OnPainting;
    property OnPaint;
    property OnResize;

procedure Register;


procedure Register;
  RegisterComponents('Eric', [TEricListBox]);


Thanks for your help
6/25/2014 10:05:07 AM
embarcadero.delphi.firemonkey 4901 articles. 4 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 42
Get it on Google Play
Get it on Apple App Store

FMX.Colors.pas has a TColorListBox which derives from TCustomListBox. Copy that code?

There is a GetDefaultStyleLookupName, DoItemApplyStyleLookup, and then Create and Destroy both do inherited;
6/25/2014 1:16:53 PM
Hello Eli and thank you for your help, now my problem is solved. I want to explain the solution and add some comments that perhaps you have answers.

I only need to use the "GetDefaultStyleLookupName" protected procedure to make it magical!

In fact I try to reproduce the same component (understand TlistBox) but with my customizations and in the same time to keep the TListBox features but without deriving from TListBox class as ancestor. So now that works but it lacks the right clic editor which allows creating items in the list.

It's very strange because when you look at the TListBox component declaration in the "FMX.ListBox" unit there is only some published properties. So I don't understand where is the call to the default "listboxstyle" and the items editor?

During my search I found this link [] but he doesn't explain the call to styles.

So now that works but I would like to understand why TlistBox doesn't need the additionnal declaration as in my own TEricListBox component?

Thanks again Eli for your help and good coding!
6/25/2014 2:24:34 PM
> It's very strange because when you look at the TListBox component declaration in the "FMX.ListBox" unit there is only some published properties. So I don't understand where is the call to the default "listboxstyle" and the items editor?

Style names derive from the component class names so you would need to add a "ericlistboxstyle" to your application syle to get a default style.
You could copy and paste "listboxstyle" and rename the pasted copy to "ericlistboxstyle" then hack about with it.
6/25/2014 2:35:03 PM
Hi everybody abd sorry for the delay,

Thank you Leslie for your intervention, I've taken your remark in consideration and after deep search I saw the mechanism your explain in the TStyledControl class with the "GetDefaultStyleLookupName" and "GetStyleObject" functions. So now it's more clear thank to you!

About the second problem regarding the items editor of the ListBox when you make a right click, it appears that, from another topic of this forum, is located in the "FMX.Editor.Items" unit. The declaration is "TListBoxEditor = class(TItemsEditor)".

In parallel I found a link  [] to the embarcadero documentation but the mechanism in this demo not seems to be used in the same way than in the TListBox component.

So I still not understanding how it's put onto the TCustomListBox class to be used by the TListBox? Perhaps it woul be better to make another topic regarding this question?

Thanks again for your help and see you.
6/26/2014 5:16:11 PM

Web resources about - Delphi XE 5 / XE 6 Firemonkey custom component display problem - embarcadero.delphi.firemonkey

Firemonkeys - GamesIndustry International
The world's leading games industry website. Get insight from todays industry leaders with news, interviews and analysis of global gaming trends. ...

Firemonkey’s Real Racing 3 To Launch At The End Of February
In September, Apple demoed Firemonkey’s Real Racing 3 at the iPhone 5 event . Three months later and the game has yet to show up in the App Store. ...

EA Games and Firemonkey Bringing Real Racing 3 to Android, Fasten your Seat Belts
Start up your engines race fans, EA Games is teaming up with Firemonkey to bring Real Racing 3 to mobile devices. If you’re a fan of more realistic ...

EA's Firemint and IronMonkey Studios Merge to Become FireMonkeys
... game development studios into one mega-studio in Australia. Firemint and IronMonkeys will be merged into a single studio now known as Firemonkeys ...

News: Firemonkeys announces Real Racing 3
Firemonkeys, a new gaming subsidiary of Electronic Arts born from the merger of FireMint and IronMonkey, has announced the coming release of ...

firemonkeys - iMore
EA has pushed out another impressive update to its equally impressive iOS racer, Real Racing 3, that for the first time brings cars from Ferrari ...

Firemonkeys on Real Racing 3 going free-to-play
... got a hands-on preview of Real Racing 3. We also spoke with Ptolemy Oberin, one of the game’s programmers and project lead at developer Firemonkeys, ...

Real Racing 3 coming in 2012 from Firemonkeys
The first game from recently merged developer Firemonkeys is Real Racing 3 , the developer revealed moments ago during EA's Summer Showcase event ...

Firemonkeys Previews Real Racing 3 for iPhone and iPad
Firemonkeys, the new combined studio from EA combining the IronMonkey and Firemint gaming studios, has announced the development of Real Racing ...

EA Mobile Moves: IronMonkey & Firemint Merge Into “Firemonkeys,” Now Have 50M Players Between
... that it is merging two top mobile game studios, IronMonkey and Firemint , which will fittingly combine to create a new company, called Firemonkeys. ...

Resources last updated: 2/16/2016 2:15:28 PM