P
Patrick Tingen
Guest
Not meant offensive, but I find style and naming used in the example not so simple; why do you return an error and why is your procedure called 'WalkTheTree'. Surely it does something more than just walk the tree. Keep in mind that someone else will eventually read this code too. This person might be yourself in a few years. You should give as much clue as possible to the future reader to what this code is actually doing. Personally, I find something like the below more readable: FUNCTION getWindowType RETURNS CHARACTER (phWidget AS HANDLE): phWidget = phWidget:FIRST-CHILD. DO WHILE VALID-HANDLE(phWidget): IF phWidget:TYPE = "DIALOG-BOX" THEN RETURN "DIALOG-BOX". phWidget = phWidget:NEXT-SIBLING. END. RETURN "WINDOW". END FUNCTION. /* getWindowType */ Although one could argue that it would be even better to create an ENUM for window types and return that.
Continue reading...
Continue reading...