Delphi

Delphi Dictionary and ordering data

对着背影说爱祢 提交于 2019-12-30 10:03:00
问题 My code is: procedure TfrmSettings.btnFillDictClick(Sender: TObject); var Dict: TDictionary<string, string>; Item: TPair<string, string>; begin Dict := TDictionary<string, string>.Create(); Dict.Add('Key1', 'Text1'); Dict.Add('Key2', 'Text2'); Dict.Add('Key3', 'Text3'); Dict.Add('Key4', 'Text4'); for Item in Dict do begin ShowMessage(Item.Key + ' ' + Item.Value); end; end; Why almost every time I'm getting a different value in Showmessage? Why values are not stored in the order in which they

Delphi transparent proxy for a TCP connection

烂漫一生 提交于 2019-12-30 09:52:18
问题 Anyone know of any examples of a TCP sockets proxy application written in Delphi? I am building a small broker application that needs to listen for socket connections on a given TCP port, read a XML data packet sent over the connection, serve the request via TCP to a server chosen from a pool of available back end servers, and deliver the resulting response back to the originating TCP connection. I am very familiar with TCP and socket-level programming, but would prefer to find sample code as

How to determine if all characters in a string are equal

喜夏-厌秋 提交于 2019-12-30 09:43:15
问题 I need to know if all characters in a string are equal (formed by the same character). the function must return true or false depending if all the elements of the string are equal to an particular char. I wrote this function that works well, but I'm looking for a more optimal (fastest) solution, the strings can have thousands of chars. function AllElementsAreEqual(Element:Char;Str:String):Boolean; var i : Integer; begin Result:=True; if Str<>'' then for i:=1 to Length(Str) do if Str[i]<

How do I stop the debugger from stepping into Delphi-supplied units?

喜欢而已 提交于 2019-12-30 09:40:12
问题 The debugger steps into the source code on errors (like with F7 ), but I want to restore the normal working mode where the Delphi basic DCUs (the library) are only compiled into my code, and the sources are not used in debugging. For example, on an error in my program, the debugger is stepping into Controls.pas, into TControl.Click . The normal case (right after installation) is for Delphi to step over these methods. Should I recompile Controls.pas without debug information? If so, how? I

How to save a png file with transparency?

折月煮酒 提交于 2019-12-30 09:39:46
问题 I am using Barcode Studio 2011 to paint a QR Code into a Graphics32 - TImage32 Component and I want to save it in png format but with the white colour as transparent this I have specified in the OuterColor of Graphics32. OnFormCreate I have just procedure TForm1.FormCreate(Sender: TObject); begin psBarcodeComponent1.BarCode := 'some text here...'; end; and for the moment I have the painting assigned to a Button Click Event procedure TForm1.Button8Click(Sender: TObject); // Paint the barcode

Delphi Compiler Directive to Evaluate Arguments in Reverse

情到浓时终转凉″ 提交于 2019-12-30 09:36:38
问题 I was really impressed with this delphi two liner using the IFThen function from Math.pas. However, it evaluates the DB.ReturnFieldI first, which is unfortunate because I need to call DB.first to get the first record. DB.RunQuery('select awesomedata1 from awesometable where awesometableid = "great"'); result := IfThen(DB.First = 0, DB.ReturnFieldI('awesomedata1')); (as a pointless clarification, because I've got so many good answers already. I forgot to mention that 0 is the code that DB

Delphi Embedded Chrome

旧街凉风 提交于 2019-12-30 09:36:22
问题 is somebody experience on using delphi embedded chrome? delphichromiumembedded. how to make get accessed to its HTML DOCUMENTS? like assign a value to Editbox 回答1: See demos\guiclient directory for an example. Update: an example to set text of an input field on the iGoogle page: procedure TMainForm.actDomExecute(Sender: TObject); var q: ICefDomNode; begin crm.Browser.MainFrame.VisitDomProc( procedure (const doc: ICefDomDocument) var q: ICefDomNode; begin // "q" is the ID of the text input

VCL-Styles embedded in dll?

偶尔善良 提交于 2019-12-30 09:35:27
问题 How do I embed Delphi XE2 VCL-Styles in a dll? The Application - Appearance page is not visible in project settings for DLL-projects. I tried defining them in a rc-file included with a $R directive which works but if there is a better way I'd like to know. RC-file example: GOLDENGRAPHITE VCLSTYLE "C:\Program Files (x86)\Embarcadero\RAD Studio\9.0\Redist\styles\vcl\GoldenGraphite.vsf" CARBON VCLSTYLE "C:\Program Files (x86)\Embarcadero\RAD Studio\9.0\Redist\styles\vcl\Carbon.vsf" In particular

VCL-Styles embedded in dll?

北战南征 提交于 2019-12-30 09:35:20
问题 How do I embed Delphi XE2 VCL-Styles in a dll? The Application - Appearance page is not visible in project settings for DLL-projects. I tried defining them in a rc-file included with a $R directive which works but if there is a better way I'd like to know. RC-file example: GOLDENGRAPHITE VCLSTYLE "C:\Program Files (x86)\Embarcadero\RAD Studio\9.0\Redist\styles\vcl\GoldenGraphite.vsf" CARBON VCLSTYLE "C:\Program Files (x86)\Embarcadero\RAD Studio\9.0\Redist\styles\vcl\Carbon.vsf" In particular

Can someone recommend a colour picker component for Delphi?

折月煮酒 提交于 2019-12-30 09:32:51
问题 I'm looking for a (preferably free) component for Delphi for users to easily select about 100 different colours. I've currently got one as part of DevExpress's editors, but it only has about 20 proper colours to choose, with a bunch of other 'Windows' colours like clHighlight, clBtnFace, etc. It's for regular users, so would like to avoid requiring them to manually select RGB values. Something similar to the colour picker in MS Paint might work, or something that lists X11/web colours: http:/