Vier D HomeArchivSeminareNachrichten - Twitter4D Expertise
Antworten auf Ihre Fragen •
Datenbank-Pflege •
4D Coaching •
OpenDDDD •
Termine •
4D Expert
V11/V12-Service • Konzepte •
Alternativen •
Meine Apps
Gebrauchtes Mac + iPhone: zu verkaufenFinden Geo-Themen + Projekte GoogleMap-Integration • GeoDDDD • Database Publishing • Database PhotographyVerschiedenes |
02 Jun 2006 This text was originally written while V2004 was the most current 4D-version. Keep every piece of code at one place only …
Starting with 4D it's fascinating to have code attached to a form, and code attached to formobjects, and to have code globaly to be called from forms and formobjects. StartFirst parameter is a text, which names what should be done. Therefore $what:=$1. No parameter means default-behaviour like from a menu-call or a click on the run-rutton. EnhancementCalling oneself without parameters is a process-starter. Is $what empty, the method will either start a new process or show the running process and bring it to the front. Processstart looks like recursiv (Current methode name) and passes as first parameter "StartProcess" which will get $what. Later it might look like this
Expanding only the frist level of a finished method looks like this: RecursionImportant: recursiv calls are part of the concept. "newMessage" e.g. is a service for different parts of the method. The service "newMessage" gets called in On Load: ConceptTrying to explain the concept with a graphic: there is only one projectmethod that contains everything, like start and end of a module, the formmethod including all formevents, button-actions and button en-/disable, every subservice specific for that module. ProcessvariablesA positive sideeffect is, that processvariables – we need them for the forms – only live in this one methode. They are declared, initialized, filled with values and finally cleared up in this method only. Other methods ask this module-method for the content of a variable. This saves work, debuggingtime and helps avoid memoryleaks. This way processvariables now are nearly as efficient as local variables: they only exist in this method and at the end of the process, 4D will remove them from memory for me. Later addedYou remember not having pointers to locals? Before V2004.2 we didn't have pointers to locals, so this kind of writing code was impoosible before. I love V12 for keeping the state of expanded/collapsed. The count of parameters is down to 3 most of the time. |