delphi-2006

How to ignore timer events in Delphis MessageDlg

守給你的承諾、 提交于 2019-12-07 07:46:15
问题 I have set up a global exception handler in Delphi. On some severe exceptions an error message is displayed (followed by Halt()). While the error message is shown, Delphi is processing the message queue, processing timer events, that lead to further errors. What I want is to show an error dialog which does not process timer events. How is that possible in Delphi? Edit: I use Dialogs.MessageDlg(...) to display the message. 回答1: You can filter queued messages, such as WM_TIMER , with

Delphi - Comparing two pathnames when one is UNC and one is drive letter-specified

荒凉一梦 提交于 2019-12-07 05:42:01
问题 I have a situation where a user can specify two separate pathnames, and I need to check whether one pathname is "inside" the other one. I can do this if both pathnames are UNC, or both are drive-letter-based, but what if they are mixed? Can you "normalise" a path such as "C:\Program Files" to "\\[this computer name]\C\Program Files"? Obviously, I can't go the other way, as a network folder in UNC format may not have a corresponding drive letter mapped to it. 回答1: Have a look at

Reading and writing into the XML file

吃可爱长大的小学妹 提交于 2019-12-06 12:18:51
问题 I need to work on XML files using Delphi. I want to present the xml data in a DBGrid to the user and save the changes done by user in the XML file. For example in the below xml (which was presented to the user), if user changed City of ABC under client and added a new customer with NickName as "AAA" those changes should be reflected in the XML file. <Data LinkID=”0”> <Client> <Item Name=”ABC” Mobile=”1234” City=”IN” /> <Item Name=”PQR” Mobile=”5678” City=”IN” /> </Client> <Customer> <Item

how do I avoid this unwanted behaviour with Delphi's TSplitter and panels?

ε祈祈猫儿з 提交于 2019-12-06 01:57:22
问题 Included is a small project demonstrating my problem. I have a TPageControl aligned to the main form. On each of two tabsheets I have panels client aligned. On each of those panels I have 2 subpanels and a splitter. The LH panel and splitter is aligned left, the RH panel client-aligned. Basically the problem is interaction between the 2 tabs. To demonstrate: run the program stretch the main form horizontally. Panel 3 will grow move the splitter as far to the right as it will go. Panel 2 will

Delphi idle handler only fires when I move the mouse

无人久伴 提交于 2019-12-05 20:02:49
I have an OnIdle handler in my D2006 app. With this code: procedure TMainForm.ApplicationEvents1Idle(Sender: TObject; var Done: Boolean); begin Inc (IdleCalls) ; Sleep (10) ; Done := False ; end ; the app runs smoothly, the idle handler is called 100 times per second, and the CPU usage is next to zero. I then added a TActionList and connected up some controls to actions, coded an Execute and Update handler. procedure TMainForm.ActionNewButtonExecute(Sender: TObject); begin DoNewProject ; end ; procedure TMainForm.ActionNewButtonUpdate(Sender: TObject); begin ActionNewButton.Enabled :=

Is there any simple automated way of finding out all the source files associated with a Delphi project?

喜欢而已 提交于 2019-12-05 18:33:53
I like to backup up the source code set for a project when I release a version. I use GExperts project backups, which seems to gather up all the files in the project manager into the ZIP file. You can also add arbitrary files to this file set, but I'm always conscious of the fact that I haven't necessarily got all the files. Unless I specifically go though the uses clauses and add all the units I have sources for to the project, I'll never be sure of storing all the files necessary to recreate the installable/executable. I've thought about rolling an app to traverse a project, following all

It seems that sometimes Delphi is case-sensitive - “override method should match case of ancestor”

跟風遠走 提交于 2019-12-05 03:31:40
Today I've encountered a 'strange' hint: override method xxxx should match case of ancestor yyyy. Solution was to declare the method name exactly as in the ancestor....I believe this is something which rested in the compiler since the Delphi.Net compiler... Declaring the method exactly as in the ancestor made the compiler 'silent'. There are other 'case-sensitive' hints/warnings in Delphi 2006 and up? Johan It's a hint that's in place to protect your code when cooperating with 3rd party code. This hint was introduced with the addition of Delphi for .net, because some other .net platforms are

A quick way to remove properties from .dfm files in Delphi

冷暖自知 提交于 2019-12-05 02:23:36
I have recently modified one of my components, and it so happens it is no longer using one of the properties it used before. However, those properties are written in multiple .dfm files throughout the project. Now, when i try to compile the project, i get "Error reading .: Property <...> does not exist" The complicated part is that the property value is binary data (stored in multiple lines), and i cant just delete it with Delphi replace or notepad++ regexp (since they are single-line based). So my question would be: Are there any third party tools or ways to easily remove properties from

Open an ANSI file and Save a a Unicode file using Delphi

丶灬走出姿态 提交于 2019-12-04 22:29:52
问题 For some reason, lately the *.UDL files on many of my client systems are no longer compatible as they were once saved as ANSI files, which is no longer compatible with the expected UNICODE file format. The end result is an error dialog which states "the file is not a valid compound file". What is the easiest way to programatically open these files and save as a unicode file? I know I can do this by opening each one in notepad and then saving as the same file but with the "unicode" selected in

How to fix owner draw anomaly in DBGrid?

时光总嘲笑我的痴心妄想 提交于 2019-12-04 20:54:04
Continuing with the project started in: How to auto fit/scale DBGrid's (or other similar) columns widths according to its contents? I used the @alzaimar answer to auto fit the columns according to their content width, but he showed me how to increase the width, but not how to decrease, so I complemented the code as shown above: procedure TRecordsBrowserFrameBase.JvDBGrid2DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); var h, p, g, r, w, t : Integer; const colSpc = 10; begin { ajusta as colunas de uma grade de acordo com o conteúdo