> I put the following code into a form that can be created from many
> different forms so that it shows up centered inside the
> form from which the create originated.
one way, using your method, is:
procedure TfrmNotes.FormShow(Sender: TObject);
var
T,L,H,W : integer;
aParent:TForm;
begin
if (sender is tform) then
begin
aParent:=sender as tform;
self.left:=aParent.Left;
{ etc }
but i would prefer a seperate specific method, such as
procedure TfrmNotes.CenterInParent(const aParent:TForm);
begin
self.left:=aParent.left;
{etc}
which could be used like: (untested)
aForm:=TfrmNotes.Create(nil);
try
aForm.CenterInParent(self);
aForm.ShowModal;
{ stuff }
finally
aForm.Release;
aForm:=nil;
end;
and if you put CenterInParent in a new class that you subclass
TfrmNotes from, then you can even start to reuse code :-)
it also may pay to prefix procedure names to avoid name clashes, eg if
abc is your company name, instead of CenterInParent use
abcCenterInParent.
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"