delphi-xe

Fast copy of TList <T>?

北慕城南 提交于 2020-01-12 14:37:55
问题 Is there a fast way to copy a generic TList? Copy.Capacity := List.Count; for Item in List do Copy.Add (Item); is very slow. There seems to be no way to use CopyMemory since I can't get the memory adress of the internal array (which is obvious from an information hiding viewpoint). I miss something like List.Copy (Copy); which uses the knowledge of the internal representation to improve performance. Can it be done? 回答1: For the generic TList<T> it is simply not possible to implement the

Fast copy of TList <T>?

拥有回忆 提交于 2020-01-12 14:36:06
问题 Is there a fast way to copy a generic TList? Copy.Capacity := List.Count; for Item in List do Copy.Add (Item); is very slow. There seems to be no way to use CopyMemory since I can't get the memory adress of the internal array (which is obvious from an information hiding viewpoint). I miss something like List.Copy (Copy); which uses the knowledge of the internal representation to improve performance. Can it be done? 回答1: For the generic TList<T> it is simply not possible to implement the

Synchronizing/sending data between threads

狂风中的少年 提交于 2020-01-12 01:47:07
问题 The app is written in Delphi XE. I have two classes, a TBoss and TWorker, which are both based of of TThread. The TBoss is a single instance thread, which starts up and then will create about 20 TWorker threads. When the boss creates a instance of TWorker it assigns it a method to call synchronize on, when the Worker has finished with what it's doing it calls this method which allows the Boss to access a record on the Worker. However I feel this is a problem, calling synchronize appears to be

What is 'Limited Debug Information'? (Full “Debugging Information" generates huge EXE files)

二次信任 提交于 2020-01-11 02:35:00
问题 I installed Delphi XE7 recently. When I first compiled an old app my jaw dropped when I have seen that the size of the EXE increased with 10MB! Playing in the 'Project options' I discovered that setting the 'Debug information' to 'Limited Debug Information' decreases the EXE size to something VERY close to the EXE generated by Delphi XE. Maybe under Delphi XE7 'Limited Debug Information' is the equivalent of 'Debug Information' from Delphi XE since it results in the same EXE size? So, why

Delphi XE - All blue dots are shifted with one line up

坚强是说给别人听的谎言 提交于 2020-01-07 07:49:13
问题 Since yesterday, all blue dots (compiled lines) in my source code are shifted with one line up. So, the first dot starts at 'var' instead of 'begin' and the last dot is one line before the last 'end' of a function. I deleted all files (starting with DCUs) except DPR, PAS, DFM and DPRJ and recompiled. But the dots are still shifted. How can I fix this? It makes the step=by-step debugging almost impossible. 回答1: It could be that the file is corrupted so that you don't have proper line end

Delphi: Convert from windows-1251 to Shift-JIS

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-07 04:59:06
问题 I have a string 'MIROKU' . I want to convert this string to '%82l%82h%82q%82n%82j%82t' . Below is my current function which I have used for converting: function MyEncode(const S: string; const CodePage: Integer): string; var Encoding: TEncoding; Bytes: TBytes; b: Byte; sb: TStringBuilder; begin Encoding := TEncoding.GetEncoding(CodePage); try Bytes := Encoding.GetBytes(S); finally Encoding.Free; end; sb := TStringBuilder.Create; try for b in Bytes do begin sb.Append('%'); sb.Append(IntToHex(b

Delphi - Change Fields definitions of a TClientDataSet that has data

南笙酒味 提交于 2020-01-06 14:06:15
问题 I'm creating FieldDefs at runtime for a TClientDataSet . Still at runtime I want to remove all FieldDefs . I'm saving TClientDataSet physically to a disc file. I tried removing existing FieldDefs using the following code so I could add new ones. But it didn't work: with fDataSet do begin Active := False; DisableControls; FieldDefs.Clear; Fields.Clear; EnableControls; end; After executing this code, FieldDefs and Fields count are 0 , but if I close and reopen the disc file , FieldDefs and

Delphi - Change Fields definitions of a TClientDataSet that has data

这一生的挚爱 提交于 2020-01-06 14:05:51
问题 I'm creating FieldDefs at runtime for a TClientDataSet . Still at runtime I want to remove all FieldDefs . I'm saving TClientDataSet physically to a disc file. I tried removing existing FieldDefs using the following code so I could add new ones. But it didn't work: with fDataSet do begin Active := False; DisableControls; FieldDefs.Clear; Fields.Clear; EnableControls; end; After executing this code, FieldDefs and Fields count are 0 , but if I close and reopen the disc file , FieldDefs and

Brand new installed Delphi XE freezes without reason (it is QC 90864 Delphi bug)

余生长醉 提交于 2020-01-06 08:19:37
问题 I finally upgraded to Delphi XE. The second time when I compile a project in Delphi XE, as soon as I hit the BUILD button the IDE freezes. Nothing can stop its agony except 'End Task'. What should I do? This is a fresh installation from the original CD. No single 3rd party plugin/VCL has been installed. Edit 1: The last change I did was to remove some of the pre-installed packages such as DBs and Rave. Edit 2: I realized the if freezes also when I use 'compile'. The last message it shows in

Delphi Graphics32 how to draw a line with the mouse on a layer

半世苍凉 提交于 2020-01-05 15:26:22
问题 Can anybody help me convert this great method of dynamically drawing a line (Photoshop style drawing line with delphi) to Graphics32? I mean, I want to have a ImgView, add a new layer to it, then perform these methods on the layer instead of the form's canvas. So I assume, my code should look like this: private FStartPoint, FEndPoint: TPoint; FDrawingLine: boolean; bm32: TBitmap32; ... procedure TForm1.FormCreate(Sender: TObject); begin bm32 := TBitmap32.Create; FDrawingLine := false; end;