delphi-xe2

Why Application.OnException never runs?

前提是你 提交于 2020-01-17 17:15:03
问题 Problem summary: The method assigned to Application.OnException never runs when an unhandled exception occurs. I create a blank project with only this unit and place a single button on Unit.dfm (this is based on an official example) : // Unit1.pas // ********* type TForm1 = class(TForm) Button1: TButton; procedure FormCreate(Sender: TObject); procedure AppException(Sender: TObject; E: Exception); procedure Button1Click(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm}

Why Application.OnException never runs?

萝らか妹 提交于 2020-01-17 17:14:28
问题 Problem summary: The method assigned to Application.OnException never runs when an unhandled exception occurs. I create a blank project with only this unit and place a single button on Unit.dfm (this is based on an official example) : // Unit1.pas // ********* type TForm1 = class(TForm) Button1: TButton; procedure FormCreate(Sender: TObject); procedure AppException(Sender: TObject; E: Exception); procedure Button1Click(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm}

Check if Element with ID has a value

拜拜、爱过 提交于 2020-01-16 13:31:13
问题 How to check if "Some text value" in element p with Id = "SomeID" is there? <p id="SomeID" class="error" style="display: none"></p> <p id="SomeID" class="error" style="display: none">Some text value</p> Here it is in a function form.. function ElementIdText(Web:TembeddedWB; Id:string):string; var node: string; begin if Assigned(Web.Document) and web.DocumentLoaded then begin node:=Web.OleObject.Document.GetElementByID(Id).innerText; if not VarIsNull(Node) and not VarIsClear(Node) and not

Delphi XE6 TForm.AutoSize

丶灬走出姿态 提交于 2020-01-15 03:42:13
问题 I've code in Delphi XE2 who work perfectly. But in Delphi XE6 it doesn't work. I create a Tform with the property AutoSize to true. I use a TPanel align alTop with a button for create some another panels. procedure TForm2.Button1Click(Sender: TObject); var t :TPanel; begin t := TPanel.Create(self); t.Parent := self; t.Align := alTop; end; The form doesn't auto size. If I want to see all my panels I have to move the form (or try to resize, ....). Have you any idea's ? 回答1: This is indeed a

TStreamWriter (Auto)Flush does not?

匆匆过客 提交于 2020-01-13 20:22:12
问题 Despite what is said in Text File Writing performances in Delphi (comments under Ken White's answer), I see the TStreamWriter not flushing with the following code: procedure TFrmAddEvents.LogEvent(AEvent: TcxSchedulerEvent); begin if not Assigned(FStreamWriter) then begin FStreamWriter := TStreamWriter.Create(TFileStream.Create(ChangeFileExt(ParamStr(0),'.log'),fmCreate or fmOpenRead)); FStreamWriter.AutoFlush := true; end; FStreamWriter.WriteLine(TcxEventDescription(AEvent)); // Even this

TStreamWriter (Auto)Flush does not?

坚强是说给别人听的谎言 提交于 2020-01-13 20:21:58
问题 Despite what is said in Text File Writing performances in Delphi (comments under Ken White's answer), I see the TStreamWriter not flushing with the following code: procedure TFrmAddEvents.LogEvent(AEvent: TcxSchedulerEvent); begin if not Assigned(FStreamWriter) then begin FStreamWriter := TStreamWriter.Create(TFileStream.Create(ChangeFileExt(ParamStr(0),'.log'),fmCreate or fmOpenRead)); FStreamWriter.AutoFlush := true; end; FStreamWriter.WriteLine(TcxEventDescription(AEvent)); // Even this

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

Syntax Error with Query

时间秒杀一切 提交于 2020-01-11 09:21:31
问题 I would like to use an Insert Into query in Delphi XE2 to insert a user's information into a MS Access Database. The problem is I keep getting the same error: Syntax error in INSERT INTO statement I have done some research but there is no definitive answer. my source code is: opendb('QuizDB.mdb'); DB.Close; DB.SQL.Add('INSERT INTO tblUsers'); DB.SQL.Add('(FirstName,Surname,Username,Password,Grade)'); DB.SQL.Add('Values (:Firstname, :Surname, :Username, :Password, :Grade)'); Db.Parameters

Delphi XE2: Jumping to an anchor in CHM?

孤者浪人 提交于 2020-01-11 05:06:09
问题 In a Delphi XE2 program, how do I jump to an anchor inside a CHM help file topic? The anchor has the following format (extracted from the source of the topic page in HTML HelpViewer showing the CHM file): <a name="my_anchor_id"></a> I tried the following: Application.HelpJump('MyTopicName.htm#my_anchor_id'); Unfortunately, this does not work: It does jump to this topic, but only to the top of the topic, not to the anchor, which is several scrolls down the page. 回答1: Jumping to an anchor in

What should be tested in 64-bit Delphi

给你一囗甜甜゛ 提交于 2020-01-10 14:56:29
问题 Delphi with 64 bit compilation is now in Beta, but only invited beta-testers will get their hands on this version. What should be tested by the beta testers? 回答1: Embarcadero will probably provide a tester's guide for the beta testers. But, here are some ideas: Memory allocation, alignment, heap and stack. 32-bit could use up to 4GB (well, 3.5) of address space on a 64-bit version of Windows with the /LARGEADDRESSAWARE switch: Delphi64 should be able to use much more. Try allocating 8, 16,