delphi-xe2

Delphi XE2 VCL styles, remove a style or disable a class skinning from a TLabel

孤者浪人 提交于 2019-12-10 09:41:20
问题 Using XE2 VCL styles, I'd like to disable the skinning for TLabel (or property sfTextLabelNormal) I've tried all kind of solutions from other questions, like using Engine.UnRegisterStyleHook, but it has no effect. 回答1: The TLabel component doesn't use styles hooks because is not a TWinControl descendant, so you can't use the UnRegisterStyleHook function. Instead you must override the Paint DoDrawText method. UPDATE Here you have a sample of how override the paint process of a TLabel. /

TSQLQuery.FieldByName().AsString -> TStringStream Corrupts Data

丶灬走出姿态 提交于 2019-12-10 05:53:06
问题 I'm using Delphi XE2. My code pulls data from a SQL-Server 2008 R2 database. The data returned is a nvarchar(max) field with 1,055,227 bytes of data. I use the following code to save the field data to a file: procedure WriteFieldToFile(FieldName: string; Query: TSQLQuery); var ss: TStringStream; begin ss := TStringStream.Create; try ss.WriteString(Query.FieldByName(FieldName).AsString); ss.Position := 0; ss.SaveToFile('C:\Test.txt'); finally FreeAndNil(ss); end; end; When I inspect the file

When did WPARAM change from being signed to unsigned?

别等时光非礼了梦想. 提交于 2019-12-10 03:32:19
问题 In Delphi 6 WPARAM is declared as being signed: WPARAM = Longint; In Delphi 2010 WPARAM is declared as being signed: WPARAM = INT_PTR; But in XE2 it is declared as being unsigned: WPARAM = UINT_PTR; The official Windows definition is: typedef UINT_PTR WPARAM; This matches with XE2. Does anyone know whether the change was made for XE or for XE2? 回答1: In Delphi XE WPARAM = INT_PTR; so the change was introduced in XE2. 来源: https://stackoverflow.com/questions/7837084/when-did-wparam-change-from

What project options to use for open source Delphi packages?

ε祈祈猫儿з 提交于 2019-12-10 03:28:42
问题 I've written some Delphi code I would like to share on GitHub. All code is contained in runtime and designtime packages as required. There are many "Project Options" to set for each project. (Output directories, search paths, compilation options, etc.) I've managed to find some default options that work well for my situation but reading other Q&As here it's clear there are multiple ways of working. What project options should be used to allow the open source packages to easily be incorporated

How to add menu items separators which work as expected on OSX?

穿精又带淫゛_ 提交于 2019-12-10 03:26:47
问题 On Windows platform, with the VCL , when we want to add a separator in a menu, we add a TMenuItem with a Caption := '-' ; With FireMonkey , we add a TMenuItem with a Text := '-' ; It works as expected on Windows platform, the item with the Text='-' is displayed as a separator. But, when I run the same application on OSX , I have the minus sign visible... I haven't found any property on the TMenuItem to specify it is a separator ... I have tried with a TMainMenu and a TMenuBar ( UseOSMenu :=

XE2 Version Info Not Working

你说的曾经没有我的故事 提交于 2019-12-09 21:44:32
问题 I cannot see to get an XE2 project to include version information in the project files. A minimal project: program Project1; uses Vcl.Forms, Unit2 in 'Unit2.pas' {Form2}; {$R *.res} begin Application.Initialize; Application.MainFormOnTaskbar := True; Application.CreateForm(TForm2, Form2); Application.Run; end. and a blank unit: unit Unit2; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs; type

Call a protected method (constructor) via RTTI

笑着哭i 提交于 2019-12-09 18:31:40
问题 am using XE-2. Is it possible to invoke a protected method (constructor) using RTTI? I searched the web but did not find any conclusive answer. I understand that prior to XE only published methods/properties were available. I do have write access to private fields, so I was expecting to be able to invoke protected methods. The following code works as long as the constructor is public. function GetDefaultConstructor(aRttiType: TRttiType): TRttiMethod; var Method: TRttiMethod; begin for Method

Delphi XE2, vcl styles recreating window handle

淺唱寂寞╮ 提交于 2019-12-09 17:38:58
问题 After applying a new style at runtime the MainForm of my application creates a new window handle – is there any way to stop this or reassign the Handle as I a getting a tonne of the following error: 'System Error. Code: 1400. Invalid window handle' Is there any way to manipulate the process that forces the new handle to be assigned? I solved this doing the following: My main form created an unseen 'helper' form that is never displayed, but that does have visual components - it was throwing

Fastest way to draw pixels in FireMonkey

狂风中的少年 提交于 2019-12-09 17:25:48
问题 I have made the following code: procedure TForm15.Button1Click(Sender: TObject); var Bitmap1: TBitmap; im: TImageControl; Color: TColor; Scanline: PAlphaColorArray; x,y,i: Integer; begin for i:= 1 to 100 do begin im:= ImageControl1; Bitmap1:= TBitmap.Create(100,100); try for y:= 0 to 99 do begin ScanLine:= Bitmap1.ScanLine[y]; for x:= 0 to 99 do begin ScanLine[x]:= Random(MaxInt); end; end; ImageControl1.Canvas.BeginScene; ImageControl1.Canvas.DrawBitmap(Bitmap1, RectF(0,0,Bitmap1.Width,

Delphi XE2 Firemonkey sample app not running on a MAC

廉价感情. 提交于 2019-12-09 14:16:25
问题 I am trying to run a sample Firemonkey app on a Mac, but I am getting this message in the mac: dyld: Library not loaded: @rpath/libcgunwind.1.0.dylib Referenced from: /Users/nobre/Applications/Embarcadero/PAServer/scratch-dir/rafael_colucci-Nobre/Project37.app/Contents/MacOS/Project37 Reason: image not found dyld: Library not loaded: @rpath/libcgunwind.1.0.dylib Referenced from: /Users/nobre/Applications/Embarcadero/PAServer/scratch-dir/rafael_colucci-Nobre/Project37.app/Contents/MacOS