rkamarowski
Programmer
whenever i attempt to access the GlobalName property in my component i'm getting a stack overflow error. any help would be appreciated.
thanks
======================
unit KMPDGlobalLister;
interface
uses
SysUtils, Classes, Controls, ExtCtrls,
Dialogs, StdCtrls, Trpcb, ToolWin, MFunStr;
type
TNotifyEvent = procedure (Sender: TObject) of object;
TKMPDGlobalLister = class(TPanel)
private
{ Private declarations }
function GetGlobalName: string;
function GetLastNodeAccessed: string;
procedure buttonMoreClick(strVal: String);
procedure SetGlobalName(strVal: string);
procedure SetLastNodeAccessed(strVal: string);
property GlobalName: string read GetGlobalName write SetGlobalName;
protected
{ Protected declarations }
procedure buttonFindClick(Sender: TObject);
public
{ Public declarations }
panelTools: TPanel;
memoGlobalLister: TMemo;
buttonFind: TButton;
buttonMore: TButton;
editGlobalName: TEdit;
labelGlobalName: TLabel;
// properites
property LastNodeAccessed: string read GetLastNodeAccessed write SetLastNodeAccessed;
// methods
Constructor Create(AnOwner:TComponent); Override;
Destructor Destroy; Override;
published
{ Published declarations }
FRpcBroker: TRPCBroker;
property RpcBroker: TRPCBroker read FRpcBroker write FRpcBroker;
end;
procedure Register;
implementation
Constructor TKMPDGlobalLister.Create(AnOwner:TComponent);
begin
inherited Create(AnOwner);
Align:=alClient;
Anchors:=[akLeft,AkRight,akTop,akBottom];
Height:=200;
Width:=200;
panelTools:=TPanel.Create(Self);
with panelTools do
begin
Align:=alTop;
Anchors:=[akLeft,akRight,akTop];
BevelEdges:=[beBottom];
Caption:='';
Enabled:=True;
Height:=21;
Parent:=Self;
Visible:=True;
Width:=175;
end;
panelTools.Show;
labelGlobalName:=TLabel.Create(Self);
with labelGlobalName do
begin
Align:=alLeft;
Enabled:=True;
Caption:=' Global ^ ';
Height:=20;
Layout:=tlCenter;
Parent:=panelTools;
Visible:=true;
end;
labelGlobalName.Show;
editGlobalName:=TEdit.Create(Self);
with editGlobalName do
begin
Align:=alLeft;
Enabled:=true;
Parent:=panelTools;
Visible:=true;
end;
editGlobalName.Show;
buttonFind:=TButton.Create(panelTools);
with buttonFind do
begin
Align:=alLeft;
Caption:='Find';
Enabled:=true;
onClick:=buttonFindClick;
Parent:=panelTools;
Visible:=true;
end;
buttonFind.show;
buttonMore:=TButton.Create(panelTools);
with buttonMore do
begin
Align:=alLeft;
Caption:='More';
Enabled:=false;
Parent:=panelTools;
Visible:=true;
end;
buttonMore.show;
// memo for text
memoGlobalLister:=Tmemo.Create(Self);
memoGlobalLister.Parent:=Self;
with memoGlobalLister do
begin
Align:=alClient;
BevelKind:=bkNone;
Enabled:=True;
Height:=150;
ReadOnly:=True;
ScrollBars:=ssBoth;
Width:=150;
end;
memoGlobalLister.Show;
end; // constructor
Destructor TKMPDGlobalLister.Destroy;
begin
inherited Destroy;
end;
// functions and procedures
function TKMPDGlobalLister.GetGlobalName: string;
begin
result:=GlobalName;
end;
function TKMPDGlobalLister.GetLastNodeAccessed: string;
begin
result:=LastNodeAccessed;
end;
procedure TKMPDGlobalLister.buttonFindClick(Sender: TObject);
begin
if editGlobalName.Text='' then exit;
messagedlg(editglobalname.Text,mterror,[mbok],0);
SetGlobalName(editGlobalName.Text);
MessageDlg('before buttonMoreClick',mtError,[mbOK],0);
SetLastNodeAccessed('');
buttonMore.Enabled:=false;
memoGlobalLister.Clear;
buttonMoreClick('');
end;
procedure TKMPDGlobalLister.buttonMoreClick(strVal: string);
var
i: integer;
intFontHeight: integer;
strLines: string;
begin
MessageDlg('strVal='+strVal,mtError,[mbOK],0);
if strVal='' then exit;
if RPCBroker=nil then exit;
// determine number of lines that can be displayed within the visible
// part of memo
if memoGlobalLister.Font.Height>-1 then
intFontHeight:=memoGlobalLister.Font.Height
else
intFontHeight:=memoGlobalLister.Font.Size*memoGlobalLister.Font.PixelsPerInch div 72;
intFontHeight:=(memoGlobalLister.ClientHeight div intFontHeight);
strLines:=Piece(FloatToStr(intFontHeight*0.75),'.',1);
with RPCBroker do
begin
RemoteProcedure:='KMPD GLOBAL LIST';
Param[0].Ptype:=literal;
Param[0].Value:=strVal;
Param[1].Ptype:=literal;
Param[1].Value:=GetLastNodeAccessed;
Param[2].Ptype:=literal;
Param[2].Value:=strLines;
try
Call;
except
MessageDlg('Unable to access Remote Procedure [KMPD GLOBAL LIST].',
mtError,[mbOK],0);
exit;
end;
// if error
// if ErrorCheck(Results[0],1,3)>0 then exit;
// btnPrint.Enabled:=True;
for i:=1 to Results.Count-1 do
MemoGlobalLister.Lines.Add(Results);
SetLastNodeAccessed(Results[0]);
// if end of global
if GetLastNodeAccessed='***end of list***' then
begin
memoGlobalLister.Lines.Add(GetLastNodeAccessed);
buttonMore.Enabled:=False;
end
else
begin
buttonMore.Enabled:=True;
buttonMore.Hint:='More';
// Panel1.Caption:='Press the More button to continue. You may also highlight and Print listing.';
end;
end;
end;
procedure TKMPDGlobalLister.SetGlobalName(strVal: string);
begin
GlobalName:=strVal;
end;
procedure TKMPDGlobalLister.SetLastNodeAccessed(strVal: string);
begin
LastNodeAccessed:=strVal;
end;
procedure Register;
begin
RegisterComponents('Capacity Planning', [TKMPDGlobalLister]);
end;
end.
thanks
======================
unit KMPDGlobalLister;
interface
uses
SysUtils, Classes, Controls, ExtCtrls,
Dialogs, StdCtrls, Trpcb, ToolWin, MFunStr;
type
TNotifyEvent = procedure (Sender: TObject) of object;
TKMPDGlobalLister = class(TPanel)
private
{ Private declarations }
function GetGlobalName: string;
function GetLastNodeAccessed: string;
procedure buttonMoreClick(strVal: String);
procedure SetGlobalName(strVal: string);
procedure SetLastNodeAccessed(strVal: string);
property GlobalName: string read GetGlobalName write SetGlobalName;
protected
{ Protected declarations }
procedure buttonFindClick(Sender: TObject);
public
{ Public declarations }
panelTools: TPanel;
memoGlobalLister: TMemo;
buttonFind: TButton;
buttonMore: TButton;
editGlobalName: TEdit;
labelGlobalName: TLabel;
// properites
property LastNodeAccessed: string read GetLastNodeAccessed write SetLastNodeAccessed;
// methods
Constructor Create(AnOwner:TComponent); Override;
Destructor Destroy; Override;
published
{ Published declarations }
FRpcBroker: TRPCBroker;
property RpcBroker: TRPCBroker read FRpcBroker write FRpcBroker;
end;
procedure Register;
implementation
Constructor TKMPDGlobalLister.Create(AnOwner:TComponent);
begin
inherited Create(AnOwner);
Align:=alClient;
Anchors:=[akLeft,AkRight,akTop,akBottom];
Height:=200;
Width:=200;
panelTools:=TPanel.Create(Self);
with panelTools do
begin
Align:=alTop;
Anchors:=[akLeft,akRight,akTop];
BevelEdges:=[beBottom];
Caption:='';
Enabled:=True;
Height:=21;
Parent:=Self;
Visible:=True;
Width:=175;
end;
panelTools.Show;
labelGlobalName:=TLabel.Create(Self);
with labelGlobalName do
begin
Align:=alLeft;
Enabled:=True;
Caption:=' Global ^ ';
Height:=20;
Layout:=tlCenter;
Parent:=panelTools;
Visible:=true;
end;
labelGlobalName.Show;
editGlobalName:=TEdit.Create(Self);
with editGlobalName do
begin
Align:=alLeft;
Enabled:=true;
Parent:=panelTools;
Visible:=true;
end;
editGlobalName.Show;
buttonFind:=TButton.Create(panelTools);
with buttonFind do
begin
Align:=alLeft;
Caption:='Find';
Enabled:=true;
onClick:=buttonFindClick;
Parent:=panelTools;
Visible:=true;
end;
buttonFind.show;
buttonMore:=TButton.Create(panelTools);
with buttonMore do
begin
Align:=alLeft;
Caption:='More';
Enabled:=false;
Parent:=panelTools;
Visible:=true;
end;
buttonMore.show;
// memo for text
memoGlobalLister:=Tmemo.Create(Self);
memoGlobalLister.Parent:=Self;
with memoGlobalLister do
begin
Align:=alClient;
BevelKind:=bkNone;
Enabled:=True;
Height:=150;
ReadOnly:=True;
ScrollBars:=ssBoth;
Width:=150;
end;
memoGlobalLister.Show;
end; // constructor
Destructor TKMPDGlobalLister.Destroy;
begin
inherited Destroy;
end;
// functions and procedures
function TKMPDGlobalLister.GetGlobalName: string;
begin
result:=GlobalName;
end;
function TKMPDGlobalLister.GetLastNodeAccessed: string;
begin
result:=LastNodeAccessed;
end;
procedure TKMPDGlobalLister.buttonFindClick(Sender: TObject);
begin
if editGlobalName.Text='' then exit;
messagedlg(editglobalname.Text,mterror,[mbok],0);
SetGlobalName(editGlobalName.Text);
MessageDlg('before buttonMoreClick',mtError,[mbOK],0);
SetLastNodeAccessed('');
buttonMore.Enabled:=false;
memoGlobalLister.Clear;
buttonMoreClick('');
end;
procedure TKMPDGlobalLister.buttonMoreClick(strVal: string);
var
i: integer;
intFontHeight: integer;
strLines: string;
begin
MessageDlg('strVal='+strVal,mtError,[mbOK],0);
if strVal='' then exit;
if RPCBroker=nil then exit;
// determine number of lines that can be displayed within the visible
// part of memo
if memoGlobalLister.Font.Height>-1 then
intFontHeight:=memoGlobalLister.Font.Height
else
intFontHeight:=memoGlobalLister.Font.Size*memoGlobalLister.Font.PixelsPerInch div 72;
intFontHeight:=(memoGlobalLister.ClientHeight div intFontHeight);
strLines:=Piece(FloatToStr(intFontHeight*0.75),'.',1);
with RPCBroker do
begin
RemoteProcedure:='KMPD GLOBAL LIST';
Param[0].Ptype:=literal;
Param[0].Value:=strVal;
Param[1].Ptype:=literal;
Param[1].Value:=GetLastNodeAccessed;
Param[2].Ptype:=literal;
Param[2].Value:=strLines;
try
Call;
except
MessageDlg('Unable to access Remote Procedure [KMPD GLOBAL LIST].',
mtError,[mbOK],0);
exit;
end;
// if error
// if ErrorCheck(Results[0],1,3)>0 then exit;
// btnPrint.Enabled:=True;
for i:=1 to Results.Count-1 do
MemoGlobalLister.Lines.Add(Results);
SetLastNodeAccessed(Results[0]);
// if end of global
if GetLastNodeAccessed='***end of list***' then
begin
memoGlobalLister.Lines.Add(GetLastNodeAccessed);
buttonMore.Enabled:=False;
end
else
begin
buttonMore.Enabled:=True;
buttonMore.Hint:='More';
// Panel1.Caption:='Press the More button to continue. You may also highlight and Print listing.';
end;
end;
end;
procedure TKMPDGlobalLister.SetGlobalName(strVal: string);
begin
GlobalName:=strVal;
end;
procedure TKMPDGlobalLister.SetLastNodeAccessed(strVal: string);
begin
LastNodeAccessed:=strVal;
end;
procedure Register;
begin
RegisterComponents('Capacity Planning', [TKMPDGlobalLister]);
end;
end.