delphi-2010

Delphi conditional compilation in uses clause

痴心易碎 提交于 2019-12-04 00:23:00
问题 I am trying to modify my Delphi 2010 code to compile in XE7 (and want to retain the ability to compile it in 2010). So in the unit that houses my mainform I added conditional directives. The following works fine in 2010 uses {$IF CompilerVersion >= 24}System.Actions, {$ELSE}Actnlist,{$IFEND} Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; But XE7 automatically adds a System.Actions at the end to create a uses clause that now has System.Actions declared twice (see

(Delphi THintWindow) How to draw a transparent PNG?

丶灬走出姿态 提交于 2019-12-03 23:18:12
I have this delphi 2010 code: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Math, ExtCtrls, pngimage; type TMyHintWindow = class(THintWindow) private FBitmap : TBitmap; ThePNG : TPngImage; FRegion : THandle; procedure FreeRegion; protected procedure CreateParams(var Params : TCreateParams); override; procedure Paint; override; procedure Erase(var Message : TMessage); message WM_ERASEBKGND; public constructor Create(AOwner : TComponent); override; destructor Destroy; override; procedure ActivateHint(Rect : TRect; const

Converting UTF8 to ANSI (ISO-8859-1) in Delphi

前提是你 提交于 2019-12-03 21:47:19
问题 I have a question about a code that i have to convert UTF8 strings to ANSI strings. My code works for accents in vowels, but with letter Ñ it doesn't work. The code breaks the string. How can I fix this mistake? The string I have in UTF8: EDIFICIO PEÑAS BLANCAS The string I would have in ANSI if correct: EDIFICIO PEÑAS BLANCAS The string I have in ANSI now: EDIFICIO PE The code is here: function TFormMain.convertir_utf8_ansi(const Source: string):string; var Iterator, SourceLength, FChar,

What are the Rave BE “reports in code” alternatives in a Delphi 2010 migration project?

为君一笑 提交于 2019-12-03 21:45:15
I want to migrate a Delphi 7 project to Delphi 2010. We are building "reports in code" with TReportShell and TDetailShell components from Rave BE. Those components does not exist any more in Rave BE 7.7. Moreover it seems that unicode support is broken in Rave BE ( Displaying unicode text in Rave Reports on Delphi 2009 ). What sould be the best solution to port this project to Delphi 2010 ? Reimplement the code written aruond TReportShell and TDetailShell to use the new TRvNDRWriter component ? Migrate to Fast Report ? Any other suggestion ? We provided an open source report builder, to be

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

非 Y 不嫁゛ 提交于 2019-12-03 20:51:50
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); virtual; abstract; property MediatedControl: C read FMediatedComponent; end; I then make 'concret' subclasses for each control type that I want to mediate: TEditMediator = class(TControlMediator<TEdit, string>) public function GetValue: string; override; procedure SetValue

How can I declare a pointer based on a generic type?

时光总嘲笑我的痴心妄想 提交于 2019-12-03 17:52:24
问题 I have a class like this: type A = class procedure<T> DoStuff(tPtr: ^T); end; But when I try to compile, Delphi gives me this error: [DCC Error] RPML.pas(57): E2029 Identifier expected but '^' found How can I use a pointer to a parameterized type in a Delphi procedure? I don't want to make the whole class a template class. 回答1: To do this you need to declare a pointer type as a nested type in the generic class: type TMyGeneric<T> = class type P = ^T; public procedure DoStuff(tPtr: P); end;

A button control and underlying replacement for TBitmap that properly handles PNG transparency without writing pre-blend code

我的梦境 提交于 2019-12-03 17:07:00
问题 Delphi 2010's TSpeedButtons did not seem to really support PNG transparency properly, because the Glyph property uses a TBitmap internally, and TBitmap is for bitmaps, and doesn't support PNG transparency properly, and TSpeedButton.Glyph can't support transparency then.. update: But the actual problem was that I had some external stuff (Developer Express components) that was rendering delphi's PNG support non-functional, TImage on the other hand, while it still TPicture, and can support PNG,

Delphi 2010 Tablet PC Support

╄→гoц情女王★ 提交于 2019-12-03 16:45:11
One of the big selling points I saw when I had to buy delphi for my job was the ability to support tablet pc's. Now the client of the company where I work want to use a tablet pc. I've been trying hard to find examples of delphi with tablet pc but I don't find any. Does anybody has experience with it? Any kind of tutorials or examples? I don't seem to be able even to bring a virtual keyboard when a component gain focus and hide it when it loses it. Delphi 2010 introduced some nice touch and gesture support to Delphi. To get more info about it, go to EDN website and look for CodeRage 4 replays.

Problem with Indy IdHttp Post in Delphi 2010

一世执手 提交于 2019-12-03 16:01:56
I have problem with Indy IdHttp Post method. Function CallRpc() compiled with Delphi 2007 works fine but same code compiled with Delphi 2010 raises exception. What do I have to consider when I change Delphi 2007 Indy TIdHttp to Delphi 2010 Indy TIdHttp? function CallRpc(const sURL, sXML: string): string; var SendStream : TStream; IdHttp : TIdHttp; begin SendStream := TMemoryStream.Create; IdHttp := TIdHttp.Create(nil); try IdHttp.Request.Accept := '*/*'; IdHttp.Request.ContentType := 'text/sXML'; IdHttp.Request.Connection := 'Keep-Alive'; IdHttp.Request.ContentLength := Length(sXML);

How can I make a form transparent according to a PNG image?

与世无争的帅哥 提交于 2019-12-03 15:12:27
I have a PNG image that uses transparency (it is actually a circle with gradient effect from black in the middle, to transparent on the margins). I am putting this on a form using TImage . I set TForm1.Color and the TForm1.TransparentColorValue to the same value and TForm1.TransparentColor:=true . Now, when I run the program the gradient part of the image is displayed with the color of the form. What I am looking for is to enable the transparency of the PNG image using the transparent form effect. What am I doing wrong? I am using Delphi 2010 Trial. I suspect you're trying to create something