Getting Started
Introduction
Sample Programs
IDEs
History
Advice
Mini-Tutorial
Tutorials
Code Snippets

Resources
Web Sites
More Tutorials
Forums
Vendors/Tools
Books
Magazines
Newsletters
NewsGroups
User Groups
Talk Shows
Blogs

Controls
Overview
Button
Check3State
Checkbox
ComboBox
Frame
Graphic
Image
ImageX
ImgButton
ImgButtonX
Label
Line
ListBox
ListView
Option
Progress Bar
Scrollbar
StatusBar
TAB
TextBox
Toolbar
TreeView

GBIC >> PowerBASIC >> Tutorials >> IDE (Editor/Compiler)

PowerBASIC Information Center Tutorials
These tutorials were written to help you get a quick, but thorough, understanding of PowerBASIC - the scope of the language as well as it's specific capabilities.

Introduction       Projects       Language           Messages       Functions           Advanced
  • Overview
  • Examples
  • IDE
  • Compilation
  • Distribution
  • Project Files
  • DDT Windows
  • Controls
  • Menus
  • Dialogs  
  • Help Files
  • Resources  
  • Templates  
  • Project Shell  
  • Syntax
  • Operators
  • Data Types
  • Variables
  • Scope
  • Declarations  
  • Procedures
  • Flow Control
  • Windows
  • Messages
  • Callbacks
  • Mouse
  • Keyboard
  • Dialogs
  • Controls
  • Subclassing
  • Arithmetic
  • Trig  
  • Strings
  • Arrays
  • Date/Time
  • Printing
  • Files
  • Folders
  • Keyboard
  • Mouse
  • Sound
  • System
  • Error Traps
  • Debugging
  • Objects
  • Graphics
  • Databases
  • API
  • DLLs
  • ASM
  • Threads
  • PowerBASIC IDE
    When you start PowerBASIC, you'll see the following single window. The PowerBASIC IDE does not display the windows of the application being created - it shows only the source code for the application.

    A separate tool, PowerBASIC Forms, is available which does provide a visual rendition of an applications windows (similar to the Visual Basic IDE).

    This window is the PowerBASIC IDE - Integrated Development Environment. It consists of a combination source code text editor that is integrated with the PowerBASIC compiler. The editor creates/modifies source code and the compiler converts the code into an executable (EXE) file or a dynamic link library(DLL).

    The 4 lines of code you see in the editor are a template for a basic EXE application, provided by default when PowerBASIC is opened. Other templates are available, including one for DLLs. You saw this code as part of the sample applications in an earlier page of this tutorial.

    The IDE consists of four sections.

    • Menu

    • Toolbar

    • Source Code Editor

    • Watch Window

    Each of these is discuss in more detal below.

    File Menu
    This is where programs are loaded and/or saved.

    • Insert File
      Insert a document (file) at the caret position in the current document.
    • New File
      Create a new empty document in the editor.
    • New File As…
      Create a new empty document in the editor, using a specified file template.
    • Open File…
      Use the Open dialog box to load an existing document.
    • Save File
      Save the current document using its current name.
    • Save File As…
      Save the current document using a new name.
    • Print…
      Print the current document.
    • Close File
      Close the current document.
    • Close All Files
      Closes all files open in the editor.
    • [Recent Files list]
      A list of the most recently loaded source code documents.
    • Command Prompt
      Open a command prompt window ("DOS box").
    • Exit
      Close all open documents and exit the IDE.

    Edit Menu
    This menu provides various features for making changes to the source code.

    • Undo
      Undo the last action.
    • Clear
      Delete the selection.
    • Cut
      Remove selection and place in clipboard.
    • Copy
      Copy selection to clipboard.
    • Paste
      Copy text from clipboard to the cursor location.
    • Select All
      Select all text.
    • Block selection…
      Take action on every selected line - comment/uncomment, indent/unindent (by tab or space).
    • Insert GUID
      Inserts a new unique GUID.
    • Find
      Search for specified text.
    • Find Next
      Search for next occurence of specified text.
    • Replace
      Replace specified text.
    • Go to Line
      Move caret to specified line number.
    • Go to Bookmark
      Move caret to a bookmark.
    • Code Finder
      Display all Subs/Functions/Methods/Properties/Macros. Jump to selection.

    Run Menu
    Use these menus to create EXEs or DLLs.

    • Compile
      Compile source code (either the current documents or the Primary Source File).
    • Compile and Execute
      Compile (as above) and then run (if EXE is result).
    • Compile and Debug
      Compile (as above) and then Debug
    • Set Primary Source File
      If multiple files are loaded in the IDE, each may have a PBMAIN() function, so the file whose PBMAIN() will be used to start the program can be selected.
    • Command Line
      Allows command-line access from within IDE (normally is a run time parameter)

    Tools Menu
    The COM browser is the only automatic entry here. An entry also appears for PowerBASIC Forms is that application is installed.

    • PowerBASIC COM Browser
      Open the PowerBASIC COM Browser (PBROW.EXE) to generate COM interface code from Object libraries.

    • PowerBASIC Forms
      Provides access to PowerBASIC Forms (if installed).

    Window Menu
    These are standard Windows MDI application submenus, plus the Options submenu.

    • Cascade
      Stack and overlap (with offset) all open windows.
    • Tile Horizontal
      Arrange open windows left to right (no overlap).
    • Tile Vertical
      Arrange open windows top to bottom (no overlap).
    • Options
      Display the PowerBASIC IDE Options dialog.
    • Current Files List
      A list of files currently opened in the PowerBASIC IDE.

    Debug Menu
    PowerBASIC provides a complete set of tools with which to identify execution/logic errors within the source code. Programs can be walked through line by line and variables watched for value changes. Several settings are available to automate or otherwise make the process simple for the programmer to use.

    • Run
      Edit mode: compile and debug the current source document/Primary Source File
      Debug mode: runs program until it hits a breakpoint or ends.
    • Run to Caret CTRL+F8
      Run the program until reaching the current line or a breakpoint.
    • Animate
      Run program one line at a time (Step-Into) until a breakpoint is reached, the Stop button is pressed, or the program completes. Step-to-step delay time can set.
    • Stop CTRL+BREAK
      Halt the debugger (if running).
    • Step Into F8
      Debugger follows all code lines, including into Sub/Function/Method/Property code. Cannot step into an API call, or into an external module.
    • Step Over SHIFT+F8
      Debugger executes, but does not display Sub/Function/Method/Property code.
    • Step Out CTRL+SHIFT+F8
      Debugger stops after executing the current Sub/Function/Method/Property procedure.
    • Evaluate Variable
      Using the Watch window, evaluate/modify/add/remove a variable. Cannot change the length of a string.
    • Clear all Watches
      Remove all variables from the Watch window.
    • Toggle Breakpoint F9
      Set/release breakpoint (current line).
    • Clear all Breakpoints
      Release all breakpoints.
    • Watch CPU Registers
      Show/hide Register Watcher window (displays state of CPU registers and flags when debugging).
    • Variable watch window
      Show/hide Variable Watcher window (displays state of ERR function and selected variables).
    • Program Restart SHIFT+F5
      If the current program is halted/stopped, the program will be reset, ready for debugging to commence again.
    • Exit Debugging
      Halts the current program and terminates the debugger. The variable list in the Watch window is retained between debugging sessions, until the IDE is closed.

    Help Menu
    PowerBASIC offers standard Help menu options, providing both local and web-based help. The context help feature is especially useful, where the Help file is opened to the entry corresponding to the keyword at the location of the cursor in the source code editor.

    Additionally, users can access SDK help and custom help files which have been installed as part of a third-party vendor's add-on tool installation process.

    • Dynamic Help
      Displays the help file with information about the closest word to the edit caret.
    • PB/Win Contents
      Displays help file table of contents.
    • PB/Win Index
      Displays help files index.
    • PB/Win Search
      Displays help files search tab.
    • Help for Windows SDK
      Display the Win32.hlp help file (if installed).
    • [other help files]
      Display an add-on help file.
    • PowerBASIC Web Site
      Open default Web Browser to the PowerBASIC web site.
    • About CCEdit
      Display version information.

    Context Menu
    The following context menu (right mouse click) is available from within the PowerBASIC IDE.

    Here is a short description of what each of these submenu items provide.

    • Undo
      Reverse the most recent edit change from the undo stack. Multiple undos are supported. The undo stack is cleared when a Save or Compile operation is performed.
    • Clear
      Delete selected text.
    • Cut
      Delete the selected text and copy it to the clipboard.
    • Copy
      Copy selected text to clipboard.
    • Paste
      Paste the contents of the clipboard at the caret position.
    • Select Line
      Select (highlight) the complete line at the context-menu point.
    • Select Block
      Select (highlight) a complete block of code. Available only when activated on the first line of a formal block (#PBFORMS metastatement (PB/Win only), FOR/NEXT, SELECT CASE, CALLBACK, CLASS, SUB, FUNCTION, METHOD, PROPERTY, TYPE, UNION).
    • Insert GUID
      Inserts a new unique GUID at the current insertion point.
    • Select All
      Select all text.
    • Run to Caret
      Run the program until reaching the current caret position (debug mode only).
    • Watch Variable
      Add/remove the variable at the current caret position to the Variable Watcher window. The Variable Watcher window is visible only in debug mode.
    • Evaluate Variable
      Evaluate or modify the variable at the current caret position (debug mode only).
    • Toggle Bookmark
      Add/remove a bookmark at the current caret position.
    • Toggle Breakpoint
      Add/remove a breakpoint at the current caret position.
    • Help
      If the word at the caret is recognized, then the PowerBASIC Help file is launched. Otherwise, the WIN32.HLP file is launched.
    • Open File
      Opens file specified in a #INCLUDE metastatement.

    Hot Keys
    Like most Windows applications, PowerBASIC provides keyboard options for accessing the various features that are normally accessed using the mouse. The supported Hot Keys include:

      KeystrokeDescription
      F1 Dynamic Help
      CTRL+ALT+F1 Display the Help Table of Contents
      CTRL+ALT+F2 Display the Help Index
      CTRL+ALT+F3 Display the Help Search
      F2 Code Finder dialog
      F3 Find dialog/Find next
      SHIFT+F3 Find previous
      F4 Duplicate current line
      CTRL+F4 Close current document
      ALT+F4 Exit PBEDIT
      F5 Compile/debug (edit mode) or Run (debug mode)
      CTRL+F5 Animate program.
      F6 Clear to end-of-line
      CTRL+F6 Switch to the next document window
      F8 Step into next program line (when debugging)
      CTRL+SHIFT+F8 Step out of current procedure (when debugging)
      SHIFT+F8 Step over next program line (when debugging)
      CTRL+F8 Run to caret (when debugging)
      F9 Break (stop the program being debugged)
      ALT+BACKSPACE Undo
      SHIFT+INSERT Paste text from clipboard
      SHIFT+DELETE Cut text to clipboard
      CTRL+DELETE Cut text to clipboard
      CTRL+INSERT Copy text to clipboard
      CTRL+HOME Move to start of document
      CTRL+END Move to end of document
      CTRL+PAGEUP Move to start of document (keep caret onscreen)
      CTRL+PAGEDOWN     Move to end of document (keep caret onscreen)
      CTRL+0 Go to bookmark 0
      ALT+0 Set bookmark 0
      CTRL+1 Go to bookmark 1
      ALT+1 Set bookmark 1
      CTRL+2 Go to bookmark 2
      ALT+2 Set bookmark 2
      CTRL+3 Go to bookmark 3
      ALT+3 Set bookmark 3
      CTRL+4 Go to bookmark 4
      ALT+4 Set bookmark 4
      CTRL+5 Go to bookmark 5
      ALT+5 Set bookmark 5
      CTRL+6 Go to bookmark 6
      ALT+6 Set bookmark 6
      CTRL+7 Go to bookmark 7
      ALT+7 Set bookmark 7
      CTRL+8 Go to bookmark 8
      ALT+8 Set bookmark 8
      CTRL+9 Go to bookmark 9
      ALT+9 Set bookmark 9
      TAB Indent marked block by one tab level
      SHIFT+TAB Outdent marked block by one tab level
      SPACE Indent marked block by one space
      SHIFT+SPACE Outdent marked block by one space
      CTRL+A Select all
      CTRL+B Go to Bookmark dialog
      CTRL+C Copy text to clipboard
      CTRL+D Duplicate current line
      CTRL+E Build and Execute
      CTRL+F Find dialog
      CTRL+G Go to Line dialog
      CTRL+I Toggle auto-indent mode
      CTRL+K Clear to end-of-line
      CTRL+L Select current line
      CTRL+M Compile (document or primary source file)
      CTRL+N Create new document (default file template)
      CTRL+O Open an existing document
      CTRL+P Print the current source document
      CTRL+Q Comment-out marked block
      CTRL+SHIFT+Q Uncomment-out marked block
      CTRL+R Find and Replace dialog
      CTRL+S Save the current document
      CTRL+T Delete the word at the caret
      CTRL+U Paste text from clipboard
      CTRL+V Paste text from clipboard
      CTRL+X Cut text to clipboard
      CTRL+Y Cut current line to clipboard
      CTRL+Z Undo last change
      CTRL+ALT+G Insert a GUID

    If you have any suggestions or corrections, please let me know.