Buttons on Spreadsheets
Buttons can be added to Internal Spreadsheets and used to trigger a defined section of Visual Logic.
To add a button, click the ‘Button’ icon under the ‘Insert’ tab. You can then drag to move or resize the button, as required.
Double click on the button to customize it. You can change the size, the positioning, the fill and line colors and the button name. The name can be edited under the ‘Text’ tab. The name is displayed on the button and is also used to link the required section of Visual Logic.
You must then right-click the button and select ‘Enable’. The button is now ready to use. If you wish to edit the button, you can right-click again and select ‘Disable’
Next, we need to link the Visual Logic. If a button is enabled, when you click the button, Simul8 obeys the On Button Click Visual Logic. When a button is clicked Simul8 automatically places the name of the button clicked into the Special Global Data Item "Button" This allows you to create Visual Logic to respond as required to each button click, as in the image below.
When the button is clicked, the spreadsheet is closed before the Visual Logic is obeyed. The spreadsheet can be reopened with the Set Main Sheet and Display Main Sheet Visual Logic commands.