English (en) suomi (fi)

The Lazarus main menu contains the following entries:

 File   Edit   Search   View   Source   Project   Run   Package   Tools   Window   Help

As usual, the options can be selected either by placing the mouse cursor over the menu option and clicking the left mouse button, or by typing Alt+F on the keyboard (provided the main menu window has focus: if it has not, hit Tab repeatedly to cycle focus through the various windows until the desired window has its title bar highlighted in colour).

File

• New Unit: Creates a new Unit file (Pascal Source).
• New Form: Creates a new Form: both the visual on-screen window and the associated Pascal source file.
• New ...: Offers a pop-up menu box with a variety of new document types to create.
• Open: Offers a pop-up Dialog Box to enable you to navigate the filesystem and choose an existing file to open.
• Revert: Abandon editing changes and restore the file to its original state.
• Open Recent: Offers a list of recently edited files, and an opportunity to select one.
• Save: Save the current file, using its original filename. If there is no name, the system will prompt for one (just like Save As).
• Save As: Allows you to choose a directory and filename for saving the current file.
• Save All: Saves all the files attached to the editor, not just the current one selected.
• Export As HTML: Export the contents of the current file to a new file in HTML format.
• Close: Closes the current file, prompting whether to save all editor changes.
• Close all editor files: Close all files currently open in the editor. Prompt for saving changes.
• Clean directory: Offers a dialog with a series of editable filters for removing files from the current directory. Useful for removing .bak files and remnants of former Delphi projects.
• Print: Uses the system printer to print the selected file. This menu item may not appear by default if you are not using Windows; you will then need to install $Lazdir/components/printers/design/printers4lazide.pas and re-compile the IDE • Restart: Re-start Lazarus - useful if files have got hopelessly scrambled! • Quit: Exit Lazarus, after prompting for saving all edited files. Edit • Undo: Undo the last edit action, leaving the Editor in the state just before the last action. • Redo: Re-instates the last action that was reversed by Undo. • Cut: Remove the selected text or other item and place it on the Clipboard. • Copy: Make a copy of the selected text, leaving the original in place, and placing the copy on the Clipboard. • Paste: Places the contents of the Clipboard at the cursor position. If text has been selected at the cursor position, the contents of the Clipboard will replace the selected text. • Select: Allows selection of blocks of text. Options include select all, select to brace, select paragraph or line etc. • Indent Selection: Move the selected text to the right by the amount specified in Environment -> Editor options -> General -> Block indent. This feature is useful for formatting your Pascal source code to show the underlying Block structure. • Unindent selection: Removes one level of indenting, moving the text to the left by the amount specified in Block indent. • Uppercase Selection: Convert selected text to uppercase. • Lowercase Selection: Convert selected text to lowercase. • Swap Case in Selection: Convert selected text to lowercase or uppercase. • Sort selection: Sort lines (or words or paragraphs) alphabetically; options for ascending or descending order, case sensitive or insensitive. In the middle of program source code, of course, it makes no sense, but if you have a list you need to have sorted this will do the trick. • Tabs to Spaces in Selection: Converts any tabs in the selected text to the number of spaces specified by Environment -> Editor options -> General -> Tab widths. The number of spaces is not a fixed quantity, but is the number needed to fill the remaining width of the tab. • Break Lines in Selection: If any lines in the selected text are longer than 80 characters or the number specified in Environment -> Editor options -> Display -> Right Margin, then the line is broken at a word boundary and continued on the next line. • Insert from Character Map: Allows insertion of non-keyboard symbols such as accented characters, picked from a pop-up character map. Search • Find: Similar to the facility in almost all graphic text editors: a pop-up dialog box appears allowing entry of a search text string, with options such as case sensitivity, whole words, origin, scope and direction of search. • Find Next, Find Previous: Search again for the previously entered text string, in the specified direction. • Find in Files: Search for text string in files: pop-up dialog with options all open files, all files in Project, or all directories; masks available for selecting file types. • Replace: Similar to Find; shows pop-up dialog with place to enter search text string and replacement text, and options for case sensitivity, direction etc. • Incremental Find: Search for the string while you are entering the search string. Example: after you choose "Incremental Find" if you press "l" the first "l" will be highlighted. If then you press "a", the editor will find the next "la" and so on. • Goto Line: Move editing cursor to specified line in file. • Jump Back: Jump to previous position. Everytime jumping to an error or find declaration the IDE saves the current source position. With this function you can jump back in the history. • Jump Forward: Jump to next position. Undoes a Jump back. • Add Jump Point to History: Add the current source position to the jump hsitory. • Jump to Next Error, Jump to Previous Error: Jump to the positions in the source file of the next or previous reported error. • Set a Free Bookmark: mark the current line where the cursor is located with the next available (free) numbered bookmark, and add this to the list of bookmarks. Note that a pop-up menu (obtained by right-clicking with the mouse on the appropriate line of the source file) gives a larger range of Bookmark options, allowing the number of a bookmark to be specified, or allowing the user to jump to a numbered bookmark, not just the next or previous ones. • Jump to Next Bookmark, Jump to Previous Bookmark: Jump to next or previous bookmark in the numerical sequence. • Find Other End of Code Block: If positioned on a begin, finds the corresponding end or vice versa. • Find Code Block Start: Moves to the begin of the procedure or function in which the cursor is placed. • Find Declaration at Cursor: Finds the place at which the selected identifier is declared. This may be in the same file or another file already open in the Editor; if the file is not open, it will be opened (so if a procedure or function is declared, for example, in classesh.inc , this will be opened in the Editor). (More) • Open Filename at Cursor: Opens the file whose name is selected at the cursor. Useful for looking at Include files or the files containing other Units used in the project. • Goto Include Directive: If the cursor is positioned in a file which is Included in another file, goes to the place in the other file that called the Include file. • Find Identifier References: Produces a list of all the lines in the current file, or the current project or all attached files, in which an identifier is mentioned. • Procedure List: Produces a list of all Procedures and Functions in the current file, with the line numbers where they are defined. View Controls the display of various windows and panels on the screen. • Object Inspector: The window that usually occupies the left side of the Desktop, and displays the features of the Form which is on the desktop. Clicking with the mouse on any component of the form will cause the details of that component to be displayed in the Object Inspector. There is a panel at the top which shows the tree-structure of the current project, and the components of the form may optionally be selected in this panel: this will also cause the corresponding details to be displayed in the Object Inspector. The main lower panel has two tabs which allow selection of either Properties or Events to be displayed. Selection of Properties causes features such as name, color, caption, font, size etc to be displayed: there are two columns, the left showing the property, and the right showing the value associated with that property. Selection of Events displays two columns: the left lists the possible events such as MouseClick or KeyDown associated with that component, and the right shows the action that results from that event. If there is no action defined, then clicking in the appropriate box or on the ... button causes the Source Editor to be displayed, with the cursor already positioned in a dummy Procedure declaration, waiting for event-defining code to be typed in. • Source Editor: The main window in which source code is edited. Its behaviour is very like that of most other graphical text editors, so that the mouse can move the cursor over the displayed text, and clicking with the left mouse button while dragging the mouse will select and highlight text. Right clicking with the mouse displays a pop-up menu, it includes the usual Edit Cut, Copy or Paste functions, Find Declaration and Open File at Cursor. The top of the Source Editor window has a number of tabs, corresponding to the files that are open for the current project; clicking on any tab makes that file visible, and you can move easily from file to file, copying and pasting between files and performing most of the normal editing functions. The Source Editor performs color syntax highlighting on the code, with different colors for punctuation marks, comments, string constants etc. It will also maintain the level of indentation from line to line as you type in code, until you change the indentation. The function and appearance of the Source Editor are very configurable from the Main Menu by selecting Environment -> Editor options and then selecting one of several tabs in the pop-up dialog box. • Code Explorer: A window usually placed on the right of the Desktop which displays, in tree form, the structure of the code in the current unit or program. It usually opens with just the Unit name and branches for Interface and Implementation sections, but clicking on the + box to the left of any branch will open up its sub-branches or twigs, in more and more detail until individual constants, types and variables are displayed as well as procedure and function declarations. If you change the file displayed in the main Source Editor window, you need to click on the Refresh button of the Code Explorer to display the structure of the new file. • Units...: Opens a pop-up dialog window with a list of the unit files in the current project.Clicking with the mouse on a filename selects that file; click on Open to display that file in the Source Editor. Checking the Multi box allows several files to be selected simultaneously, and they will all be opened in the Source Editor (but only one at a time will be displayed). This Menu Option is rather like the Project -> Project Inspector option, but only displays the list of Unit files and allows them to be opened. • Forms...: Opens a pop-up dialog window with a list of the Forms in the current project, and allows the selection of one or more of them for display. • View Unit Dependencies: Opens a pop-up dialog window that shows, in a tree-like manner, the structure of dependencies of the currently open unit file. Most of the files listed as dependencies will have their own + boxes, which allow the dependencies of the individual files to be explored, often in a highly recursive manner. • Toggle form / unit view F12: Toggles whether the Source Editor or the current Form is placed on the top layer of the Desktop, and given focus. If the Source Editor has focus, then you can edit the source code; if the Form is given focus, you can manipulate the components on the desktop and edit the appearance of the Form. The easiest way to toggle the display between Editor and Form is to use the F12 key on the keyboard, but the same effect is achieved by selecting this option on the Main Menu. • Messages: A window that displays compiler messages, showing the progress of a successful compilation or listing the errors found. • Search Results: A window that displays the results of find in files. • Debug windows: Opens a pop-up menu with several options for operating and configuring the Debugger. See below where the debugger is described. Source • Comment Selection: Comment out the currently selected text. • Uncomment Selection: Uncomment the currently selected text. • Toggle Comment in Selection: Comment out or uncomment the currently selected text. • Enclose Selection...: Enclose the currently selected text with a statement such as Try...Finally. • Enclose in$IFDEF...: Enclose the currently selected text with an IFDEF (conditional defines) statement.
• Complete Code:
• Add Unit to Uses Section: Add one or more Units to the uses section in the current file.
• Refactoring: Open the Refactoring sub-menu.
• Quick Syntax Check: Run a quick syntax check.
• Guess Enclosed Block: Let the editor end the enclosed block, such as a missing "End" in an "If" statement.
• Guess Misplaced IFDEF/ENDIF: Let the editor correct a misplaced conditional defines statement.
• Insert CVS Keyword...: Insert a CVS keyword, such as "Author" or "Date".
• Insert General: Insert a general value, such as a "GPL Statement".
• Insert Full Filename...: Insert the filename.
• Insert ToDo: Insert a ToDo comment.
• Unit Information...: Display information about the current unit.
• Unit Dependencies...: Display the dependencies for the current unit.
• JEDI Code Format: View the JEDI Code Format options for the project.

