Topic: Calling Common Code

Greetings,

As it seems Pascal & MVD is pretty much totally event driven ... (OnShow, OnClick, OnEnter, etc) and having the code for each event, what if you have a common calculation that has to be preformed many times, but you do not want to code into each event but would rather have is appear in Script.pas one time for maintenance purposes...  how do you call if from each of the events to the common subroutine... can some provide a simple example of how two events can call the same single instance of a subroutine.

Thanx,
Keith

Re: Calling Common Code

Hi Keith,
You can create your own procedures and simply call that procedure from any other.
Have a look at the example (used in another project) where the focussed field is highlighted by a different colour and as you move from one field to another, all the colours for all the fields need to be reset.
Derek.

Post's attachments

Attachment icon keith.zip 335.73 kb, 241 downloads since 2020-12-18 

Re: Calling Common Code

OK, I see....

Thanx,
Keith