Basic Source Editor and Debugger

From Apache OpenOffice Wiki
< Documentation‎ | DevGuide
Revision as of 12:28, 18 January 2024 by DiGro (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Basic editor and debugger of the IDE window is shown when the user edits a Sub or Function from the Tools → Macros → Organize Macros → OpenOffice Basic dialog. In this mode, the window contains the actual editor main window, debugger Watch window to display variable values and the debugger Calls window to display the Basic call stack. The Watch and Calls windows are only used when a Basic program is running and halted by the debugger.

The editor supports common editor features. Since the editor is only used for the Apache OpenOffice Basic programming language, it supports a Basic syntax specific highlighting and  F1  help for Basic keywords.

Basic Editor and Debugger

The following list explains the functionality of the macro toolbar buttons.

Compile.png Compile: Compiles the active module and displays an error message, if necessary. This button is disabled if a Basic program is running. Always compile libraries before distributing them.
MacroRun.png Run: Executes the active module, starting with the first Sub in the module, before all modified modules of the active library are compiled. Clicking this button can also result in compiler errors before the program is started. This button resumes the execution if the program is halted by the debugger.
Stop.png Stop: Stops the Basic program execution. This button is disabled if a program is not running.
StepOver.png Procedure Step: Executes one Basic statement without stepping into Subs or Functions called in the statement. The execution is halted after the statement has been executed. If the Basic program not is running, the execution is started and halted at the first statement of the first Sub in the current module.
SingleStep.png Single Step: Executes one Basic statement. If the statement contains another Sub, execution is halted at the first statement of the called Sub. If no Subs or Functions are called in the statement, this button has the same functionality as the  Step over  button (key command  F8 ).
StepOut.png Step back: Steps out of the current executed Sub or Function and halts at the next statement of the caller Sub or Function. If the currently executed Sub or Function was not called by another Sub or Function or if the Basic program is not running, this button has the same effect as the  Run  button.
Breakpoint.png Breakpoint: Toggles a breakpoint at the current cursor line in the Basic editor. If a breakpoint can not be set at this line, a beep warns the user and the action is ignored (key command  F9 ). A breakpoint is displayed as a red dot in the left column of the editor window.
AddWatch.png Add watch: Adds the identifier currently touched by the cursor in the Basic editor to the watch window (key command  F7 ).
ObjectCatalog.png Object Catalog: Opens the Objects dialog. This dialog displays the complete library hierarchy including dialogs, modules and the Subs inside the modules.
Macros.png Macros: Opens the OpenOffice Basic Macros dialog.
Modules.png Modules: Opens the OpenOffice Basic Macro Organizer dialog
FindParentheses.png Find Parentheses: If the cursor in the Basic editor is placed before a parenthesis, the matching parenthesis is searched. If a matching parenthesis is found, the code between the two parentheses is selected, otherwise the user is warned by a beep.
Controls.png Controls: Opens the dialog editing tools in the dialog editor. In Basic editor mode, this button is disabled.
OpenBasicSource.png Insert Source File: Displays a file open dialog and inserts the selected text file (*.bas is the standard extension) at the current cursor position into the active module.
StoreBasicSource.png Save Source As: Displays a file Save As dialog to save the active module as a text file (*.bas is the standard extension).

Illustration 12.24: Basic Editor and Debugger shows how the IDE window looks while a Basic program is executed in debugging mode.

  • The  Stop  button is enabled.
  • A breakpoint is set in line 11.
  • The execution is halted in line 12. The current position is marked by a yellow arrow.
  • The Watch window contains the entries Value and Hello, and displays the current values of these variables. Values of variables can also be evaluated by touching a corresponding identifier in the source code with the cursor.
  • The Calls window shows the stack. The currently executed Sub doIt is displayed at the top and the Sub Main at the second position.
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages