delphi-xe3

How to edit an IBAN number in four character groups?

主宰稳场 提交于 2020-01-14 05:32:07
问题 https://en.wikipedia.org/wiki/International_Bank_Account_Number#Practicalities The IBAN should not contain spaces when transmitted electronically: when printed it is expressed in groups of four characters separated by a single space, the last group being of variable length as shown in the example below: A typical IBAN looks like this: GR16 0110 1250 0000 0001 2300 695 (taken from the above link). I want to make it easier for users to enter IBAN numbers. Currently I use a TDBEdit to display

Delphi: Easiest way to search for string in memorystream

孤人 提交于 2020-01-11 12:33:24
问题 What's the easiest way to search for a string within a memory stream (and multiple strings) and return true or false? 回答1: var ms:TMemoryStream; strS:TStringStream; aStr:string; aPos:integer; found:boolean; begin ms:=TMemoryStream.Create; ms.LoadFromFile('c:\aFile.txt'); strS:=TStringStream.Create; strS.LoadFromStream(ms); aPos:=pos(aStr,strS.dataString); found:=aPos>0; end; TStringStream is an often forgetten but very useful tool - easier and safer than messing with pChars, etc. For multiple

Error on TIdHTTP on Setting Host and Port at Runtime for SMS web service delivery

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-06 03:43:05
问题 I am trying to use an SMS API for Delphi from http://www.human.com.br but I get an 'access violation' error when the component tries to set the host and port of the webservice after creating an instance of Indy's TIdHTTP . host := TidHTTP.Create; host.Socket.Port := 80; // error right here! host.Socket.Host := 'system.human.com.br'; uri := TidURI.Create(); The original component was created in Indy60 and I have Indy170, so the was no Socket between host and Port and I had to put it. What is

Do generics in Delphi cause performance bottlenecks?

青春壹個敷衍的年華 提交于 2020-01-02 02:04:48
问题 Recently i have been developing an application and wanted to have a collections of several types. I don't want to declare and implement a new collection class for it's type. So, i thought of going with generics, but wasn't sure about the performance of Generics compared to normal typed instances. Performance is the major thing that i am looking at. My application is time critical and even loosing few 100 milliseconds is also not advisable. I am using Delphi XE3 For eg: ICollectionItem =

GetKeyState in firemonkey

最后都变了- 提交于 2020-01-01 19:20:08
问题 In VCL (Delphi 2010) I used this function to check whether control key is pressed: function IsControlKeyPressed: Boolean; begin Result := GetKeyState(VK_CONTROL) < 0; end; GetKeyState is function in windows library that I do not want to include it into my project. How can I check if control or shift key is pressed in XE3 for firemonkey application? 回答1: If it helps for anyone else, this is my unit: unit uUtils; interface uses {$IFDEF MSWINDOWS} Winapi.Windows; {$ELSE} Macapi.AppKit; {$ENDIF}

Stopping delphi program in an infinite loop

拜拜、爱过 提交于 2020-01-01 11:29:33
问题 When an indefinite loop occurs in Delphi, the debugger will not even give me a stack trace when I hit the stop button. If I have a suspicion of where the program is stalling, I can put a breakpoint and it will stop if that is the correct indefinite loop. Here is a sample program to deliberately cause an indefinite loop: procedure TForm1.btnDebugInfiniteLoopClick(Sender: TObject); var I: Integer; begin I:=0; while I<100 do begin I:=1+1; if I>64 then I:=I div 2; end; end; When stopped, I get

Install font in firemonkey

老子叫甜甜 提交于 2019-12-31 07:04:45
问题 How Can I use embedded font or install new fonts in my firemonkey application? I tried this solution but WM_FONTCHANGE is not defined in FMX! I want to use custom font in my application, how I can do this? 回答1: I followed the instructions here, and they were of some help. I have a few extra hints that may help, The two inclusions that you will need to make this work is WinAPI.Windows and WinAPI.Messages. If you put these inclusions at the start of your "uses" clause, you're unlikely to have

Install font in firemonkey

青春壹個敷衍的年華 提交于 2019-12-31 07:04:10
问题 How Can I use embedded font or install new fonts in my firemonkey application? I tried this solution but WM_FONTCHANGE is not defined in FMX! I want to use custom font in my application, how I can do this? 回答1: I followed the instructions here, and they were of some help. I have a few extra hints that may help, The two inclusions that you will need to make this work is WinAPI.Windows and WinAPI.Messages. If you put these inclusions at the start of your "uses" clause, you're unlikely to have

Install font in firemonkey

一曲冷凌霜 提交于 2019-12-31 07:04:06
问题 How Can I use embedded font or install new fonts in my firemonkey application? I tried this solution but WM_FONTCHANGE is not defined in FMX! I want to use custom font in my application, how I can do this? 回答1: I followed the instructions here, and they were of some help. I have a few extra hints that may help, The two inclusions that you will need to make this work is WinAPI.Windows and WinAPI.Messages. If you put these inclusions at the start of your "uses" clause, you're unlikely to have

Move borderless form in Firemonkey

瘦欲@ 提交于 2019-12-31 05:34:13
问题 In VCL forms I use WM_SYSCOMMAND , but in firemonkey it is undeclared. I test this code: procedure TForm4.dragPanelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single); begin isDraging := true; X0 := X; Y0 := Y; end; procedure TForm4.dragPanelMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Single); begin if isDraging then begin Form4.Left := Trunc(Form4.Left + X - X0); Form4.Top := Trunc(Form4.Top + Y - Y0); end; end; procedure TForm4.dragPanelMouseUp(Sender