[DUG] Procedure run from main program
David Moorhouse
David.Moorhouse at pegasus.org.nz
Wed Oct 12 09:32:40 NZDT 2016
+1 for what the others said.
Have you also included the procedure declaration in the interface section so it is visible to the child forms ?
Cheers
D
David Moorhouse (BCom) | Principal Software Engineer - HealthOne
Pegasus Health (Charitable) Ltd
P: 03 353 0871 | W: www.pegasus.org.nz<http://www.pegasus.org.nz/>
E: david.moorhouse at pegasus.org.nz<mailto:david.moorhouse at pegasus.org.nz>
PO Box 741, Christchurch 8140
160 Bealey Ave, Christchurch 8014
[cid:image003.jpg at 01CEE516.6F544D00]
From: delphi-bounces at listserver.123.net.nz [mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of Barry Neale
Sent: Wednesday, 12 October 2016 9:11 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Procedure run from main program
Wallace it appears that all the procedure is completely self contained, in that it only references passed parameters.
Why not just put it in it's own unit (or a common utilities unit) and include it in any form that needs it, rather than having it in the mainform unit
On Tue, Oct 11, 2016 at 5:26 PM, Marshland Engineering <marshland at marshland.co.nz<mailto:marshland at marshland.co.nz>> wrote:
I'm back on the window page scaling for various forms in my project. This code
works quite well. It needs to reside in the main form. I can't get the syntax
right to be able to call it from a child form.
Any suggestions?
procedure FormScale (rHeiScale:real; rWidScale:real; sForm:tForm);
var
i:integer;
rWidth,rHeight:real;
begin
with sForm do begin
rHeight:=rHeiScale*(Screen.Height/Height); // Scale form
rWidth:=rWidScale*(Screen.Width/Width);
Height:=Round(Height*rHeight);
Width:=Round(Width*rWidth);
Left:=Round((Screen.Width-Width)/2); // Center form
Top:=Round((Screen.Height-Height)/2);
for i:=0 to componentcount-1 do
if Components[i] is TControl then begin
TControl(Components[i]).Top :=
Round(TControl(Components[i]).Top*rHeight);
TControl(Components[i]).Width :=
Round(TControl(Components[i]).Width*rWidth);
TControl(Components[i]).Height :=
Round(TControl(Components[i]).Height*rHeight);
TControl(Components[i]).Left :=
Round(TControl(Components[i]).Left*rWidth);
end;
end;
end;
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at listserver.123.net.nz<mailto:delphi at listserver.123.net.nz>
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at listserver.123.net.nz<mailto:delphi-request at listserver.123.net.nz> with Subject: unsubscribe
[http://snow.pegasus.org.nz/wp-content/uploads/2016/10/moving_footer.jpg]
********************************************************************************
This email or attachment(s) may contain confidential or legally privileged
information intended for the sole use of the addressee(s). Any use, redistribution,
disclosure, or reproduction of this message, except as intended, is prohibited.
If you received this email in error, please notify the sender and erase all
copies of the message, including any attachments.
Any views or opinions expressed in this email (unless otherwise stated) may not
represent those of Pegasus Health Ltd.
********************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20161011/022fe923/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 3614 bytes
Desc: image001.jpg
Url : http://listserver.123.net.nz/pipermail/delphi/attachments/20161011/022fe923/attachment.jpg
More information about the Delphi
mailing list