Project

• New Project: Create a new project. A pop-up dialog window appears offering a choice of types of project to create.
• New Project from File: A Navigation dialog window appears, alowing selection of a file from which to create a new project.
• Open Project Open a project which has already been created and saved. A navigation dialog appears with a list of Lazarus Project Information (.lpi) files from which a project may be chosen.
• Open Recent Project: Displays a pop-up list of recent projects on which you have been working, and allows selection of one of these.
• Close Project Close the current project.
• Save Project: Similar to File -> Save: all the files of the current project are saved; if they have not previously been saved, there is a prompt for filename(s)- similar to Save Project As...
• Save Project As...: Prompts for filename to save project. A default filename of Project1.lpi is offered, but you should choose your own filename. Lazarus will not permit you to use the same name for the Project file and the Unit File (see below).
• Publish Project: Creates a copy of the whole project. If you want to send someone just the sources and compiler settings of your code, this function is your friend. A normal project directory contains a lot of information. Most of it is not needed to be published: the .lpi file contains session information (like caret position and bookmarks of closed units) and the project directory contains a lot of .ppu, .o files and the executable. To create a lpi file with only the base information and only the sources, along with all sub directories use "Publish Project". In the dialog you can setup the exclude and include filter, and with the command after you can compress the output into one archive. See Lazarus IDE Tools
• Project Inspector: Opens a pop-up dialog with a tree-like display of the files in the current project. Allows you to add, remove or open selected files, or change options of the project.
• Project Options...: Opens a pop-up dialog window with tabs for setting options for Application (Title, Output Target file name), Forms (allowing you to select among the available forms, make them Auto-create at start of application) and Info (specifying whether editor information should be saved for closed files, or only for project files).
• Compiler options ...: (Recently moved here from the Run Menu). Opens a multi-page tabbed window which allows configuration of the compiler. Tabs include Paths which allows definition of search paths for units, include files, libraries etc, as well as allowing choice of widget type for the forms (gtk, gnome, win32); Parsing which allows choice of rules for parsing source programs, Code which allows choice of optimisation for faster or smaller programs, choice of target processor, types of checks, heap size etc; Linking allowing choice of whether or how to use debugging, static or dynamic libraries, and whether to pass options through to the linker; Messages to define what type of messages should be generated during error conditions; Other which allows decision to use default configuration file (fpc.cfg) or some other file; Inherited which shows a tree structure diagram to indicate how options have been inherited from units already incorporated; Compilation which allows definition of commands to be executed before or after the compiler is launched and can allow use of Make files.
• Add Editor File to Project: Add the file currently being edited to the Project
• Remove from Project: Gives a pop-up menu of files available for removal from project.
• Units...: View a list of all the units in the project.
• Forms...: View a list of all the forms in the project.
• View Project Source: No matter which file you are editing, takes you back to the main program file (.lpr)or the main .pas file if there is no .lpr.

