. MoComponent 를 설치후 해당 프로젝트를 콜하면 첨부의 이미지와 같은
'ACCESS VIOLATION ~~~ MoComponent.bpl' 에러가 발생합니다. 따라서 해당 콤포넌트
들을 모두 사용할 수 없습니다. !
. Project\Bpl 디렉토리에 MoComponent.bpl 은 정상적으로 존재합니다.
. 설치된 콤포넌트중 일부 객체를 찾을수 없다는 메시지가 나오네요..
. 왜 이런 문제가 발생하는 지 정말 모르겠네요...좀 도와주세요 3일째 헤메고
있습니다.
. 아래는 객체를 찾을 수 없다고 나오는 콤포넌트의 소스입니다...전 다 정상으로
보이는데...
-------------------------------------------------
unit OpenMapDialog;
{$WARN SYMBOL_PLATFORM OFF}
{$R-}
interface
uses Messages, Windows, SysUtils, Classes, Controls, StdCtrls, Graphics,
ExtCtrls, Buttons, Dialogs, MoTLB, MoLayer, MoSymbol;
type
{ TOpenMapDialog }
TOpenMapDialog = class(TOpenDialog)
private
FOptionPanel: TPanel;
FGroupBox: TGroupBox;
FColorLabel: TLabel;
FColorPanel: TPanel;
FSizeLabel: TLabel;
FSizeEdit: TEdit;
FRadioGroup: TRadioGroup;
FDC: IMoDataConnection;
FMoLayer: TMoLayer;
FMapLayer: IMoMapLayer;
FImageLayer: IMoImageLayer;
FSymSize: Integer;
FBlank: String;
procedure ColorChange(Sender: TObject);
procedure SizeChange(Sender: TObject);
function CreateMapLayer: Boolean;
function CreateImageLayer: Boolean;
protected
procedure DoClose; override;
procedure DoSelectionChange; override;
procedure DoTypeChange; override;
procedure DoShow; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function Execute: Boolean; override;
property MoLayer: TMoLayer read FMoLayer;
property MapLayer: IMoMapLayer read FMapLayer;
property ImageLayer: IMoImageLayer read FImageLayer;
published
property Filter: String read FBlank write FBlank;
property Options: String read FBlank write FBlank;
end;
procedure Register;
implementation
uses Consts, Forms, CommDlg, Dlgs, MbTypeDef, MbControl, MbGeometry, MbFunction;
{ TOpenMapDialog }
//$R EXTDLGS.RES}
constructor TOpenMapDialog.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FDC := MbCreateDataConnection;
inherited Filter := 'Shape Files(*.shp)|*.shp|' +
'CAD Files(*.dwg; *.dxf)|*.dwg;*.dxf|' +
'Image Files(*.bmp; *.jpg; *.tif)|*.bmp;*.jpg;*.tif;*.gis;*.lan;*.bil;*.bip;*.bsq;*.sun;*.rs;*.rlc;*.adf;*.sid';
// 'Image Files(*.bmp; *.jpg; *.tif)|*.*';
FOptionPanel := TPanel.Create(Self);
with FOptionPanel do
begin
Name := 'OptionPanel';
Caption := '';
SetBounds(204, 15, 169, 200);
BevelOuter := bvNone;
BorderWidth := 6;
TabOrder := 1;
Font.Name := '굴림';
Font.Size := 9;
FGroupBox := TGroupBox.Create(FOptionPanel);
with FGroupBox do
begin
Name := 'GroupBox';
Caption := '';
Ctl3D := True;
SetBounds(1, 20, 160, 85);
Parent := FOptionPanel;
end;
FColorLabel := TLabel.Create(FOptionPanel);
with FColorLabel do
begin
Name := 'ColorLabel';
Caption := '';
SetBounds(24, 24, 40, 20);
AutoSize := False;
Parent := FGroupBox;
end;
FColorPanel := TPanel.Create(FOptionPanel);
with FColorPanel do
begin
Name := 'ColorPanel';
Caption := '';
SetBounds(64, 18, 25, 25);
Align := alNone;
BevelInner := bvLowered;
BevelOuter := bvRaised;
TabOrder := 0;
OnDblClick := ColorChange;
Parent := FGroupBox;
end;
FSizeLabel := TLabel.Create(FOptionPanel);
with FSizeLabel do
begin
Name := 'SizeLabel';
Caption := '';
SetBounds(24, 56, 40, 20);
AutoSize := False;
Parent := FGroupBox;
end;
FSizeEdit := TEdit.Create(FOptionPanel);
with FSizeEdit do
begin
Name := 'SizeEdit';
Text := '1';
SetBounds(64, 52, 57, 20);
Ctl3D := True;
OnChange := SizeChange;
Parent := FGroupBox;
end;
FRadioGroup := TRadioGroup.Create(FOptionPanel);
with FRadioGroup do
begin
Name := 'RadioGroup';
Caption := '';
SetBounds(1, 115, 160, 50);
Columns := 3;
Ctl3D := True;
Parent := FOptionPanel;
end;
end;
FSymSize := 1;
end;
destructor TOpenMapDialog.Destroy;
begin
FRadioGroup.Free;
FSizeEdit.Free;
FSizeLabel.Free;
FColorPanel.Free;
FColorLabel.Free;
FOptionPanel.Free;
inherited Destroy;
end;
procedure TOpenMapDialog.DoSelectionChange;
begin
inherited DoSelectionChange;
end;
procedure TOpenMapDialog.DoClose;
begin
inherited DoClose;
{ Hide any hint windows left behind }
Application.HideHint;
end;
procedure TOpenMapDialog.DoShow;
var
PreviewRect, StaticRect: TRect;
begin
{ Set preview area to entire dialog }
GetClientRect(Handle, PreviewRect);
StaticRect := GetStaticRect;
{ Move preview area to right of static area }
PreviewRect.Left := StaticRect.Left + (StaticRect.Right - StaticRect.Left);
Inc(PreviewRect.Top, 4);
FMapLayer := MbCreateMapLayer;
FOptionPanel.BoundsRect := PreviewRect;
FOptionPanel.ParentWindow := Handle;
FGroupBox.Caption := '심볼 설정';
FColorLabel.Caption := '색 상';
FColorPanel.Color := FMapLayer.Symbol.Color;
FSizeLabel.Caption := '크 기';
FSizeEdit.Text := '1';
with FRadioGroup do
begin
Caption := '도형 종류 선택';
Items.Clear;
Items.Add('점');
Items.Add('선');
Items.Add('면');
ItemIndex := 1;
end;
FRadioGroup.Visible := (FilterIndex = 2);
inherited DoShow;
end;
function TOpenMapDialog.Execute;
begin
if NewStyleControls and not (ofOldStyleDialog in inherited Options) then
Template := 'DLGTEMPLATE' else
Template := nil;
Result := inherited Execute;
FMoLayer := nil;
if not Result then Exit;
if FilterIndex < 3 then
Result := CreateMapLayer
else
Result := CreateImageLayer;
end;
procedure TOpenMapDialog.DoTypeChange;
begin
FOptionPanel.Visible := (FilterIndex <> 3);
FRadioGroup.Visible := (FilterIndex = 2);
FOptionPanel.Refresh;
inherited DoTypeChange;
end;
procedure TOpenMapDialog.ColorChange(Sender: TObject);
begin
GetColor(FColorPanel);
end;
function TOpenMapDialog.CreateMapLayer: Boolean;
var
FullName, FilePath, PureName: String;
GDS: IMoGeoDataset;
begin
Result := False;
FMapLayer := MbCreateMapLayer;
FullName := FileName;
FilePath := ExtractFilePath(FullName);
PureName := ExtractFileName(FullName);
if FilterIndex = 2 then begin
case FRadioGroup.ItemIndex of
0: FDC.Database := '[CADPoint]' + FilePath;
1: FDC.Database := '[CADLine]' + FilePath;
2: FDC.Database := '[CADArea]' + FilePath;
end;
end else begin
FDC.Database := FilePath;
end;
if not FDC.Connect then Exit;
GDS := FDC.FindGeoDataset(PureName);
if GDS = nil then Exit;
FMapLayer := MbCreateMapLayer;
FMapLayer.GeoDataset := GDS;
FMapLayer.Symbol.Color := FColorPanel.Color;
FMapLayer.Symbol.Size := FSymSize;
if FilterIndex = 2 then begin
PureName := Format('%s[%s]', [PureName, FRadioGroup.Items[FRadioGroup.ItemIndex]]);
FMapLayer.Name := PureName;
FMoLayer := TMoCADLayer.Create(FMapLayer);
end else begin
FMapLayer.Name := PureName;
FMoLayer := TMoMapLayer.Create(FMapLayer);
end;
FMoLayer.Visible := True;
Result := True;
end;
function TOpenMapDialog.CreateImageLayer: Boolean;
var
FullName, PureName: String;
begin
Result := False;
FImageLayer := MbCreateImageLayer;
FullName := FileName;
PureName := ExtractFileName(FullName);
FImageLayer.Name := PureName;
try
FImageLayer.File_ := FileName;
except
Application.MessageBox('Image File을 읽을 수 없습니다.', '확인', MB_OK);
Exit;
end;
FMoLayer := TMoImageLayer.Create(FImageLayer);
FMoLayer.Visible := True;
Result := True;
end;
procedure TOpenMapDialog.SizeChange(Sender: TObject);
begin
FSymSize := StrToIntEx(FSizeEdit.Text);
end;
procedure Register;
begin
RegisterComponents(PAGE_NAME, [TOpenMapDialog]);
end;
end.
---------------------------------------------------
저도 비슷한 경험을 하고 해결한 적이 있는데
Dos환경설정의 Path로 해결했는지,
델파이 버전 마다 약간씩 다른 Optioin -> Path (LIBs)로 해결했는지
아니면 컴포넌트를 지웠다가 다시 설치했는지
헷갈리네요.