delphi

How to Compare TBlobField OldValue with Value

In Delphi 2010, if Field.OldValue <> Field.Value then ... raises the Exception: raised exception class EVariantTypeCastError with message 'Could not convert variant of type (Array Byte) into type (Integer)'. How can I know if a TBlobField value has changed? ...

Why is DoubleBuffered disabled by default?

After creating a new form, I usually perform this ritual: Change the name into something meaningful; Type a Caption; Change the position property (DefaultPosOnly is hardly ever what users expect); Set ShowHint to true; Set DoubleBuffered to true; I've been wondering for a while why the default value is 'False'. To me it just looks ...

Retrieving Delphi Window Handles

I am trying to get the window handles to a Delphi application from an external application. I can see that there are a few windows created (TApplication, TFrmMain and a few others), and I know that TApplication is the "controller", but never visible. However, can I read what the value for the real window is? I know that it is TFrmMain (f...

Class Helper and Strings in Delphi Win32.

Is there any way with the current delphi to implement. a) String (as a class) with operator overloads (ie. +, =) b) Class Helper's so one could add custom string methods I gather the string is a native type so class helpers will not work without setting up a class etc. ...

Creating a singleton in Delphi using the new features of D2009 and D2010

I'm looking to create a singleton in Delphi. I've done this before using older versions of Delphi, and ended up using global variables (in the implementation section) and using initialization and finalization to take care of the instance. Also there was no way of preventing the user from creating an instance as you couldn't hide the stan...

Howto determine if connection is still alive with Indy?

I use Indy for TCP communication (D2009, Indy 10). After evaluating a client request, I want to send the answer to the client. I therefore store the TIdContext, like this (pseudocode) procedure ConnectionManager.OnIncomingRequest (Context : TIdContext); begin Task := TTask.Create; Task.Context := Context; ThreadPool.AddTask (Task...

How to run procedure from another unit?

Well this kind of n00b question but I still can't figure it out. I have unit main with procedure Discard() in it. Now I have another unit engine and I want to run from it procedure Discard() of unit main. I have main in uses section of engine.pas. I tried to call procedure with main.Discard() but no good. What am I doing wrong? ...

Need form to stay on top of parent only.

Hi, I have a multi-window application. My main form is a child of the desktop. My application can create other forms that also become children of the desktop. However, I have a special case where my main form needs to create a form that will always stay on top of it. I had this working to an extent....however, if I then create other wi...

Parsing XML references in Delphi

I used Delphi 2006 data binding wizard to create a interface for an XML configuration file. Later on I realized that some repeated parts of the XML can be separated from the main file and referenced where needed. The resulting XML looks something like this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE module [ <!ENTITY Schema65 SYST...

Intel x86 assembly optimization techniques in a sample problem.

I am learning assembler quite a while and I am trying to rewrite some simple procedures \ functions to it to see performance benefits (if any). My main development tool is Delphi 2007 and first examples will be in that language but they can be easily translated to other languages as well. The problem states as: We have given an unsigne...

What is the fastest possible way to sort an array of 7 integers?

This is a part of a program that analyzes the odds of poker, specifically Texas Hold'em. I have a program I'm happy with, but it needs some small optimizations to be perfect. I use this type (among others, of course): type T7Cards = array[0..6] of integer; There are two things about this array that may be important when decidin...

Change the label of a TCollectionItem in the Delphi editor

A component I am working on uses a TCollection to hold links to other components. When the items are edited in the designer their labels look something like this: 0 - TComponentLink 1 - TComponentLink 2 - TComponentLink 3 - TComponentLink How do I add meaningful labels (the name of the linked component perhaps)? e.g. 0 - UserList 1 -...

How do I make the scroll bars show up on a TScrollBox?

The TScrollBox control looks like it's supposed to basically be a TPanel with scroll bars attached along the bottom and the right edge. I tried placing one on a form, but no matter what I do, I can't make the scroll bars actually appear, either at design-time or at runtime. Does anyone know how to make them show up? ...

How can I tell if I'm in a Delphi exception stack?

From within a finally block, is it possible to tell an exception has been raised? ...

How do you add MRF list to a TRibbons dropdown button collection?

I can easly add a MRF list to A TRibbon recent items list but how do you add the same list to a ribbon item set as a dropdownbutton? The dropdown item is ActionBars[2].Items[1]. var ARecentFilesList: TStringList; ACI: TActionClientItem; if FileExists( ARecentFilesFilename ) then begin ARecentFilesList.LoadFromFile( ARecentFilesFile...

TThread.resume is deprecated in Delphi-2010 what should be used in place?

In my multithread application I use TThread.suspend and TThread.resume Since moving my application to Delphi 2010 I get the following warring message [DCC Warning] xxx.pas(277): W1000 Symbol ‘Resume’ is deprecated If Resume is deprecated what should be used in place? EDIT 1: I use the Resume command to start the thread - as it i...

How to make RibbonApplicationMenuBar inactive/active?

I have tried lots of methods associated with RibbonApplicationMenuBar to prevent a user from selecting the RibbonApplicationMenuBar with a mouse until the projects settings are loaded from an inifile and a splashform closes. But nothing seems to work to make the RibbonApplicationMenuBar InActive until told otherwise. The help file show...

How to add OnComplete event to bitmap.SaveToFile('img.bmp');

i want to halt my application when my bitmap is completely saved? ...

How do I add Perl scripting support to a Delphi application?

PLDelphi is a Perl project hosted on CPAN. I am currently working on a Delphi application and I am investigating the possibility of adding Perl scripting support and read about PLDelphi. Ideally, I'd like my application to not require Perl to be installed. PLDelphi claims to support this: To use PLDelphi from your Delphi applicati...

Delphi won't run!

When trying to run Delphi 7, I get this frightening message: Borland license information was found, but it is not valid for Delphi. You cannot run Delphi without this information. Click the exit button to exit Delphi. Delphi was running fine this morning, then choked when I tried to load the project on which I'm currently working. I rei...