Petri Posted November 8, 2007 Share Posted November 8, 2007 (edited) Something odd here: --------------------------------------------------------- PROCEDURE CheckForSymbol; BEGIN ok := FALSE; theSymbol := GETOBJECT(PMARKER1); symName := GETSDNAME(theSymbol); IF theSymbol <> NIL THEN ok := TRUE ELSE ALRTDIALOG(CONCAT('No such symbol as ', symName)); END; BEGIN Initialise; MESSAGE(PUSESYMBOL); IF PUSESYMBOL THEN CheckForSymbol; IF ok THEN UseSymbol ELSE BEGIN --------------------------------------------------------- PUSESYMBOL is FALSE; nevertheless, the procedure CheckForSymbol is executed and the whole PIO fails. Am I blind once again? EDIT To clarify: this morning the construct was this: --------------------------------------------------------- PROCEDURE UseSymbol; BEGIN SYMBOL(PMARKER1, 0, 0, 0); END; BEGIN IF PUSESYMBOL THEN UseSymbol ELSE BEGIN Initialise; --------------------------------------------------------- That worked technically, but not for the user. The "Initialise" routine essentially contains --------------------------------------------------------- PROCEDURE Initialise; BEGIN ok := GETCUSTOMOBJECTINFO(myName, me, rHd, wHd); --------------------------------------------------------- and reading of parameters into variables. ("ok" is a temporary Boolean I use everywhere, many times in any script or PIO. Should not cause the problem.) Edited November 8, 2007 by Petri Quote Link to comment
ccroft Posted November 9, 2007 Share Posted November 9, 2007 Petri I looked at this for quite some time, and the only thing that I see that looks a bit off is PUSESYMBOL. If I wrote this I'd probably use a param name with a space so that it read nicely in OIP: "Use Symbol". What kind of havoc is wreaked in a PIO that has a parameter reference with an underscore missing I do not know....do you? I would think it'd be a "Identifier Not Declared" error, but maybe not. In any case, it's nice to know someone's paying attention don't you think? Charles Quote Link to comment
Petri Posted November 9, 2007 Author Share Posted November 9, 2007 Charles, I always have "alternative names" for parameters, so that I can recycle code and also change (or translate!) the user interface. In this case the parameter is called useSymbol, but shown as "K?yt? symbolia". Yes, it is indeed nice to know someone's paying attention. But this is truly baffling: how can a test for a Boolean fail this way? Quote Link to comment
Petri Posted November 9, 2007 Author Share Posted November 9, 2007 Another one. In an object script: ------------- ok := GETCUSTOMOBJECTINFO(myName, me, recHd, wallHd); IF me = LNEWOBJ THEN isNew := TRUE ELSE isNew := FALSE; ------------- Why isn't the newly-created object 'me' LNEWOBJ? After the above, isNew = FALSE. Or perhaps someone knows & reveals how to establish that the incidence of the PIO is a new object. If so, I'll donate an auto-numbering routine which this is supposed to be a part of. Quote Link to comment
Petri Posted November 9, 2007 Author Share Posted November 9, 2007 (edited) LOBJECT (instead on LNEWOBJ) seems to work, so I win the prize! OK - this was my mistake: I forgot that a PIO is a "layer". EDIT I'll donate it anyway: In the main program: ----------------- IF (autoNumber AND isNew) THEN GenerateSerialNo; ----------------- and the call is to ----------------- PROCEDURE GenerateSerialNo; BEGIN n := COUNT(R IN [myName]); theID := NUM2STR(0, n); END; ----------------- which of course should be a function... In addition, somewhere (like in the standard "Initialisation" -procedure) we need ----------------- ok := GETCUSTOMOBJECTINFO(myName, me, recHd, wallHd); IF me = LOBJECT THEN isNew := TRUE ELSE isNew := FALSE; autoNumber := PAUTONUMBER; { Boolean parameter } ----------------- not to forget ----------------- VAR n, ID : INTEGER; myName, theID : STRING; me : HANDLE; autoNumber, isNew : BOOLEAN; ----------------- Phew! Thanks to the trusty old VW 12, I'm making progress instead of playing games. Edited November 9, 2007 by Petri Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.