home *** CD-ROM | disk | FTP | other *** search
- Program Margins;
- // p°φklad pou₧itφ runtime funkcφ t²kajφcφch se okraj∙
-
- const
- first = 1;
- next = 2;
- last = 3;
-
- var
- ok : boolean;
- l, r, t, b : real;
-
- procedure GetInitialMarg;
- begin
- l:=GetLeftMargin;
- r:=GetRightMargin;
- t:=GetTopMargin;
- b:=GetBottomMargin;
- end;
-
- procedure RestoreInitialMarg;
- begin
- SetLeftMargin(l);
- SetRightMargin(r);
- SetTopMargin(t);
- SetBottomMargin(b);
- end;
-
- procedure zobraz_margins(nadpis : short);
- var
- S, Sp : string[255];
- begin
-
- S:="";
- S:=S + "Left margin " + Real2Str(GetLeftMargin, -2) + #13#10;
- S:=S + "Right margin " + Real2Str(GetRightMargin, -2) + #13#10;
- S:=S + "Top margin " + Real2Str(GetTopMargin, -2) + #13#10;
- S:=S + "Bottom margin " + Real2Str(GetBottomMargin, -2);
-
- case nadpis of
- first : Sp:="PoΦßteΦnφ : ";
- next : Sp:="Zm∞na na";
- last : Sp:="Poslednφ zm∞na"
- end;
-
- Info_box(Sp, S);
- end;
-
- function rozpul_margins : boolean;
- var
- ok1, ok2, ok3, ok4 : boolean;
- begin
- ok1:=SetLeftMargin(GetLeftMargin/2);
- ok2:=SetRightMargin(GetRightMargin/2);
- ok3:=SetTopMargin(GetTopMargin/2);
- ok4:=SetBottomMargin(GetBottomMargin/2);
- rozpul_margins:= ok1 and ok2 and ok3 and ok4;
- end;
-
- begin
- GetInitialMarg;
- zobraz_margins(first);
- repeat
- ok:=rozpul_margins;
- zobraz_margins(ok ? next : last);
- until not ok;
-
- RestoreInitialMarg;
-
- if Yesno_box("", "Nastavit dialogem jinΘ hodnoty ?")
- then case SetMargins(TRUE, l+1, r+1, t+1, b+1) of
- IDOK : Info_box("", "Bylo IDOK");
- IDCANCEL : Info_box("", "Bylo IDCANCEL");
- end
- else case SetMargins(FALSE, l*2, r*2, t*2, b*2) of
- IDOK : Info_box("", "P∙vodni hodnoty "
- "byly zvojnßsobeny");
- IDERROR :Info_box("", "P∙vodni hodnoty "
- "nelze zvojnßsobit");
- end;
- end.