delphi-2009

Does it make more sense to upgrade to Delphi 2009/2010 or to buy Software Assurance?

与世无争的帅哥 提交于 2019-12-06 02:03:56
问题 If you've purchased the Software Assurance, can you please share your experience? Was it worthwhile? I vaguely remember reading some negative comments about SA maybe 1 or 2 years ago. 回答1: If you normally upgrade each time a new version of Delphi is released, SA is great. It's slightly cheaper than the upgrade pricing, you get the new software right away (no wait for purchasing/ordering), and you get a couple of support incidents thrown in. It also makes it much easier for those of us who

Is there a generic “Object Pool” implementation for Delphi?

余生颓废 提交于 2019-12-05 21:52:04
I came across this while looking for a database connection pool implementation for Delphi. An object pool needs two methods: get - to acquire an object from the pool (this will create a new instance if the pool is empty or its size has not reached its maximum size), this methods must be thread safe so that one object can not be acquired by two threads at the same time. If all objects are iin use, the get method must block (maybe with an optional time out) put - to release (return) an object to the pool So a use case would look like O := Pool.Get; try ... use O finally Pool.Put(O); end; Update:

Why is TList.Remove() producing an EAccessViolation error?

家住魔仙堡 提交于 2019-12-05 20:48:37
问题 Why EAccessViolation is raised when executing the code below? uses Generics.Collections; ... var list: TList<TNotifyEvent>; ... begin list := TList<TNotifyEvent>.Create(); try list.Add(myNotifyEvent); list.Remove(myNotifyEvent); // EAccessViolation at address... finally FreeAndNil(list); end; end; procedure myNotifyEvent(Sender: TObject); begin OutputDebugString('event'); // nebo cokoliv jineho end; 回答1: It looks like a bug. If you compile with debug dcu's (normally don't do that unless you

Derive from specialized generic types

青春壹個敷衍的年華 提交于 2019-12-05 19:09:01
Is it possible to derive a class from a specialized generic type: TGenericBase <T> = class // ... end; TSpecializedDerived = class (TGenericBase <String>) // ... end; Just wondering if this is possible at all... EDIT Code works fine when I put it in a new project. Must be due to some other mistake; sorry about that Yes. I do it all the time. It's very useful. One of my favorite tricks goes something like this: TSpecializedList = class(TObjectList<TMyType>) public (extra methods specific to handling TMyType objects) end; 来源: https://stackoverflow.com/questions/793735/derive-from-specialized

Delphi TThread.CurrentThread and EAccessViolation - Is This a Bug or My Incompetence..?

橙三吉。 提交于 2019-12-05 18:30:27
问题 In Delphi 2009 I'm finding that any time I use TThread.CurrentThread in an application, I'll get an error message like the following when the application closes: Exception EAccessViolation in module ntdll.dll at 0003DBBA. Access violation at address 7799DBBA in module 'ntdll.dll'. Write of address 00000014. Unless it's just my machine, you can replicate this in a few seconds: create a new Delphi Forms Application, add a button to the form, and use something like the following for the button's

A simple way to show activity on the tab for a TTabSheet

喜夏-厌秋 提交于 2019-12-05 16:59:41
Basically I want an activity indicator that will show at a glance that there is an active calculation in progress on that tab. I'm looking for something very simple, like showing a gif on the tab, or showing a sequence of strings that change with a timer. I don't want a complicated solution or a solution that requires new components. I already have an implementation, but I'm having a problem with it that I'm asking for a more specific solution to here: How to show backslash in a japanese locale In the case that there isn't a solution to the other problem, or that there is a significantly

TLinkLabel background on a TPageControl

こ雲淡風輕ζ 提交于 2019-12-05 16:49:11
问题 I am trying to use a TLinkLabel on a TPageControl, and I can't find a way to make it use it's parent's background. // Image removed because the website doesn't exist any more // and I can't find it anywhere... Sorry. As you can see, the parent tab sheet's lovely gradient is not preserved behind the link text. I would like the functionality of having multiple links in a flowing block of text (the functionality that TLinkLabel provides) and have the background of the parent showing behind the

Where do I define symbols tested with {$IFDEF}?

霸气de小男生 提交于 2019-12-05 14:14:42
问题 When I use Delphi directives in code, like: {$IFDEF something} . . . {$ENDIF} Where do I assign the word 'something' in the project? I tried in some places in project options but it didn't work. Guess I didn't find the correct one. 回答1: It's in the Conditional Defines slot under Project | Options, which looks like this on D2010: 回答2: Other answers have pointed you at the places to define symbols and the scope implications of the different approaches. However, what no-one has yet mentioned is

Object orientation and serialization

这一生的挚爱 提交于 2019-12-05 14:06:12
Consider an interface like IMyInterface = interface procedure DoSomethingRelevant; procedure Load (Stream : TStream); procedure Save (Stream : TStream); end; and several classes that implement the interface: TImplementingClass1 = class (TInterfacedObject, IMyInterface) ... end; TImplementingClass2 = class (TInterfacedObject, IMyInterface) ... end; ... I have a class that has a list of IMyInterface implementors: TMainClass = class strict private FItems : TList <IMyInterface>; public procedure LoadFromFile (const FileName : String); procedure SaveToFile (const FileName : String); end; Now to the

Delphi 2009 where is the 'treat warnings as errors' option?

喜夏-厌秋 提交于 2019-12-05 13:51:33
问题 In Delphi 2009 whereabouts do you turn on the option to treat warnings as errors? 回答1: Just found the answer soon after I posted this! Might be useful for other people. Navigate to ' Project -> Options - > Delphi Compiler -> Hints and Warnings ' and change the value of ' Output Warnings ' to ' as errors ' I was looking for an option similar to what Visual Studio has 回答2: On a related note, if you are using the command line compiler (DCC32.exe) the switch is -W^ to have warnings treated as