delphi-xe3

How to disable autocomplete code statements in code editor?

别说谁变了你拦得住时间么 提交于 2019-12-02 05:14:05
问题 Every time I type if and press the space bar, Delphi completes it with if True then and a new empty line above. Is there a way to remove this "autocomplete" feature or at least edit it to not create the new line? 回答1: That's called a live template , and you can edit the list of live templates in the template window, from the View menu. Find the template you don't like, select it, and click the "remove template code" button. 回答2: From the Tools | Options | Editor Options | Code Insight menu,

How to disable autocomplete code statements in code editor?

江枫思渺然 提交于 2019-12-02 01:04:07
Every time I type if and press the space bar, Delphi completes it with if True then and a new empty line above. Is there a way to remove this "autocomplete" feature or at least edit it to not create the new line? That's called a live template , and you can edit the list of live templates in the template window , from the View menu. Find the template you don't like, select it, and click the "remove template code" button. From the Tools | Options | Editor Options | Code Insight menu, deselect the Auto complete check box under Code template completion. Once you disable template auto complete then

File upload fails, when posting with Indy and filename contains Greek characters

拜拜、爱过 提交于 2019-12-01 08:38:45
问题 I am trying to implement a POST to a web service. I need to send a file whose type is variable ( .docx , .pdf , .txt ) along with a JSON formatted string. I have manage to post files successfully with code similar to the following: procedure DoRequest; var Http: TIdHTTP; Params: TIdMultipartFormDataStream; RequestStream, ResponseStream: TStringStream; JRequest, JResponse: TJSONObject; url: string; begin url := 'some_custom_service' JRequest := TJSONObject.Create; JResponse := TJSONObject

Undocumented Members of TPropInfo

久未见 提交于 2019-12-01 06:04:29
System.TypInfo.TPropInfo has two function members (at least in D-XE3): function NameFld: TTypeInfoFieldAccessor; inline; function Tail: PPropInfo; inline; I cannot find any documentation for them or any examples of their use. What are they for and how can they be used? (Hope that qualifies as one question.) The NameFld function returns the name of a property as a TTypeInfoFieldAccessor . This allows you to do the following: MyPropertyName:= MyPropInfo.NameFld.ToString; if (PropInfoA.NameFld = PropInfoB.NameFld) then begin writeln('property names are the same'); end; The TTypeInfoFieldAccessor

How to parse specified value from JSON object in Delphi XE3?

眉间皱痕 提交于 2019-11-30 20:37:28
My JSON object looks like this: { "destination_addresses" : [ "Paris, France" ], "origin_addresses" : [ "Amsterdam, Nederland" ], "rows" : [ { "elements" : [ { "distance" : { "text" : "504 km", "value" : 504203 }, "duration" : { "text" : "4 uur 54 min.", "value" : 17638 }, "status" : "OK" } ] } ], "status" : "OK" } I will need the "504 km" value from distance. How can i do this? You can use the DBXJSON unit, included since Delphi 2010. Try this sample uses DBXJSON; {$R *.fmx} Const StrJson= '{ '+ ' "destination_addresses" : [ "Paris, France" ], '+ ' "origin_addresses" : [ "Amsterdam, Nederland

Can I change the display format for strings in the watch list?

做~自己de王妃 提交于 2019-11-30 17:56:47
Every now and then I use the watch window to display strings which contain sql statements. Now I select Copy Value from the context menu and get 'SELECT NAME FROM SAMPLE_TABLE WHERE FIRST_NAME = ''George'''#$D#$A Of course, this statement has to be reformatted if I want to execute it in a sql tool displaying the results. This is a little bit annoying. Is there a trick / workaround for that? I thought it would be amusing to try and work out a way to do this by adding something inside the IDE, mainly because when you posted your q, I didn't have a clue how to. It turns out that you can do it

Delphi XE3 EXE file size 25 times larger than Dephi 7

…衆ロ難τιáo~ 提交于 2019-11-30 11:49:43
问题 As a test I decided to create a simple "Hello world" app in Delphi using Delphi 4, 5, 6, 7, 2005, 2010 and XE3. The app is nothing more than a TForm, a TButton with an OnClick event that calls ShowMessage('Hello world'). Below are the results of each final EXE with debugging turned off: Can someone explain why the XE3 version is 26 times larger than the average of the previous versions of Delphi? Here are my project settings for XE3: 回答1: You may have done a only a compile after changing to

How to detect modifier key change in a control which doesn't have focus?

一曲冷凌霜 提交于 2019-11-30 08:45:56
Background: I'm working on a control derived from TCustomControl class which can get focus and which has some inner elements inside. Those inner elements are highlighted if the user hovers them with the cursor, you can select them, move them and so on. Now to the problem... Problem: I'm doing different actions with the (let's say) focused element if the user holds CTRL , ALT or SHIFT modifiers. What I would like is to change the mouse cursor if the user hovers the element and holds for instance CTRL key. Pretty simple, you just override the KeyDown and KeyUp methods and check if their Key

Why can't I return arbitrary array of string?

江枫思渺然 提交于 2019-11-30 07:39:29
The compiler allows me to do the following: procedure MyProc(const ADynData: array of string); or procedure MyProc(const ADynData: TStringDynArray); and pass arbitrary data like so: MyProc(['Data1', 'Data2']); However, won't allow function MyFunc: TStringDynArray; .... function MyFunc: TStringDynArray; begin Result := ['Data1', 'Data2']; end; or function MyFunc: TStringDynArray; const CDynData: array[0..1] of string = ('Data1', 'Data2'); begin Result := CDynData; end; Why is this? Isn't this technically the same thing? For these particular scenarios what is the recommended (and most efficient)

Can I change the display format for strings in the watch list?

孤街醉人 提交于 2019-11-30 01:50:42
问题 Every now and then I use the watch window to display strings which contain sql statements. Now I select Copy Value from the context menu and get 'SELECT NAME FROM SAMPLE_TABLE WHERE FIRST_NAME = ''George'''#$D#$A Of course, this statement has to be reformatted if I want to execute it in a sql tool displaying the results. This is a little bit annoying. Is there a trick / workaround for that? 回答1: I thought it would be amusing to try and work out a way to do this by adding something inside the