subroutine FitToScreen ( string: DialogName_SV ) is
integer DX DY OX OY
float FX is 1.0
FY is 1.0
string Child
copy (window xsize of desktop) to DX
copy (window ysize of desktop) to DY
copy xsize of DialogName_SV to OX
copy ysize of DialogName_SV to OY
call OS_GraphicalToDialog(DX, DY)
if (OX > DX) then
copy OX to FX
copy (DX / FX) to FX
copy (OX * FX) to OX
end if
if (OY > DY) then
copy OY to FY
copy (DY / FY) to FY
copy (OY * FY) to OY
end if
if ((FX < 1.0) or (FY < 1.0)) then
change DialogName_SV size to OX OY
for each child Child of DialogName_SV loop
change Child position to ((xposition of Child) * FX)
((yposition of Child) * FY)
change Child size to ((xsize of Child) * FX)
((ysize of Child) * FY)
end loop
end if
change DialogName_SV position to
((DX/2) - (OX/2))
((DY/2) - (OY/2))