delphi-xe7

Delphi delete FireMonkey element from Form on Android

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-09 21:53:28
问题 I created an element on my Form with this code in the OnShow event: procedure TForm4.FormShow(Sender: TObject); var VertScrollLink:TVertScrollBox; begin VertScrollLink := TVertScrollBox.Create(form4); VertScrollLink.Align := TAlignLayout.Client; VertScrollLink.Parent := form4; end; On some action, I need to delete the layout dynamically: for LIndex := form4.ComponentCount-1 downto 0 do begin if (form4.Components[LIndex].ToString='TVertScrollBox') then begin //showmessage(form4.Components

Cant delete controls in Delphi xe7

落花浮王杯 提交于 2019-12-08 15:27:18
问题 Just installed Delphi xe7. Opened a project developed with XE7. Side note, but my first concern is that everything causes the IDE to hang, whether it be changing 'views' from Master to iPhone4, or simply dragging controls around in Design View. I previously had a tools unit that had a function that accepted a TComboEdit param. It seems they moved things around again because the function is now broken. To quickly find out which unit hosts combo edits, I opened a form and dropped a Combo edit

Why does TPath.HasValidPathChars accept '?' as a valid char in a path?

南笙酒味 提交于 2019-12-08 14:59:46
问题 Why does System.IOUtils.TPath.HasValidPathChars accept'?' as a valid char in a path? I set the second parameter (UseWildcards) to false. So, according to the documentation the '?' should be rejected. Still, the function returns True for 'c:\test\test?\'. UseWildcards = Specifies whether the mask characters are treated as valid path characters (e.g. asterisk or question mark). Is the behavior of this function only partially correct? Could the function have returned a better result? 回答1: TPath

How to Change StringTable Values stored in a .exe file

筅森魡賤 提交于 2019-12-08 14:04:48
问题 I have written 2 programs, they are both compiled, and both contain "STRINGTABLES" resources added via .rc files. So, let's call App #1 "app1.exe" and App #2 "app2.exe". Here is my issue. In app2.exe, I have a string table that looks like this: STRINGTABLE { 1000, "Hello" 1001, "There" } When I run app1.exe, I am attempting to update resources stored in app2.exe via the Win32 API UpdateResource() function. I can use Delphi's LoadStr() function to load the strings from the stringtable just

How to pass any record (any type) into Delphi xe7 function as parameter?

大城市里の小女人 提交于 2019-12-08 04:04:02
问题 I want to define a function that gets an record (in any type) and give us the fields of that as string. My problem is that how can I pass record to function as parameter? How to declare the parameter? Function GetRecordFields(MyRecord: any record type): string var ctx : TRttiContext; t : TRttiType; field : TRttiField; begin result := ''; ctx := TRttiContext.Create; for field in ctx.GetType(TypeInfo(MyRecord)).GetFields do begin t := field.FieldType; result := result + ' | ' + Format('Field :

How to pause a thread?

一笑奈何 提交于 2019-12-07 17:40:44
问题 I want to draw something. Because the GUI freezes I want to draw in a thread. But sometimes I want to pause the drawing (for minutes). Delphi's documentation says that Suspend/resume are obsolete but doesn't tell which functions replaces them. Suspend and Resume are deprecated. Sleep and SpinWait are obviously inappropriate. I am amazed to see that Delphi does not offer such a basic property/feature. So, how do I pause/resume a thread? 回答1: You may need fPaused/fEvent protection via a

TDirectory.Delete seems to be asynchronous

↘锁芯ラ 提交于 2019-12-07 17:31:49
问题 I have observed that calling DirectoryExists(x) immediately after calling TDirectory.Delete(x) returns true IF the folder to be deleted has few files in it AND the folder is open (in Total Commander). In other words: begin TDirectory.Delete('x', true); <-- 'Delete' exited but the folder is still not fully deleted if SysUtils.DirectoryExists('x')... <-- This returns true end; Is this a normal behavior? The "solution" is this: begin TDirectory.Delete('x', true); Sleep(1000); //wait for Delete

TMemo is painfuly slow when working with large number of lines

南楼画角 提交于 2019-12-07 09:57:43
问题 I have 100000 lines in a TMemo. I want to do something like: for i:= 0 to Memo.Lines.Count-1 do Memo.Lines[i]:= SomeTrim(Memo.Lines[i]); but the speed is 0.5 lines per second!! After adding BeginUpdate/EndUpdate I don't see any speed improvement. Memo.Lines.BeginUpdate; for i:= 0 to Memo.Lines.Count-1 do Memo.Lines[i]:= SomeTrim(Memo.Lines[i]); Memo.Lines.EndUpdate; My question is why BeginUpdate/EndUpdate won't help? 回答1: TStrings.BeginUpdate/EndUpdate will only prohibit the OnChanging and

How to pass any record (any type) into Delphi xe7 function as parameter?

空扰寡人 提交于 2019-12-07 02:40:29
I want to define a function that gets an record (in any type) and give us the fields of that as string. My problem is that how can I pass record to function as parameter? How to declare the parameter? Function GetRecordFields(MyRecord: any record type): string var ctx : TRttiContext; t : TRttiType; field : TRttiField; begin result := ''; ctx := TRttiContext.Create; for field in ctx.GetType(TypeInfo(MyRecord)).GetFields do begin t := field.FieldType; result := result + ' | ' + Format('Field : %s : Type : %s',[field.Name,field.FieldType.Name]); end; end; Use Generics , eg: type TRecordHlpr<T:

Best way to implement MVVM bindings (View <-> ViewModel) in Delphi? [closed]

≡放荡痞女 提交于 2019-12-06 22:11:35
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . For a multi-platform application using native components, the standard Delphi approach is no longer sufficient. So far our structure had only to parts: GUI (Forms) and Business logic. We now need to split the "Forms" part into two, which in a MVVM context would be View and