delphi

Delphi 2010 - Why can't I declare an abstract method with a generic type parameter?

I am trying to do the following in Delphi 2010: TDataConverter = class abstract public function Convert<T>(const AData: T): string; virtual; abstract; end; However, I keep getting the following compiler error: E2533 Virtual, dynamic and message methods cannot have type parameters I don't quite understand the reason why I can't d...

Reducing decimal places in Delphi

I am storing a list of numbers (as Double) in a text file, then reading them out again. When I read them out of the text file however, the numbers are placed into the text box as 1.59993499 for example, instead of 1.6. AssignFile(Pipe, 'EconomicData.data'); Reset(Pipe); For i := 1 to 15 Do ReadLn(Pipe, SavedValue[i]); Close...

How to free control inside its event handler?

Hi, Does anybody know the trick, how to free control inside its event handler ? According delphi help it is not possible... I want to free dynamicaly created TEdit, when Self.Text=''. TAmountEdit = class (TEdit) . . public procedure KeyUp(var Key: Word; Shift :TShiftState); end; procedure TAmountEdit.KeyUp(var Key: Word; Shift :TSh...

Inverse function of FormatDateTime

i am looking an funtion to reverse any string (YYYYMDD,YY/MM/DD,YYMMDD,...) created by the function FormatDateTime to datetime. example i have a string-date in format YYYYMMDDcreated by FormatDateTime mydatestr:=FormatDateTime('YYYYMMDD',Mydate); now how i can convert mydatestr to DateTime again? UPDATE these functions function...

insert many records using ADO

i am looking the fastest way to insert many records at once (+1000) to an table using ADO. option 1) using insert commands and parameters ADODataSet1.CommandText:='INSERT INTO .....'; ADODataSet1.Parameters.CreateParameter('myparam',ftString,pdInput,12,''); ADODataSet1.Open; option 2) using TAdoTable AdoTable1.Insert; AdoTabl...

Does anyone have a list of the Delphi IDE macros?

I know about $(Delphi) and $EDNAME but after much seaching I cant find a list of these and any others for use in libary path names etc. Can anyone oblige please? ...

Positioning controls in Delphi 5 so they fill the form client area when the form is resized in the same sort of proportions as they did initially.

I have a DBGrid above a group box with some buttons and edit fields and another group box below that again with some buttons. I cannot fins a setting for the align and/or anchors for the DBGrid and the group boxes so they fill the form without overlapping or leaving blank bits of form. I am using Delphi 5 on XP Pro with all updates ins...

Anyone ported Snoop Component Suite version 3.0 to Delphi 2010 ? (ie. Unicode issues)

Hi, Has anyone ported "Snoop Component Suite version 3.0" by http://www.netlab.co.kr To Delphi 2010 ? Its a great WinPCap library. Just doesn't work on Delphi 2010 (unicode) Thanks ...

What is the component a popup menu click originated from

Having a popup menu attached to several components on a form (buttons, but also things like TCharts), I would like to know which component was right clicked to start the popup menu in the first place. The Sender parameter of the click method just points to the TMenuItem, its parent to the popup menu (or the parenting menu item). How do...

BDE, Delphi, ODBC, SQL Native Client & Dead lock

Hi. We have some Delphi code that uses the BDE to Access SQL Server 2008 through the SQL Server Native Client ODBC driver (2005 version). Our issue is that we're experiencing some deadlock issues in a loop doing inserts to multiple tables. The whole loop is done within a [TDatabase].StartTransaction. Looking at the SQL Server Profil...

RegisterTypeLibForUser call doesn't seem to work - any ideas ?

This is really a follow on question to a previous one, where I need to register applications, TLBs and OCXs per user, rather than into HKLM. I have written the following code - based on answers here and elsewhere, BUT the TLB is not registered - no error is thrown, just nothing happens (this code snippet comes from the Embarcadero websit...

Delphi constants and references

I want to pass constant references to functions in delphi, so I am sure that the referenced object won't change and to save time and memory. So I want to declare a function like function foo(var const Value : Bar) : Boolean; however this is not allowed. I thought constant values would be automatically sent as references. However I fou...

Convert Delphi Real48 to C# double

Hey, I need to be able to convert from a Delphi Real48 to C# double. I've got the bytes I need to convert but am looking for an elegant solution. to the problem. Anybody out there had to do this before? I'm needing to do the conversion in C# Thanks in advance ...

Delphi VCL "TaskDialog" problem in Windows 7

I'm developing an windows app on Delphi 2007 and I'm using "Ttaskdialog" component in it. Using windows XP it runs normally, but in Windows 7 I'm getting the following message: TtaskDialog requires themes to be enabled Any clues how to fix it? ...

How to avoid GUI freeze when calling Beginthread API?

Below just a simple race between 2 button in 2 threads, and this will freeze other components on the form. procedure moveButton1(); var I: Integer; begin for I := 0 to 6000 do Form1.Button1.Left := Form1.Button1.Left - 1; Form1.Caption := 'Button1 won!'; EndThread(0); end; procedure moveButton2(); var I: Integer; begin ...

What is the equivalent of Application.ProcessMessages, Application.Handle and Application.Terminated in a Windows Service application?

Hi, I am new to Writing Windows Service apps and having problems. Written in Delphi, I have written a normal windows application to check and debug the major parts of the code and now have to convert it to an NT Service. My code has to launch a windows application which I do using the following code. function Run_Program : boolean; ...

Writing Script for Delphi 7 IDE

Is Delphi have any ability to write script of IDE actions? I would like On open delphi project execute script opening some unit. How I can do this. ...

Avoid painting over nested controls

I am writing a toolbar-style control and use the ThemeServices unit to paint the background required by the toolbar. Like so: ThemeServices.DrawElement(Canvas.Handle, ThemeServices.GetElementDetails(trRebarRoot), ARect); I then drop child controls onto the toolbar and voila - instant toolbar. Except that every now and again I notic...

Delphi: How to set the default project in a project group?

i have two projects in a project group: ProjectA ProjectB Whenever i open the ProjectGroup.bpg in Delphi, it always starts with the 2nd project as the active one: ProjectA ProjectB And every time i have to flip it to the the "real" project: ProjectA ProjectB How can i make ProjectA the default project that opens with the proj...

Small Command line scripter (like Autocad commands) one line editor

Basically I don't know from where to start, I need to add a line script for my application that is not so complicated, just to execute pre-defined commands, for instance: command> New Invoice --> create new invoice command> customer profile --> open customer form where cust id = CustID command> run End-Of-Day - run the end of day p...