delphi-units

Any tool to suggest unit reference automatically for Delphi 2010?

最后都变了- 提交于 2019-12-31 19:28:10
问题 MS Visual Studio has a great feature: it automatically suggests the units to add in using clause when you typing the code with refrences to absent standard classes. Is there any 3-rd party tool to implement similar feature for Delphi? I'm tired to add all those SysUtils, Windows, Messages etc in each new unit. 回答1: If the unit which contains the reference is not yet in the uses list, this is how I save many manual steps: right-click on the underlined (error-insighted) text choose “Refactoring

Circular reference issue with Classes which use each other

你离开我真会死。 提交于 2019-12-24 11:30:14
问题 I have the following two classes: TcmTPDataPanel = class(TcmTPBasePanel) Database: TnxDatabase; Session: TnxSession; private FDataConnector: TcmTPDataConnector; MyNxDataBase: TnxDatabase; MyNxSession: TnxSession; MyRefNxDataBase: TnxDatabase; protected procedure Disconnect; virtual; abstract; procedure Refresh; virtual; procedure Requery; virtual; abstract; public procedure Connect; published property DataConnector: TcmTPDataConnector read FDataConnector write FDataConnector; end;

Does it make a difference if I clean up my uses clause if the removed units are still used in other units?

╄→尐↘猪︶ㄣ 提交于 2019-12-23 08:34:46
问题 Personally I like it if my uses clauses are as small as possible, but in many applications the really big units (in terms of bloating the executable) like Forms or VirtualTrees are needed in at least another unit anyway. So: Does it make a difference if I clean my uses clauses even if in the end no unit is removed from the project? If so: In what way? And: Is cleaning the uses clause something which should be done as soon as possible or can it wait until I find an unused unit by chance? 回答1:

Does it make a difference if I clean up my uses clause if the removed units are still used in other units?

好久不见. 提交于 2019-12-23 08:34:19
问题 Personally I like it if my uses clauses are as small as possible, but in many applications the really big units (in terms of bloating the executable) like Forms or VirtualTrees are needed in at least another unit anyway. So: Does it make a difference if I clean my uses clauses even if in the end no unit is removed from the project? If so: In what way? And: Is cleaning the uses clause something which should be done as soon as possible or can it wait until I find an unused unit by chance? 回答1:

Are units in delphi same as classes in other languages? [closed]

让人想犯罪 __ 提交于 2019-12-23 03:29:20
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I need to write some Delphi code, but I have no prior experience with Delphi. I've seen people writing some code, known as unit1 or unit2 and import it using the code inside them. So, can I see the unit as a

Accessing data stored in another unit Delphi

做~自己de王妃 提交于 2019-12-13 01:28:15
问题 In Unit2 of my program i have the following code: TValue = Record NewValue, OldValue, SavedValue : Double; end; TData = Class(TObject) Public EconomicGrowth : TValue; Inflation : TValue; Unemployment : TValue; CurrentAccountPosition : TValue; AggregateSupply : TValue; AggregateDemand : TValue; ADGovernmentSpending : TValue; ADConsumption : TValue; ADInvestment : TValue; ADNetExports : TValue; OverallTaxation : TValue; GovernmentSpending : TValue; InterestRates : TValue; IncomeTax : TValue;

Are units in delphi same as classes in other languages? [closed]

旧街凉风 提交于 2019-12-08 14:33:26
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center . Closed 6 years ago . I need to write some Delphi code, but I have no prior experience with Delphi. I've seen people writing some code, known as unit1 or unit2 and import it using the code inside them. So, can I see the unit as a class in Java or C#? No. A unit is a source code file in Delphi. You can essentially think of it as a

Defining types from other units in Delphi

空扰寡人 提交于 2019-12-07 19:49:49
问题 Var A : Array [1..4] of Integer; B : Array [1..4] of Integer; Begin A := B; Won't work as loren-pechtel said here the problem is A and B for me are in different units. So, is there a way to define a type definition from a existing one in another class? 回答1: Define type in interface block of some unit and then include that unit via uses clause in other units where you need that type. unit A; interface type TMyArray = array [1..4] of Integer; ... When you need to use TMyArray in another unit:

How to run procedure from another unit?

烈酒焚心 提交于 2019-12-07 01:34:16
问题 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? 回答1: You need to put the procedure's signature in your interface, like so: unit main; interface procedure Discard(); implementation procedure Discard(); begin //do

How to run procedure from another unit?

青春壹個敷衍的年華 提交于 2019-12-05 05:26:22
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? You need to put the procedure's signature in your interface, like so: unit main; interface procedure Discard(); implementation procedure Discard(); begin //do whatever end; Other units can only "see" whatever's listed in the interface section. In unit "Main" you