Delphi

Unobvious Delphi syntax error

点点圈 提交于 2021-01-29 11:50:39
问题 I have a problem with some simple code I simply cannot resolve. I'm using Delphi 5 with all updates applied. I have this code block: procedure TForm1.LoadBtnClick(Sender: TObject); var s1, s2, s3 : Textfile; sa, sb, RString, SQLString : string; begin with sourcequery do begin Close; SQL.Clear; SQL.Add('delete * from source'); ExecSQL; Close; AssignFile(S2, 'c:\delphi programs\events\source1.txt'); AssignFile(S1, 'c:\delphi programs\events\source2.txt'); Reset(s2); Reset(s1); while not eof(s1)

TSimpleCodec.Begin_EncryptMemory - Wrong mode

ⅰ亾dé卋堺 提交于 2021-01-29 07:12:43
问题 I get TSimpleCodec.Begin_EncryptMemory - Wrong mode exception wile executing the following code. Is it something wrong? FLibrary := TCryptographicLibrary.Create(Self); FCodec := TCodec.Create(Self); FCodec.CryptoLibrary := FLibrary; FCodec.BlockCipherId := 'native.AES-256'; FCodec.ChainModeId := 'native.ECB'; FCodec.Password := 'password'; plain := 'The plain text'; FCodec.EncryptString(plain, astr); FCodec.DecryptString(dec, astr); 回答1: When initialising the codec by run-time code, you need

How to hide subcomponents in design time in Structure view panel when creating own component (hide <components[1]>)

风流意气都作罢 提交于 2021-01-29 06:23:35
问题 I'm creating simple component inherited from TControl (Firemonkey). In constructor I wrote : constructor TControl1.Create(AOwner: TComponent); begin inherited; fTest := TLayout.Create(Self); fTest.Parent := Self; end; How when I place this component to the form, Structure list shows Tlayout as subcomponent as <components1>. How can I hide it? See screenshot. 回答1: Use SetSubComponent(True); Owner must be Self constructor TControl1.Create(AOwner: TComponent); begin inherited; fTest := TLayout

DCEF3: How to get a screenshot

不想你离开。 提交于 2021-01-29 04:04:13
问题 How to get screenshot of browser in DCEF3? I create browser like this without VCL. The TakePicture method will only work if No debugger is used If ShowWindow is used var info: TCefWindowInfo; Settings: TCefBrowserSettings; begin FillChar(info, SizeOf(info), 0); info.width := width; info.height := height; FillChar(Settings, SizeOf(TCefBrowserSettings), 0); Settings.Size := SizeOf(TCefBrowserSettings); GetSettings(Settings); CefBrowserHostCreateBrowser(@info, FHandler, FDefaultUrl, @settings,

How to create a parameter of type PSafeArray?

允我心安 提交于 2021-01-29 03:14:50
问题 How to create a parameter of type PSafeArray? I take the following error from C# COM library: SafeArray with range 65262 transfered to the method that requires array with range 1 Delphi XE2 should call C# COM library procedure using Generated RIDL type-library with a parameter of type PSafeArray. Delphi XE2 code: function GetObjects: PSafeArray; var aObjects: Variant; begin aObjects := VarArrayCreate([0, 2], varVariant); aObjects[0] := ADOConnection.ConnectionObject; aObjects[1] :=

Delphi XE4 with iOS addon - how to embed files

别等时光非礼了梦想. 提交于 2021-01-29 03:03:09
问题 On Android / Eclipse, I can place files in e.g. assets folder. Can I do something similar in Delphi XE4 for iOS? i.e. create a folder where data and image files can placed and automatically built into app? I know I can have images, txt etc. in the form file, but is not what I want if I can avoid it. ... If I include res.zip in Delphi > Project > Deployment my following code returns false in simulator: FileExists(GetHomePath + PathDelim + 'res.zip') FileExists(GetHomePath + PathDelim +

Delphi XE4 with iOS addon - how to embed files

六月ゝ 毕业季﹏ 提交于 2021-01-29 03:02:56
问题 On Android / Eclipse, I can place files in e.g. assets folder. Can I do something similar in Delphi XE4 for iOS? i.e. create a folder where data and image files can placed and automatically built into app? I know I can have images, txt etc. in the form file, but is not what I want if I can avoid it. ... If I include res.zip in Delphi > Project > Deployment my following code returns false in simulator: FileExists(GetHomePath + PathDelim + 'res.zip') FileExists(GetHomePath + PathDelim +

How do I use labels in address calculations

你离开我真会死。 提交于 2021-01-29 02:05:37
问题 I have the following snippet of inline assembly: procedure Foo; asm //..... @partialloop: shr rdx,1 //every instruction is 4 bytes lea r11,[rip + (7*4)+(@partial-@offset)] @offset: sub r11,rdx xor r8,r8 jmp r11 //do a partial loop @loop64: mov [rcx],rax @partial: mov [rcx+08H],rax //.... end; The compiler does not accept this syntax: E2105 Inline assembler syntax error Create use of offset , ptr or @@ does not help. What syntax do I need to use to make this compile? 回答1: Label addresses are

Setting Label and StaticText Color property problem - Delphi 2009

倖福魔咒の 提交于 2021-01-28 22:51:28
问题 When I set the Label 's color e.g. on value clRed , the red on it only blink for a while. The color property still has clRed value, but in fact it has default clBtnFace color. Screenshot discribes the problem better. 回答1: Set Transparent to False. :-) Edit: assuming it's a TLabel, as shown in the screenshot. 回答2: Do you mean a TLabel or a TPanel ? Your screenshot shows a label, but it should work for both components. Make sure that the ParentColor property is set to false . 来源: https:/

TTeeGrid is not displaying the data at runtime using data from REST

给你一囗甜甜゛ 提交于 2021-01-28 22:23:50
问题 I created a simple RME for TTeeGrid, a descendant perhaps of TGrid in Firemonkey. As shown below, the data are displayed at design time but not at runtime except the headers. I've been breaking my head over this for weeks already but not luck. Let me know if you need more details but what you see in the image are all you get. I just need help to have the data displayed at runtime as shown in the design time. UPDATE 1 This issue is not the case with TPrototypeBindSource. The data shown in the