Visual Logic Free Edit Mode
Free Edit Mode is a feature in Simul8 Professional that allows the user to free-type directly into the Visual Logic window, rather than using a right-click wizard. To switch to a free-edit mode, open an existing section of Visual Logic (or open a New section and insert at least one line using the Visual Logic wizard). Then tick the ‘Free Edit Mode’ in your Visual Logic Editor window.
Free Edit mode features
There is additional functionality in Simul8 Professional that predicts the command, object name, distribution name, variable and label (etc) that is being typed. This can aid your syntax and help you with Object names in large simulations.
To access this functionality, make sure that the ‘free edit mode’ auto predictor under the Editor Options is not disabled.
The predictive functionality provides a list of options based on the characters that are being typed. The command that is closest to the characters that have been typed will be highlighted in yellow. To select the highlighted option hit the TAB key or double-click on the selection.
If the command highlighted is not the correct command, continue typing to refine the suggestions or select other items from the list provided by scrolling your mouse or using up and down arrows. Use double-click or TAB to insert your selected item.
Hovering the mouse over the command will cause a prompt to be provided to show the parameters that are required to complete the command. The user is required to enter the comma separators for VL commands that require the input of more than 1 parameter. Simul8 automatically populates the brackets and column/row prompts when a spreadsheet item is selected from the list.
Using the Free Edit mode
To complete the editing of a line, press the ENTER key. Simul8 keeps checking the syntax of your code as you type. While the syntax is incorrect, the whole line will be colored red. Once the syntax is correct, Simul8 will change the line color to blue (Note, that various Objects, such as variables and parameters might be colored differently). You will only be able to move to the next line when the current line is syntactically correct. The user must correct the line of visual logic or Delete Current Line using the right-click option before being able to do anything else.
Blank lines can be put between blocks of code that will not affect the execution of the code during the simulation. This can help in debugging and to also make the code easier to read.
Moving Lines of code
To move a line of code this can be done by clicking the line then holding the left mouse button and dragging. If CTRL is held while doing this, instead of moving the line it will instead copy the selected line to the new location.
If you find yourself dragging lines across by mistake, you might want to change your settings to require ALT to be pressed to drag lines. This can be done by right-clicking on the editor and un-ticking “Allow line move dragging without ALT” in the Editor Options. Moreover, there is a range of Visual Logic Editing options, you might want to consider when using the Free Edit mode.
Selecting multiple lines
To select multiple lines of code, click on the first line, then press SHIFT and click on the last line of the block to be copied and this will highlight all the lines in between as well.
If you are selecting lines at several different places, use CTRL, instead of SHIFT, as you click on each line you would like to select.
Making changes to a command
To edit a line of visual logic once it has been accepted, either use the free edit mode to make the changes, or to open the command dialog box double click on the line with the left mouse button.
Switching back to the Visual Logic Wizard mode
To return to the Visual Logic Wizard method, click the “Go to 'free edit mode'” button at the bottom right of the Visual Logic editor.