Wow. I just came across a form method with 4 local procedures - where one of them had yet another local procedure that contained three new local procedures. Oh lord... A total of 400 LOC!
Wow. I just came across a form method with 4 local procedures - where one of them had yet another local procedure that contained three new local procedures. Oh lord... A total of 400 LOC!
Any higher...?
procedure Form1.MyMethod;
procedure proc1
procedure proc2
procedure proc3
procedure proc4
procedure proc4.1
procedure proc4.1.a
procedure proc4.1.b
procedure proc4.1.b
begin
end;
Any higher...?
procedure Form1.MyMethod;
procedure proc1
procedure proc2
procedure proc3
procedure proc4
procedure proc4.1
procedure proc4.1.a
procedure proc4.1.b
procedure proc4.1.b
begin
end;
No. you won :-)
ReplyDeleteI guess it is modularization, of sorts :P
ReplyDeleteWell. MyMethod is the entry point of the form. The real name of the method is "ShowModal" in Norwegian. (The last line of this method actually calls the TForm's ShowModal).
ReplyDeleteThe first lines of the method builds the form runtime, and the local procedures (proc1-4) adds various components to the form. Real names are AddCheckbox, AddLabel, AddButton, AddEdit.
Now, for the edit components there are in some cases created a dropdown menu next to the edit field. This is done in "proc4.1", which naturally needs three new methods to create the components involved in dropdown-menu...
Oh, btw. The modal-result of this modal dialog is passed to the main form like this:
procedure TEIER_frmProfil.btnOKClick(Sender: TObject);
begin
//Removed 220 LOC for the case of simplicity...
KTR_frmMain.Valg := 'OK';
Close;
end;
procedure TEIER_frmProfil.btnCancelClick(Sender: TObject);
begin
KTR_frmMain.Valg := 'Cancel';
Close;
end;
Where "Valg" is a public string variable in the main form...
Very neat!
#facepalm
ReplyDeleteGood luck with that :)
ReplyDelete