If you are attempting to use FMX, read this before installing update 4

Update 4 has unfortunately two major FireMonkey issues. The first is that text now appears all fuzzy when the GDI+ backend is used. The second, and the one I will concentrate on here, is that it indiscriminately removes the ability to parent sub-controls to various other control types at design time. This is because

SetAcceptsControls(False);

has been added to the end of many a constructor. This is the equivalent of removing csAcceptsControls from the ControlStyle set property of a VCL TWinControl descendant. However, it usually makes little sense in a FMX context given any FMX control is inherently nestable with any other – complex controls are composed of less complex controls, which are themselves composed of ‘shapes’ (controls that are not styled because they *are* the style). As a result, the FMX TSpeedButton, for example, doesn’t have a Bitmap or Glyph property, or the FMX TStatusBar a Panels property. Rather, the idea is that you can just add a TImage or TLabel to either yourself… or at least you could, before update 4 artificially disabled this functionality.

If nothing else, the new restrictions make it is impossible difficult [see update below – another bug saves the day!] to replicate the ControlsDemo sample project. If you open it up, you will see the following-

  • The ‘Additonal’ tab demonstrating a TLabel and TImage being nested on a TButton:

  • The ‘TreeView and ListBox’ tab illustrating how flexible the FMX TListBox is by nesting a whole range of controls on individual list items (and not in a stupid way I should add):

  • A TStatusBar down the bottom with various controls parented to it:

Initially coming across this issue with respect to list boxes, I reported it to QC (link), upon which the report type was soon changed to ‘feature specification issue’ and the severity to ‘extreme corner issue’ – the changer did not identify themselves, and didn’t actually open the report either. After putting it back, I then received a not completely clueless (dare I say even reasonable?) response from everyone’s favourite QC guy, so that’s some sort of progress. While he has downgraded both the report type and the severity once again, they haven’t been downgraded to the frankly insulting level they were downgraded to before. The main problem isn’t QC though – it’s the fact the people working on FMX are managing to make it worse compared to what what it was like back in September.

Update: the structure pane (top left of the IDE by default) ignores an FMX control’s AcceptsControls property, as exposed by the IControl interface. This is surely a bug (after all, it doesn’t ignore csAcceptsControls in a VCL context), but at least it enables a workaround – add the intended sub-controls to the form, then drag them onto their proper parent in the structure pane. In the case of TStatusBar this possibility is just as well, since without it, update 4 would have rendered that particular control completely useless, since there is no other way to add text to a FMX status bar but via nested TLabel or TText controls.

Advertisements

7 thoughts on “If you are attempting to use FMX, read this before installing update 4

  1. I second Deksden’s comment. If EMB wants people to take FireMonkey seriously as a cross platform UI, every release has to be a significant step forward in addressing bugs, and fleshing out the framework. It certainly doesn’t give EMB QA a good rep when they admit to a significant problem requiring a hot fix immediately after the update, and then you find something like this….

    Makes Developer Express look like geniuses for waiting to see how FMX developers before investing in any R&D.

    • That’s supposedly for something else (the blurry fonts). The fact my QC report was initially downgraded to ‘extreme corner case’ and ‘feature specification issue’ suggests they weren’t aware of the problem, even though it becomes blindingly apparent if you try and actually use the thing.

  2. Well this reminds me of mine QC report. I found a bug in RTTI caused by uninitialized variable. I pointed out the live of code where the problem is… and the issue was closed with resolution “can’t reproduce”. It took them 3 years to fix it.

    I never ever reported anything in QC since then. It’s easier to hack your way through the code than to pass first level of support in QC.

  3. If they had disabled parenting controls entirely, that would have been a mistake. But it looks to me like they’ve disabled controls being created parented when you have another control selected in the designer – something that many people may have found confusing, because if (for example) you have a TButton selected in the VCL designer and you add another control, it doesn’t become parented to the button. The vast majority of controls are like this – csAcceptControls is false. Maybe it would have made more sense if they’d only changed this for the FMX equivalents of the VCL controls that don’t accept children.

    So, that may be a rationale for it. I think “don’t install Update 4” is going over the top, because you can change controls’ parents in the Structure view.

    I think this change is a significant mistake, though. Potentially confusing or not, FireMonkey’s controls’ ability to accept child controls is one of the wonderful things about it. Hiding / preventing that by default is not a good idea.

    • The blog title was written before I realised the generality of the structure pane workaround (hence the ‘update’ at the end), but yes, I would have titled it differently otherwise, notwithstanding the fact I think the structure pane thing is itself a bug.

      Your suggested rationale also sounds plausible, rather more plausible indeed than my own back when I first discovered the issue with list boxes (see the the QC report). Why disable accepting controls for TStatusBar however…?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s