Run

• Compile: Compiles all the files in the project.
• Build: Builds all files in the project.
• Quick Compile: Compiles the files in the project that have changed.
• Clean up Build Files: Cleans up the build files in the project.
• Abort build: Stop the build process once it is running - either you have remembered that you did something silly and want to stop the build, or the system seems to be taking far too long and something is obviously wrong.
• Run: This is the usual way to launch the compiler and, if compilation is successful, to start execution of the application. What actually happens is that Lazarus saves a copy of your files, then starts the compiler and linker, then begins execution of the final linked binary program.
• Pause: Suspend execution of the currently running program. This may allow you to inspect any output that has been generated; execution may be resumed by selecting Run again.
• Show Execution Point: Shows the current execution point.
• Step Into: Used in conjunction with the debugger, causes execution of the program one step at a time up to a bookmarked point in the source.
• Step Over: Causes stepwise execution up to the statement marked, then skips the marked statement, and continues execution at normal speed. Useful in trying to isolate a statement that introduces a logical error.
• Step Out: Step out of the current code block.
• Run to cursor: Causes execution at normal speed (ie NOT one statement at a time) until either the statement is reached where the cursor is located or the current procedure is exited; then stops. Does not stop, if location is reached during recursion. Resume execution at normal speed by selecting Run.
• Stop: Cease execution of the running program. Cannot be resumed by selecting Run; this will start the program again from the beginning (re-compiling if necessary).
• Run Parameters: Opens a multi-page pop-up window which allows command-line options and parameters to be passed to the program to be executed; allows selection of display to run program (eg a remote X terminal may be used in Linux); some system Environment variables may be overridden.
One very important use of this sub-menu is to activate a terminal window in which conventional Pascal console input/output is displayed. If you are developing a console-mode Pascal program (ie one that doesn't use the Graphical User Interface with its forms, buttons and boxes) then you should check the box for "Use launching application". The first time you do this and try the Compile/Run sequence, you will probably get a rude message to say
"xterm: Can't execvp /usr/share/lazarus//tools/runwait.sh: Permission denied".

If this happens, you need to change the permissions on the appropriate file (for example using chmod +x filename, or using the Windows utility for changing permissions); you might have to do this as root. After this, each time you launch you program, a console box will appear and all your text i/o (readln, writeln etc) will appear in it.
After your program has finished execution, a message "Press enter" appears on the screen. Thus any output your program generated will remain on the screen until you have had a chance to read it; after you press 'enter' the console window closes.
Note: as for the current version, there is no prepared console command for Windows users. Until the Lazarus team adressess that, the following line should work (on WinXP -- someone please update for other Windows versions).
C:\Windows\system32\cmd.exe /C \${TargetCmdLine}

See the separate tutorial on Console Mode Pascal programming.
• Reset debugger: Restores the debugger to its original state, so that breakpoints and values of variables etc are forgotten.
• Build file: Compile (build) just the file that is currently open in the Editor.
• Run file: Compile, link and execute just the currently open file.
• Configure Build + Run File: Opens a multi-page tabbed window with options to allow for build of just this file when Build Project is selected, allows selection of the working directory, the use of various Macros, etc. Then Builds and Runs the file.
These last three options enable you to open (and maintain) a test project. Use File -> Open to open an .lpr file, pressing cancel on the next dialog to open this file as "normal source" file.
• Inspect...: Inspect a value when the program is paused.
• Evaluate/Modify...: Evaluate or modify an expression or value when the program is paused.
• Add Breakpoint...: Add a breakpoint, which will will pause execution of the program at that line of code.

Package

• New Package...: Create a new package.
• Open Loaded Package...: Open one of the files in the selected package.
• Open Package File (.lpk)...: Displays a list of installed packages, with an invitation to open one or more of them, or to select various general or compiler options.
• Open Package of Current Unit: Open the package for the unit currently in the editor.
• Open Recent Package: Open a package that was opened recently.
• Add Active File to Package...: Place the file (currently in the editor) into a package.
• New Component: Create a new component.
• Package Graph: Displays a showing the relationships of the packages currently being used (if you aren't using any other packages, the Lazarus package and the FCL and LCL will be displayed).
• Install/Uninstall Packages...: Install or uninstall one or more packages.

Tools

• Options...: View and changed the options and settings in the Lazarus IDE.
• Re-scan FPC Source directory Looks through the directory again. Lazarus uses the fpc sources to generate correct event handlers and while looking for declarations. If somebody changes the directory in the environment options, then this directory is rescanned, to make sure Lazarus uses the version stored in that location. But if this directory has changed without Lazarus noticing, then you may get some errors when designing forms or doing "Find declaration". If you get such an error, you can do two things:
1. Check the FPC source directory setting in the environment option.
2. Re-scan FPC source directory.
• Code Templates...: View the code templates that are available.
• CodeTools Defines Editor...: Edit the code templates.
• Project templates options...: Set the options for the project templates.
• Configure external tools: Allows the user to add various external tools (usually macros) to the toolkit
• Example Projects...: View the example projects that are available.
• Diff: Allows comparison between two files (or, usually, two versions of the same file) to find differences. Options to ignore white space at beginning or end of lines or differences in line termination: CR+LF versus LF). Useful for checking if there have been changes since last CVS update etc.
• Leak View: View the heap trace output.
• Check LFM File in Editor: Allows inspection of the LFM file which contains the settings that describe the current form
• Convert Delphi Unit to Lazarus Unit: Helps in porting Delphi applications to Lazarus; makes the necessary changes to the source file. See Lazarus For Delphi Users and Code Conversion Guide.
• Convert Delphi Project to Lazarus Project: For porting from Delphi to Lazarus: converts a Delphi project to Lazarus.
• Convert Delphi Package to Lazarus Package: For porting from Delphi to Lazarus: converts a Delphi package to Lazarus.
• Convert DFM file to LFM: For porting from Delphi to Lazarus: converts the Form Description files from Delphi to Lazarus.
• Convert Encoding of Projects/Packages...:
• Build Lazarus with Profile: Normal IDE: Launches a re-build of Lazarus from the most recently downloaded or updated SVN files. Hit the button and sit back to watch it happen! (track the process on your Messages window).
• Configure "Build Lazarus": Allows the user to determine which parts of Lazarus should be re-built, and how. For example, you could select to have just the LCL re-built, or to have everything except the examples built; you can select which LCL interface to use (ie which set of widgets), and you can select the target operating system and specify a different target directory.

Window

Contains a list of the currently opened files and the available windows such as Source Editor, Object Inspector and Project Inspector. Clicking on the name of one of the windows brings it to the foreground and gives it focus.

Help

At present this has three selections:

• Online Help which at present opens a browser window that contains a picture of the running cheetah and a few links to the Lazarus, Free Pascal and Wiki websites
• Reporting a bug opens the wiki page, which describe the bug reporting procedure
• About Lazarus Displays a pop-up box with some information about Lazarus.

Help can be configured with [Tools|Options|Help]