delphi-2010

How to add new project template to Delphi

I remember doing this in Delphi 7, but I don't remember how, or it is different in the new Delphi IDE. But how do I add a new template to the items gallery? So then it will show up under the File / New menu. ...

Resuming suspended thread in Delphi 2010?

TThread's resume method is deprecated in D2010. So, I thought it should now work like this: TMyThread = class (TThread) protected Execute; override; public constructor Create; end; ... TMyThread.Create; begin inherited Create (True); ... Start; end; Unfortunately I get an exception "Cannot call start on a running or supsen...

Which Third Party Components Have You Installed Into Delphi And Why?

Which third party components have you installed into Dephi and why? I'm moving from D5 Enterprise to Delphi 2010. I haven't installed 3rd party tools in the past but I did upgrade to QReports Pro and TChart Pro. I will writing database apps so lots of inserts, updates & deletes will be going on. Database queries, searches and filtering...

Delphi: A generic list of generic-descendants and taking a generic as a parameter

I struggle a little with the understanding of generics and how they can and can not be used. I have a generic class TControlMediator like this: TControlMediator<C, T> = class private FMediatedComponent: C; public constructor Create(ComponentToMediate: C); function GetValue: T; virtual; abstract; procedure SetValue(Value: T); v...

Delphi 2010 or 2007 for upgrading Delphi 3 project?

I've just received an assignment to upgrade an old Delphi 3 project that I wrote in 1999 to a newer version and add features (I previously discussed this in related questions here and here). I was assuming that the appropriate route would be to first upgrade my development environment to Delphi 2010 and then port the application. I'm n...

Delphi 2010 with earlier compiler

Is it possible to use de Delphi 7 compiler inside Delphi 2010 IDE? We want to migrate at some point in the future to 2010 from D7 but for now we are stuck because of many unUnicode sources and components. But we want to enjoy the many many Delphi 2010 IDE features everybody are talking about. Is it possible? How it's done? What are pro...

Getting size of a file in D2010?

Delphi 2010 has a nice set of new file access functions in IOUtils.pas (I especially like the UTC versions of the date-related functions). What I miss so far is something like TFile.GetSize (const Path : String) What is the Delphi 2010-way to get the size of a file? Do I have to go back and use FindFirst to access TSearchRec.FindData?...

Loading BDE BPL from another directory

Using Delphi 2010 and a patched version of the BDE I run into a problem loading the BDERTL140.bpl. Loading DCLBDE140.bpl from another directory then usual works fine. Only when I want to load the BDERTL140.bpl, it always tells me that it has been loaded already from the Windows system directory. Which packages load the BDERTL140.pbl, a...

How can I efficiently retrieve the number of files in a directory?

Is there a way (on windows using Delphi 2010) to get the number of files in a dirctory without actually traversing all files? I want to implement a progress bar during some file system indexing operation. For that reason I need to know how many files are in the directory. What is the fastest way to get the number of files in a director...

Case-insensitive Bob Jenkins Hash?

Is there a case-insensitive variant of the Bob Jenkins hash function? Generics.Defaults.BobJenkinsHash provides a fast hash function. Unfortunately it cannot be used in combination with a case-insensitive compare function like so TCustomStringComparer = class (TEqualityComparer <String>) function Equals(const Left, Right: String): ...

Can I Have Unnamed Dynamic Array Types as Var Parameters

Using D2010, I'd like to do something like this: procedure SizeArray(var aArr: array of integer; aSize: integer); begin SetLength(aArr,aSize); end; But this fails to compile. Because my "aArr" parameter isn't a dynamic array, it's an open array parameter. And SetLength cannot be called on it. The only way I know of to force the para...

Encolding error in the d2010

Hello I am testing Delphi 2010 and I was with the following mistake: Do I enter with this chain of characters "096 - Construção Ltda" and do I only move her/it for another variable and do look at him/it what leaves "096 - Construção Ltda", does anybody know how to find out that that??? Entrance base 001 Alcides João Pereira 002 Alvir...

How do I (or if I can't) use Variants on simple DLLs?

I want to expose some functionality of a internal object as a DLL - but that functionality uses variants. But I need to know: I can export a function with Variant parameters and/or return - or is better to go to an string-only representation? What is better, from language-agnostic POV (the consumer is not made with Delphi - but all wil...

RTTI: Can I Get a Type by Name?

Given a text string containing a type name, is there some way to get the appropriate type itself? I'm looking to do something like this: type TSomeType<T> = class // yadda yadda end; procedure DoSomething; var obj : TObject; begin o := TSomeType<GetTypeByName('integer')>.Create; // do stuff with obj end; I've looked at...

Charting recomendations for Delphi

I'm looking for a decent charting library to use with Delphi 2010. We dont want to require additional framework be installed on client PCs, so would like to avoid toolkits that use .Net, Java or Flash. The chart types we need are pretty straight forward (2D and 3D pie/donut, bar, line), but the customer wants to have attractive charts ...

Delphi 2010 - package problem, File not found error

I have a problem with a application with plugins. Originally, everything was compiled into a single exe, but now, I want to take out some of the code into a bpl on its own. The code that is shared by both the exe and the new bpl is put into a third bpl. application.exe is compiled with package api.bpl api.bpl contains only one file, ap...

onKeyUp Delphi skipping ever other occurrence

Am using TJvUltimGrid, when pressing either the up or down arrow, to move from one record to the next, the event fires every other press. Does anyone have any ideas why it does not fire on every press and what I can do to fix it? The dataset is a TADODataSet. The onKeyDown fires on every press. REF: Delphi 2010 with Jedi JVCL Version ...

Trouble playing with indexed propertes via new RTTI [D2010]

ShowMessage(TRttiContext.Create.GetType(TStringList) .GetProperty('Strings').ToString); Above code fails as .GetProperty returns nil on properties like "Strings", "Objects", "Values" (ones with indexers). I assume this is a known limitation and the question is if there's any way to access those indexed properties (preferably with...

What is a good library for creating PDFs in Delphi 2010?

What is a good library for creating PDFs in Delphi 2010? Pre Unicode I used PowerPDF, which though obsolete, was flexible enough to do what I wanted to do (very customized non-db/table based reports) I currently have PowerPDF compiling in Delphi 2010, but not yet working, and I'd rather not port and debug if there are any good Open Sou...

Abort a thread?

I want to implement interruptable tasks based on background threads. What is the cleanest way to implement the TTask.Stop method? How can I abort the background thread? The code executed within the thread context is passed to the task using an anonymous method and can contain blocking calls, so I can't rely on the fact, that the Termina...