Tuesday 8 July 2008

My coding practice vs. your practice

your program (n): a maze of non-sequiturs littered with clever-clever tricks and irrelevant comments. Compare MY PROGRAM.

my program (n): a gem of algorithmic precision, offering the most sublime balance between compact, efficient coding on the one hand, and fully commented legibility for posterity on the other. Compare YOUR PROGRAM.

Monday 7 July 2008

How to close a form after a certain timespan

Sometimes it would be really nice if a form closes automatically after a certain timespan. I found it particulary useful in ShopFloorControl, where end-users might not have a mouse to point to close on a form.

On the forms run:

public void run()
{
str JmgJobId;
// Define variable for timeout
// Created with new int on JmgParameters
int TimeOut = JmgParameters::find().JmgRegistredOnJobPromptTime;

// Check if there is a parm
if(element.args().parm())
{
JmgJobId = element.args().parm();
jobIdTxt.text(JmgJobId);
}

super();

// Close form after TimeOut
this.setTimeOut(identifierstr(close),TimeOut);
}