One fine day (well, it was raining – it is the UK after all), not too long ago (yesterday), there was a man called Mr Numpty (names changed to protect the innocent). Mr Numpty was a seasoned Synergy developer and wrote Toolkit applications in his sleep (amazing what Workbench can do for you these days).
This one day, Mr Numpty was browsing the spc.synergex.com web site for the early bird registration form when suddenly his big red support phone rang. It has a unique ring tone and a strange light appears in the sky, which can be easily seen on the lovely grey storm clouds forming outside his window. Mr Numpty says to himself “this must be very important” and reaches for his cloak. Picking up the phone, a rather bemused voice, which he recognises immediately as his uncle, ‘Uncle Joe’, says;
“Numpty my man, things they be strange. My list is looking great, but my data’s in a rage.”
“Is it the new product browser?” asks Mr Numpty.
Uncle Joe replied;
“It is indeed, that’s the one. ‘Been using it all day, ‘cos it’s so much fun. The windows are great, and the tabs are a hit. But when I print, the results are not that great!”
“OK Uncle Joe I’ll take a look” replied Mr Numpty. He looked through the code but could not see any errors. He ran the program, and clicked on the tab. Uncle Joe was right. The list looked great with all the right data. Printing from here worked also and the results were fine. Confused, Mr Numpty pondered and scratched his head. He scratched so hard his hair stood on its end. From the corner of his eye he caught sight of himself in the mirror. Wow he thought. My head looks funny. I must be fully charged with static!
Ping! Suddenly he remembered a dim and distant UI Toolkit training course, and the voice of a PSG consultant began to haunt him… “Remember the golden rule: The list processor first updates the current non-window data area, processes the request, then returns the current non-window data!” So something must be corrupting my non-window data, but only sometimes.
Taking a closer look at his list routine he noticed his problem. The data being passed to the list processor was defined as ‘stack’. This means that each time the routine is called the data area is created, and the contents undefined. Calling the routine for the first time creates the list, which is correctly loaded from the load method. By clicking on other tabs means we leave the list routine. Clicking back on the tab containing the list causes the list record area, defined as stack data, to be created with the contents undefined. When this is then passed to the list processor the non-window data will be updated with this undefined data. Visually, everything will look fine, but the data used by the program will be corrupted.
Taking inspiration from his static hair style, Mr Numpty changes the record declaration to ‘static’ and his program now fully works. He updates Uncle Joe’s computer.
“Numpty my man, it all looks swell. Now can we filter and sort the columns as well?”
Mr Numpty thought for a moment, “I’m not sure how to do that, but it sounds like a great idea. Now where was I?” Mr Numpty continues to complete the spc.synergex.com early bird application form, wondering if this year’s conference will give him the knowledge to give his uncle the features he wants.