var gtc, ok, exit, back: command;
m1, m2, m3, c1, c2, c3, cf, cgsi, imw, imh, nw, nh: integer;
coefw, coefh: real;
ns: string;
begin
imw := 240;
imh := 320;
coefw := imw/imh;
coefh := imh/imw;
ok := createcommand('Ok',CM_OK,1);
showform;
m1 := formaddchoice('Relation', CH_EXCLUSIVE);
c1 := choiceappendstring(m1, 'Relate to width');
c2 := choiceappendstring(m1, 'Relate to height');
m2 := formaddtextfield('width', integertostring(imw), 4, TF_NUMERIC);
m3 := formaddtextfield('height', integertostring(imh), 4, TF_NUMERIC);
addcommand(ok);
repeat
cgsi := choicegetselectedindex(m1);
if cgsi = c1 then begin
nw := stringtointeger(formgettext(m2));
nh := trunc(stringtointeger(formgettext(m2))/coefw);
ns := integertostring(nw)+'x'+integertostring(nh);
end;
if cgsi = c2 then begin
nh := stringtointeger(formgettext(m3));
nw := trunc(stringtointeger(formgettext(m3))/coefh);
ns := integertostring(nw)+'x'+integertostring(nh);
end;
cf := formaddstring(ns);
delay(2000);
formremove(cf);
until getclickedcommand = ok;
removecommand(ok);
end.
карочи посмотрите как оно щитает с floating point и как с fixed point, и посмотрите что обычный калькулятор кажет. С floating point ваще бред, и fixed point нифига не показывает. а если imw и imh одинаковые (например 40 и 40) то щитает с floating и fixed point правильно....