delphi-2009

Derive from specialized generic types

…衆ロ難τιáo~ 提交于 2020-03-19 06:01:05
问题 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 回答1: 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

How can I capture variables by anonymous method when using it in OTL?

二次信任 提交于 2020-03-16 05:22:40
问题 What I want to do: I have a few objects in a genric list. I want to capture each of this object in anonymous method and execute this method as a separate OTL Task. This is a simplified example: program Project51; {$APPTYPE CONSOLE} uses SysUtils, Generics.Collections, OtlTaskControl, OtlTask; type TProc = reference to procedure; type TMyObject = class(TObject) public ID: Integer; constructor Create(AID: Integer); end; constructor TMyObject.Create(AID: Integer); begin ID := AID; end; var

Accessing classes that are in another DLL?

北城以北 提交于 2020-02-15 10:05:57
问题 Is there is a way of exporting and using classes from another dll, I have 2 dll's and I am trying to access classes in between, was wondering if this is possible. 回答1: There are a variety of ways to achieve this, including but not limited to the following: Use runtime packages rather than DLLs. Then you can use any types, variables, etc. from another module. Note that this forces you to use runtime packages in all of your modules, and to compile all of the modules with the same version of

Interfaces with Generics - Setting to NIL

大城市里の小女人 提交于 2020-02-03 03:15:15
问题 I am trying to implement clear in the following example code in Delphi 2009. interface ... TFoo<T : IInterface> = class(TObject) FField : T; procedure Clear; end; ... implementation ... procedure TFoo<T>.Clear; begin // Line Below Results In // E2010 Incompatible types: 'T' and 'Pointer' FField := nil; end; ... I could understand the complie time error if "T" was not constrained. But since "T" must be an Interface, I would have thought this syntax would have worked. Is there away to set

Interfaces with Generics - Setting to NIL

浪子不回头ぞ 提交于 2020-02-03 03:15:06
问题 I am trying to implement clear in the following example code in Delphi 2009. interface ... TFoo<T : IInterface> = class(TObject) FField : T; procedure Clear; end; ... implementation ... procedure TFoo<T>.Clear; begin // Line Below Results In // E2010 Incompatible types: 'T' and 'Pointer' FField := nil; end; ... I could understand the complie time error if "T" was not constrained. But since "T" must be an Interface, I would have thought this syntax would have worked. Is there away to set

How can I change the orientation of the label on a TPageControl?

筅森魡賤 提交于 2020-01-23 10:42:43
问题 I'm new to Delphi (again - I used Delphi back in 1994). I now have Delphi 2009 Pro. Coming from Java, I find the object inheritance very obscure. My users want tabbed pages with the tabs on the left. But, the TPageControl doesn't allow the tab label direction or orientation to be changed. They want the words on the tabs to read top to bottom with the letters rotated so they are in a "normal" orientation. With the tabs on the left the labels read from the bottom up with the letters rotated 90

How can I change the orientation of the label on a TPageControl?

不问归期 提交于 2020-01-23 10:42:28
问题 I'm new to Delphi (again - I used Delphi back in 1994). I now have Delphi 2009 Pro. Coming from Java, I find the object inheritance very obscure. My users want tabbed pages with the tabs on the left. But, the TPageControl doesn't allow the tab label direction or orientation to be changed. They want the words on the tabs to read top to bottom with the letters rotated so they are in a "normal" orientation. With the tabs on the left the labels read from the bottom up with the letters rotated 90

How can I change the orientation of the label on a TPageControl?

拟墨画扇 提交于 2020-01-23 10:41:42
问题 I'm new to Delphi (again - I used Delphi back in 1994). I now have Delphi 2009 Pro. Coming from Java, I find the object inheritance very obscure. My users want tabbed pages with the tabs on the left. But, the TPageControl doesn't allow the tab label direction or orientation to be changed. They want the words on the tabs to read top to bottom with the letters rotated so they are in a "normal" orientation. With the tabs on the left the labels read from the bottom up with the letters rotated 90

How can I change the orientation of the label on a TPageControl?

半腔热情 提交于 2020-01-23 10:41:07
问题 I'm new to Delphi (again - I used Delphi back in 1994). I now have Delphi 2009 Pro. Coming from Java, I find the object inheritance very obscure. My users want tabbed pages with the tabs on the left. But, the TPageControl doesn't allow the tab label direction or orientation to be changed. They want the words on the tabs to read top to bottom with the letters rotated so they are in a "normal" orientation. With the tabs on the left the labels read from the bottom up with the letters rotated 90

Datasnap : Is there a way to detect connection loss globally?

我与影子孤独终老i 提交于 2020-01-22 19:49:22
问题 I'm looking to detect local connection loss. Is there a mean to do that, as with the events on the Corelabs components ? Thanks EDIT: Sorry, I'm going to try to be more specific: I'm currently designing a prototype using datasnap 2009. So I've got a thin client, a stateless server app and a database server. What I would be able to do is to detect and handle connection loss (internet connectivity) between the client and the server app to handle it appropriately, ie: Display an informative