I have a Segmented Button with four buttons which has been working fine until I tried to edit it today.
Button Name: ProcessButtons
Button Titles Formula: AGILE CREDIT,DEPOSIT,MASTER FILE,SCS
Attached Procedure: call “.buttons”, which is in the same file
Data: fgCCButtonsCall
When I click a button, the procedure is called, the fgCCButtonsCall is correctly set to the clicked button title. But then disappears.
For testing I put at the top of the .buttons procedure the following:
alertok info(“trigger”)+": "+fgCCButtonsCall
which returned the expected >
ProcessButtons: [ value of fgButtonsCall]
There are several steps after this which I commented out one at a time until it reached the point it is supposed to evaluate info(“trigger”)
I added here
alertok info(“trigger”)+": "+fgCCButtonsCall
so effectively running the same formula twice in a row. But this time I got
ProcessButtons: [ blank]
what became of fgCCButtonsCall? Nothing has been done to reassign the value. If the alertok is changing something, shouldn’t it be the trigger value?
Commenting out both alerts above, the info(“trigger”) works correctly if I leave the other work I had commented out. Adding those back in one at a time I discover this to cause both the info(“trigger”) and the fgCCButtonsCall to return blank.
fgProgress="" showvariables fgProgress
fgProgress is a file global defined at .intialize and should have no effect on the info(“trigger”) or fgCCButtonsCall value.
What is fgProgress for? I assume it must be displayed in another object that also has code attached to it. Changing that variable is apparently triggering the code in another object, for example a list or matrix object. You have to watch out for circular loops where changing an object feeds back into another object.
fgProgress is for a text display object on the form that displays the progress of the procedure, for instance fgProgress=“Calculating Credit”, The only code attached is in Formula: catcherror("",fgProgress)
I use this technique in many forms and files, so far without any problems.
It’s not about a conflict between variables. If an object is tied to a variable, changing that variable and doing showvariables will trigger the code associated with that object, just as if you had clicked on that object. In the process, it will set info(“trigger”) to a new value.
If I write complex code that is triggered by an object, I’ll usually start by copying info(“trigger”) into a variable so that I don’t have to worry about it getting changed by something I do.