Hallo Vitalik,
On 07-06-97 at 00:05:06 you wrote to All:
VM> Hi, All!
VM> Tell me plz somebody: Do have Delphi2 standart TEdit-like element,
VM> that work with Integer, etc. types, but not with string? Thanx.
No, but you can write your own components, for example (Delphi 1.0 code):
======================================================
TLongEdit = class(TEdit)
private
Function GetData : LongInt;
Procedure SetData(aLong : LongInt);
public
Constructor Create(aOwner : TComponent); Override;
published
Property Text : LongInt read GetData write SetData;
end;
procedure Register;
{************************} implementation {************************}
procedure Register;
begin
RegisterComponents('MyEdits', [TLongEdit]);
end;
{-------------------------------------------------------------------}
Constructor TLongEdit.Create;
begin
Inherited Create(aOwner);
Inherited Text := '0';
end;
{-------------------------------------------------------------------}
Function TLongEdit.GetData;
begin
Try
GetData := StrToInt(Inherited text);
except
GetData := 0;
end;
end;
{-------------------------------------------------------------------}
Procedure TLongEdit.SetData(aLong : LongInt);
begin
Inherited text := IntToStr(aLong);
end;
======================================================
Some checking should be added to make the component foolproof.
The property TEXT can be accessed as if it is an integer (besides some
exceptions).
_____
GR. |cc
--- FleetStreet 1.19+
---------------
* Origin: ?? (2:284/420.11)
|