I am trying to get rid of lots of warnings in a project after converting it from BDS 2006 to Delphi 2009.
The project needs a type library named MSHTML_TLB. The source file mshtml_tlb.pas is an incredibly large file (about 16MB and >440.000 lines of code) which is generated when the Type Library is imported into Delphi 2009.
This file produces many warnings when building the project:
W1010 Method 'ToString' hides virtual method of base type 'TObject'
Since Delphi itself has created that file, I am wondering why these warnings come up and if I should just ignore them?
If so, is there a way to disable this kind of warning just for this file?
Delphi introduced this virtual method in TObject. Your declaration of ToString in a derived class does not use override so the ToString method of TObject is not accessible anymore. Adding override to your ToString method should solve the problem unless you declared your method differently.
Write to the beginning of the MSHTML_TLB.pas file this line (in bold):
unit MSHTML_TLB;
{$WARNINGS OFF}
and at the end:
{$WARNINGS ON}
end.
As a last resort, you can hide warnings. In Delphi 2010 this is in Project Options/Delphi Compiler/Hints and Warnings. I think this particular warning is "Redeclaration of a symbol hides a member in the base class".
Start up Delphi.
On the "Component" menu in the main toolbar select "Import ActiveX Control..."
In the list box scroll and and select "Microsoft HTML Object Library".
The "Class names" should then list "TScriptlet".
Click "Install...", then click "OK" on the "Install" form that appears and "Yes" on the confirm prompt.
Related
I added a TOPenDialog component to a form and am writing the menu method to operate it. I copied code from a VCl project including the line openDialog1.Options := [ofReadOnly];.
The compiler rejects it since ofReadOnly (and other options) are not recognized. The TopenOptions type is included in VCL.Dialogs but does not seem to appear in the FMX version.
I am currently using the Delphi starter version which does not include the FMX.dialogs.pas file text so I cannot add the options into the unit. WIll including the VCL.dialogs file in the Uses section fix this? I have heard that it is not a good idea to mix VCL and FMX units together in the same program.
If you read Embarcadero's documentation, you will see that the FMX.Dialogs.TOpenDialog.Options property uses the same System.UITypes.TOpenOptions type that the VCL.Dialogs.TOpenDialog.Options property uses, so both dialogs have the same options available.
The reason your code is not compiling is because the TOpenOption enum has been declared with the {SCOPEDENUMS ON} directive enabled (see Scoped Enumerations). You need to prefix scoped enum values with their containing enum type name, eg
uses
..., System.UITypes;
OpenDialog1.Options := [TOpenOption.ofReadOnly];
I have an extension for a tabControl downloaded, im a newbie at delphi could somebody please tell me how i can make use of it in my current project.
I have downloaded the following file and saved it as FMX.Extensions.UX.TabControl in my project folder from here and added it to my uses on project1.
TabControl Extension
i have a project1 with a tabcontrol and a few simple items on each tab, can somebody help me in learning how to use this extension, i have no idea where to go from here.
Kind Regards
UPDATE:
I added this to my includes under form1.
{$R *.fmx}
{$I 'FMX.Extensions.UX.TabControl.pas'}
But now when i try to compile the project in delphi XE5 i get the errors.
[dcc32 Error] FMX.Extensions.UX.TabControl.pas(1): E2029 Declaration expected but 'UNIT' found
[dcc32 Error] FMX.Extensions.UX.TabControl.pas(53): E2003 Undeclared identifier: 'TIntAnimation'
[dcc32 Error] FMX.Extensions.UX.TabControl.pas(54): E2007 Constant or type identifier expected
[dcc32 Error] FMX.Extensions.UX.TabControl.pas(65): E2029 Declaration expected but 'IMPLEMENTATION' found
[dcc32 Fatal Error] FMX.Extensions.UX.TabControl.pas(65): E2226 Compilation terminated; too many errors
You need to first install the UX package. You can find it under Packages/ FMX.Extensions.UX.dproj. To install, open the package in the Delphi IDE then right click and select install.
You should also remove the line you added to the form ({$I 'FMX.Extensions.UX.TabControl.pas'}).
Disclaimer: I am the author of this component.
To add a Delphi unit to you project you need to add it to one of the uses clauses in each unit file where it will be referenced.
The structure of a unit file is:
unit <unitname>;
interface
uses <files>;
//interface declarations
implementation
uses <files>;
//code here
end.
Each uses statement takes a comma separated list of unit names, so for you this would be
uses FMX.Extensions.UX.TabControl;
As a general rule you should place the units in the uses statement of the implementation section unless anything in your interface section references it, in which case us that in your interface section. Units referenced in your interface section can lead to issues with circular unit references.
Depending on where you save the file you may also need to add it's location to your library, either under Tools/Options/Delphi Options/Library/Library Path (for all projects) or Project/Options/Delphi Compiler/Search Path (current project only).
(I would recommend saving third party code in it's own folder so you have a record of what code comes from where).
The code you are including adds components which are used at design time. These components need registering with the IDE, which #norgepaul has explained how to do. If you use these components at design time then Delphi will add them to your uses clause for the form for you.
I want to use the function Sign() in a Borland C++ Builder 6 application. I cannot however find the correct header file.
When I use this function I get a compiler error saying undefined symbol, Sign.
You would think this function would be in math.h but I can't find it there. It shows up in the help list (Unit : Math).
I saw some threads for similar missing function definition (stddev for example). A solution was to add the option -lm or -lc to the compiler. But how to configure it in Borland C++ Builder graphical interface for compiling options ?
You are looking for Math.hpp. When the help says "Unit: ...", it is referring to a Delphi unit. These are made available to C++ via Unit.hpp header files generated by the Delphi compiler. math.h is a separate header file provided by the C runtime instead.
I am writing a class to handle security in my executable (checking serials, trial date check etc). After I compile the executable (even in Release build, with all debug and RTTI generation turned off), when I open it in NotePad and search the method name in the raw data, I can see all the names of the methods that assemble my class. There are no published members in any class in the code base.
This is bad for protection. Is there any way to tell Delphi not to store method names in the executable ? Why is it storing them at all if there is no RTTI needed and no COM explosion? Is there any compiler option controlling this?
It may be that ANY method of ANY class in the target executable is stored inside the executable in text form. Apparently this is caused by the extended RTTI being turned on by default for all classes in Delphi 2010.
If you are asking about the extended RTTI in Delphi 2010, it can be switched off by
{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
see also docwiki.
Also strip relocations, take up the following in the project's dpr file:
{$IFDEF RELEASE}
// Leave out Relocation Table in Release version
{$SetPEFlags IMAGE_FILE_RELOCS_STRIPPED}
{$ENDIF RELEASE}
... and don't forget to turn off "td 32 debug info" (in older versions) or debug info in the linker tab in later ones.
What you probably will see is your form definition as a resource (eg the binary represetation of the DFM files of your project).
If you don't want to show these (for the serial info screen etc) you shouldcreate these forms "in code". Eg create a TForm, place a TButton and TEdit onto it, attach the event handlers in code.
To do this in a handly way: start with a form and create the DFM. When vieing the form, choose View as text from the context menu and you will know what things you should copy into code. And make sure NOT to place any varaiablerefernces under de published (always put public/protected/private as the first line within your class definition.
I'm getting the error: wintypes.dcu not found several times a day in the Delphi 2009 IDE, after this error code completion stops working, also I can't open any unit's source code with Ctrl + Click, then I have to reopen the IDE to fix it.
Anyone has a clue about what can be causing this?
The only IDE extension I have installed is GExperts.
wintypes.pas and winprocs.pas has been replaced with windows.pas (since a long time). You should use Unit Aliases to replace all wintypes with windows.
You must be still using the ancient (pre-Delphi 2) names for what is now the Windows unit. I recommend that you search and replace all your uses lists and replace WinTypes and WinProcs with Windows.
Alternatively, you can make sure you have "WinTypes=Windows" and "WinProcs=Windows" in the Unit Aliases section of your project options, but still, after all these decades, I'd move on to the 32-bit world! (16-bit being the prime limitation that meant WinTypes and WinProcs were two separate units.)
Open Project - Options, Delphi Compiler ,into Unit aliases insert:
WinTypes=Windows;WinProcs=Windows;DbiProcs=BDE;DbiTypes=BDE;DbiErrs=BDE
Do you use the Decision Cube component? So look for references on the unit MXQEDCOM.pas in your sources.
On BDS 2006, is the only reference for Wintypes and Winprocs I found.
By the way, make sure that the Unit Aliases included the values that Barry Kelly wrote.
Why wintypes.dcu cannot be found any longer, I do not know. But the other two are obvious follow up errors: if Delphi cannot compile the code due to syntax errors (and a missing file is considered a syntax error), it stops code completion and cannot locate source code any longer using Ctrl + Click.