[lazarus] Internal error 55665566
Tony Maro
tony at maro.net
Sun Nov 16 14:17:30 EST 2003
This is pretty cool. Compile the unit below (I put it in a package, but
it may do it anywhere) and I get "Internal error 55665566".
If I add "controls" to the uses section, the error vanishes.
unit worldcurrency;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, stdctrls;
type
TCurrencySelector = class(TCustomComboBox)
private
FFormats: TStringList;
FCurrencyFormat: String;
function GetCurrencyFormat: String;
procedure Populate;
procedure AddFormat(AName, AFormat: String);
public
constructor create(AOwner: TComponent); override;
destructor destroy;
published
property CurrencyFormat: String read GetCurrencyFormat;
{ Expose ancestor properties }
property Anchors;
property ArrowKeysTraverseList;
property AutoDropDown;
property Ctl3D;
property DropDownCount;
property Enabled;
property Font;
property ItemHeight;
property Items;
property ItemWidth;
property MaxLength default -1;
property OnChange;
property OnChangeBounds;
property OnClick;
property OnCloseUp;
property OnDrawItem;
property OnDropDown;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property ShowHint;
property TabOrder;
property TabStop;
property Text;
property Visible;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('CheckBook',[TCurrencySelector]);
end;
{ TCurrencySelector }
procedure TCurrencySelector.Populate;
begin
Self.Items.Clear;
// data taken from:
// http://www.thefinancials.com/vortex/CurrencyFormats.html
AddFormat('Argentina Peso', '$#.###,##');
AddFormat('Armenia Dram', '#,###.##AMD');
end;
function TCurrencySelector.GetCurrencyFormat: String;
begin
Result := '';
if Self.ItemIndex < 0 then exit;
result := FFormats[Self.ItemIndex];
end;
procedure TCurrencySelector.AddFormat(AName, AFormat: String);
begin
Items.Add(AName);
FFormats.Add(AFormat);
end;
constructor TCurrencySelector.create(AOwner: TComponent);
begin
inherited create(AOwner);
Style := csDropDownList;
Text := '';
Sorted := False;
FFormats := TStringlist.Create;
Populate;
end;
destructor TCurrencySelector.destroy;
begin
FFormats.Free;
end;
end.
More information about the Lazarus
mailing list