Delphi xe2 and filectrl unit - delphi

i have this problem; i need call filectrl unit in a my unit. Of course, i do: uses filectrl in interface section but it not is detected. I have tried too with system.filectrl but not found too this.
I have searched in help (online and local) but there is wrote that unit is correct. I use delphi xe2, too you have same problem? Have solved it? If yes as you done?
Thanks very much.

The full name of this unit in Delphi XE2 is:
uses VCL.FileCtrl;

The scoped name you need is Vcl.FileCtrl.

You can either use Vcl.FileCtrl, as others have already written, or you can add Vcl to the Namespace prefixes in the project options. The ellipsis button for that shows an editor for such prefixes. To be like XE, you can e.g. add System, Vcl and Winapi as prefix.
But I would only do the latter (Namespace prefixes) if I were using old code.

Related

Highlight variable and function names in Delphi XE4

I have to analyze a lot of Delphi code in XE4.
For that I'm missing a feature to highlight a variable or function/procedure name by just clicking on it (like Eclipse or Netbeans does).
Is there an option for this I haven't found so far or can this be fixed with an addon?
I recommend you to try CnPack. It greatly enhances IDE and also adds this feature.
You can also use the built-in Find function. When you do, it highlights all of the matches in the entire file. Best of all, no add-on is required!

Delphi xe , unit dbExcept , not found. was in delphi 2009

In the db, did Embarcadero removed the dbExcept?
Was it removed or replaced?
What could replace it?
That unit and the code it contains has gone. But it doesn't look as if it actually did anything. I suspect it was vestigial code that had long ceased being used but was left in place. The code in that unit was not referred to by any other source code unit supplied with Delphi.
I expect you have a stray DbExcept in your uses clause that can simply be removed.
It seems to be part of Borland Database Engine (BDE), which is deprecated. Is it installed?

Any tool to suggest unit reference automatically for Delphi 2010?

