Thank you for your post.
I'm a little confused what you are trying to accomplish.
The Button Bar is designed for layout navigation, or works with Slide Control to mimic tab control, so the active button/segment will always show which layout or slide is in front.
Are you trying to deactivate the active button? That is, after the script runs, do you want the active button to return to an inactive state? If so, then use a calculation to point to the Button Bar when specifying the active segment. For example, in the Button Bar Setup, under "Active Segment", click "Specify...", and set the calculation to Random. Then, in your script, have the last statement "Refresh Object", and specify an object name for the Button Bar.
Is this what you want?
It has to do with the language, English is not my native language.
What happens is this:
I have a LayOut and above the layout there is a menu bar with 5 menu buttons. One button is the active button (for the LayOut the user is working on). The active button, for the LayOut the user is working on, has another view (color) and is set to active in settings. (The active button has no script, because the user is already on the appropriate LayOut). It is also possible to hide the active button automatically, but that makes it less transparant for my users. (Teachers, and they don't like ICT)
All works fine. But now the user is adding a new record, and accidentally (or not) pushes one of the other menu buttons. I have a script to prevent them to go to another LayOut when OpenRecordState = 1. Also works fine. But, once they pushed another button of the menu bar, this other button becomes the active button with another view (color). In my script I have an Exit script step and the user stays on the active LayOut until the adding job is finished or cancelled. Also works fine.
Only, the other button the user pushed accidentally, is becoming the active button. And I want the original active button to stay active until the user is really on another LayOut. (Otherwise it is getting very confusing for the users).
Perhaps this explanation helps.
(I included a picture of the menu).
PS. Yes, I want the active button is always the button for the LayOut the user is working on.
If I use a calculation to set the active button, it doesn't seem to work. If I use e.g. active button by calculation - Get (LayOutName) or Get (TabelName) - nothing seems to happen. Now the active button is set manually, but changes as soon a user clicks another button, even when I exit the scrip and force the user to stay on the LayOut.
Thank you for the explanation.
1. Create another text field that will be hidden from view. For now, name it "TEST" (you can rename it later), and temporarily place it on the layout.
2. In the Button Bar Setup, next to Active Segment:, click Specify... Here, you will enter a calculation: TEST
This means the Active Segment will become whatever is the content of the hidden field.
3. Go to Browse mode, and enter into TEST one of the names of the segments. For example "Leergroepen". Refresh the screen. You will see that "Leergroepen" is now the active segment/button.
Now, in your calculations, you can use Set Field ( TEST ; <value> ). That is, if the correct conditions are passed, then you can update TEST. In your example, if Get (RecordOpenState) = 1, then you will want to set TEST to the default value, and then Refresh Object <button bar name>.
Let me know if you need additional clarification.
Thanks for your clarification. I understand now how it works. I suspected it to behave totally different. In the calculation for the active segment, I assumed it would be based on the table name, the LayOut name or something else.
(Time for a manual in the Netherlands).
Thanks for your effort and time.