TControl – Explicit
Can someone explain the purpose of ExplicitTop, ExplicitLeft, ExplicitWidth and ExplicitHeight in TControl and descendants?
In particular – why are they in the .dfm?
TControl – Explicit
Can someone explain the purpose of ExplicitTop, ExplicitLeft, ExplicitWidth and ExplicitHeight in TControl and descendants?
In particular – why are they in the .dfm?
from here: http://jedqc.blogspot.de/2006/02/d2006-what-on-earth-are-these-explicit.html
The Explicit properties remember the previous bounds of a control before the Align or Anchor properties are changed from their defaults.
The only time the Explicit properties are not written is when the Align property is set back to its default value of alNone.
This is when the Explicit properties are actually used by the control to reset its bounds to what it was previously.
Enlightening, but I still loathe them.
What’s wrong with them ?
They exist to annoy us.
same question with interesting answers and comments – http://stackoverflow.com/questions/2476690/delphi-why-does-explicitwidth-and-explicitheight-keep-appearing-in-dfm-files . And per documentation http://docwiki.embarcadero.com/Libraries/XE3/en/Vcl.Controls.TControl.ExplicitHeight – “ExplicitHeight is a read-only property used internally by Delphi. Use Height in applications to allow read and write access.”. So, only Embt can give you an answer
Bill Meyer
Well, other than with version control, how can they annoy you ?
I don’t think they are a problem even in a VCS. The coordinates don’t change unless you do some serious editing of the form, so there won’t be a version bump.
If you really hate them, then click the “Do not store the Explicit* properties into the DFM” checkbox in the DDevExtensions setup.
Markus Joos When porting projects to D7 that were built in XE.
If you just want them removed: There is an option in DDevExtensions to not write Explicit* properties.
http://andy.jgknet.de/blog/ide-tools/ddevextensions/
• Remove Explicit* properties (default: off)
Martin Wienold I think there is an echo in here 🙂
Kevin McCoy Sorry, I did not expand your reply.
Kevin McCoy They get added and removed every other time, so it’s not that the coordinates change, as much as the properties alternate being there and not being there… very annoying!
Precisely!
Asbjørn Heid I think I said that. 😉
Bill Meyer Well, they are so very annoying it cannot be mentioned enough 😛
Asbjørn Heid Can’t argue with that! 🙂
To me these properties serve a need (guess what, they were “vocally” requested by Delphi users), that is getting a control back to its original position if you toggle its alignment, as explained also here.
If they are added and removed “randomly” (alternative being there and not begin there), even if you don’t touch any of the related properties, that is it a bug (and maybe already reported) we should fix. If they are added according to the specs… I’m not sure I’d agree with the request of removing them completely.
They should live in the TControl objects while you are editing them, but once you save – they should be gone. IMO, there is no need to keep these between editing sessions.
Lars Fosdal I disagree. While I was not one of the “vocal” proponents of the feature, I kind of like the new behavior after stumbling across it. It was a pain when you shut off alignment and your visual component went flying off into the stratosphere. I had to manually tweak the Top and Left coordinate properties to get the component back on to my form. Now they sort of implode, but stay within the boundaries of your form – much easier/faster to work on complex forms.
Marco Cantù Yeah it’s primarily the buggy nature that annoys me. At least in XE3.
Lars Fosdal I think you are right in this. I also think the names are terrible, as they do nothing to indicate the purpose. DesignWidth, DesignHeight, etc., would have been more clear.
Asbjørn Heid do you (or someone) know if a specific bug is logged?
Even if the names were not the best, changing them at this point would be dreadful, imho.
Marco Cantù I agree, changing them would be a Bad Thing now.
Marco Cantù I’m pretty sure I saw a QC on it. It might even have been fixed, we’re still on XE3, probably for a good while. I’ll do some digging.