MS Visual Studio has a great feature: it automatically suggests the units to add in using clause when you typing the code with refrences to absent standard classes.
Is there any 3-rd party tool to implement similar feature for Delphi?
I'm tired to add all those SysUtils, Windows, Messages etc in each new unit.
If the unit which contains the reference is not yet in the uses list, this is how I save many manual steps:
right-click on the underlined (error-insighted) text
choose “Refactoring | Find Unit…“.
A dialog will present the available unit which contains the unknown type or symbol, and a mouse click adds the selected unit to the uses list of the current file.
CNPack Input Helper can sugest and autocomplete units (sorry for another answer, but I can't comment other).
CNPack unfortunately don't auto-add units from place of code input but you can:
Copy a word from cursor place (CNPack->Editor enchancements->Tabset/Button->Clipboard operations->Cut/copy token...).
Eventually search this word in source files (grep) to identify unit.
Use CNPack->Toggle Uses/Include Field (Ctrl+u) and start typing and use CNPack->Input Helper sugestion/autocompletion, or IDE/GExperts/CNPack use unit future
Back to place of code edition
The JCL includes the "Uses Wizard." It watches for compilation errors mentioning "Undeclared identifier," and when it sees one, it automatically adds the unit where that identifier is declared.
The package JclUsesExpert.dpk is only available for certain Delphi versions. I don't know if that's because the plug-in doesn't work in later versions, or if someone merely neglected to copy the project into later versions' folders.
This is not a tool to suggest references, it only cleans up unneeded unit clauses.
CnPack IDE Wizards is an excellent opensource plugin for Delphi.
http://www.cnpack.org/index.php?lang=en
I use its Uses cleaner feature a lot.
There is a menu item:
CnPack->Project Enhancements->Use Unit
I think this can be helpful for your needs.
Or maybe you can try this:
http://www.epocalipse.com/products.htm
Unit Expert
"A freeware Delphi add-in that allows you to quickly open units and also add them to the uses clause."
I never tried this expert but it semms promising.
The rFindUnit IDE extension is the enhanced version of built-in "Refactoring | Find Unit…" function suggested by #mjn above.

Shrinking exe by removing RTTI

In this question (link) it was said that the line below (in each unit) would remove as much RTTI as possible:
{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
The posting didn't mention what Delphi version it works with, but I assume D2010. However, when I include the line above, I get this error:
DCC Fatal Error: E2158 System unit out of date or corrupted:
missing TVisibilityClasses.
I'm using a "stock" version of D2010 and have never done anything that I'm aware of that would change the default installation or the libraries.
Any suggestions? TIA
Related question: link.
Make sure you put the "{$RTTI" line below the "unit unit1;" line.
Note that as of XE5 and newer, this directive needs to be in each individual unit for which you want to disable RTTI. Before that (as in comments, which applies only to XE4 and below) it could be in the DPR file and would apply to all units in the project.
The new RTTI is for Delphi 2010 and up.
It can be removed, but then lots of things will have limited functionality (like JSON conversion, part of DataSnap and many of the newer 3rd party libraries that do ORM or other mappings).
Things depending on TValue are gone anyway.
"old style" RTTI (which was introduced in Delphi 1 and is still present in Delphi 2010) cannot be removed.
So: it is recommended to remove RTTI only from your own units, and not from the RTL and VCL.
--jeroen

How can I set the $RTTI directive for the entire project?

I'm working on migrating an old project from Delphi 2007 to Delphi 2010. One thing I've found is that the resulting executable has more than doubled in size, and the original was already quite big. (Over 50 MB.) I suspect that a lot of it has to do with extended RTTI.
Since the project predates Delphi 2010, it doesn't use extended RTTI anywhere, and I'd like to be conservative about including it. Is there any way to use the Project Options dialog to globally set {$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])} as the default? I'd have expected there to be an option for this (and for $WEAKLINKRTTI) somewhere, but I don't see them.
Does anyone know if this can be done from the "Additional options to pass to the compiler" field, or some other way? I'd really prefer not to have to add an include file to every single unit in the project, as there are a few thousand of them...
The behavior of the $RTTI directive has been changed since XE6 because actually it was a bug because it was supposed to be local to the current unit (and it was actually documented as that since Delphi 2010).
Also it could have fatal affects using the directive at all even in one unit because due to the bug it basically switched a global flag affecting the following units (as in the order of compilation).
You can try with the dcc32 –$weaklinkrtti command-line option. (like {$WEAKLINKRTTI ON}).
But that has not the impact of {$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])} in each unit.
Your best bet would be to have it at the top of each unit in an include file.
But then it wouldn't do it for the VCL/RTL which would still be inflated....
Update: Also make sure you compare what's comparable. For instance verify if you don't include debug information in the Linker Options in the new D2010 project where you may not have it in the D2007 one...
In a comment on Mason's own blog, in response to a comment of mine, Mason answered this question.
Try putting these two lines at the top
of your DPR, before the USES clause:
{$WEAKLINKRTTI ON}
{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
This will make sure that no RTTI gets
generated for your own code or any
third-party libraries you use, unless
they’re in a unit where RTTI
generation is explicitly enabled. You
can’t turn it off for the RTL or VCL,
but that shouldn’t add very much to
your size anyway.
Are you certain this is caused by the new RTTI info? While it's a lot of data it shouldn't really double the size of your application.
Check that it's not including debug info in the release build executable.
(Project options -> Delphi Compiler -> Debug information should be False)
As for the question, I use {$WEAKLINKRTTI ON} before the uses clause in the dpr file and it seems to work fine.
I don't know of such an option, but I still would use an include file.
I wont be a problem for any experienced Delphi programmer to write a small program to add an {$i ProjectIncludeFile.inc} to any unit in your folders (immediatly after the unit line).
And that way you can use it for whatever purpose you like.
I myself use if f.i. to set a WriteTempFiles compiler directive (which I use f.i. to save stringlist contents at various places when developing the program), that way I can disable it in one place when the program is ready for deployment.
Since most of my projects involve multiple executables and/or dll's, this is the easiest way to accomplish this globaly for the whole project.

Resources