Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2002.05.06;
Скачать: CL | DM;

Вниз

классы   Найти похожие ветки 

 
EveryonE   (2002-02-28 18:32) [0]

есть класс TComputer.
Есть трабл с Items.

const
MaxComps = 10000;
type
TComputerType = record
Name, NetName, IP, Description: String;
end;

TComputer = class
private
FCount: Integer;
procedure SetComputers(Index: Integer; Computer: TComputerType);
function GetComputers(Index: Integer): TComputerType;
protected
Computers: array[0..MaxComps] of TComputerType;
public
constructor Create(AOwner: TComponent);
destructor Destroy; override;
property Items[Index: Integer]: TComputerType read GetComputers write SetComputers; default;
property Count: Integer read FCount;
function Add(Computer: TComputerType): Integer;
end;

var
Comps: TComputer;

Проблема:
пишу Comps.Items[0].Name := "asdasd";
ругается : Left side cannot be assigned to...
подскажите плз. Или как мне вообще создать такой Items типа TComputerType ???


 
vuk ©   (2002-02-28 18:43) [1]

Так не получится, поскольку Вы задаете метод доступа таким образом, что присвоена может быть только запись целиком, а не отдельное ее поле. Сделайте TComputerType классом, а поля - свойствами. Тогда все будет работать.


 
Nebula   (2002-03-01 12:02) [2]

С record-ом такое не пройдет, используй TcomputerType = class



Страницы: 1 вся ветка

Текущий архив: 2002.05.06;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.008 c
1-17519
HDD
2002-04-23 15:50
2002.05.06
Помогите пожалуйста!


1-17638
BillyJeans
2002-04-19 14:38
2002.05.06
проблема с переходом между DBEdit....


1-17608
Новенький в Делфи
2002-04-22 02:23
2002.05.06
Програмку в Menu Windows прописать?


3-17501
Filat
2002-04-12 15:44
2002.05.06
Не стартует 7.0? Ошибка 1069 !!! Что делать?


14-17699
greenrul
2002-03-27 17:07
2002.05.06
Вот мы все пишем, пишем, пишем свои утилитки...