# Managing Projects and Modules

When you use App Builder to create a graphical user interface, you are working on a project, which is comprised of one or more modules. App Builder, which was built with itself, was a single project comprising over 30 modules.

ABUG.proj.mkr.3
ABUG.proj.mkr.6
ABUG.proj.mkr.8

## Creating, Opening, and Saving Projects

A project file is started when you choose New Project from the File menu of the App Builder primary window or New from the Project menu of the Project Organizer, or when you drag and drop a window onto the workspace in a new session of App Builder. See ABUG.apWDB.mkr.7 for a description of the Project Organizer. See ABUG.layo.mkr.2 for a discussion of drag and drop procedures.

A project file is saved when you choose Save Project from the File menu of the App Builder primary window or when you select Save from the Project menu of the Project Organizer. A project file has a `.bip` (builder interface project) suffix.

### To Create a New Project

1. Choose New Project from the File menu of the App Builder primary window or New from the Project menu of the Project Organizer.

   The Project Name dialog box will be displayed. By default, an unnamed project is called `Untitled`.

   If you have made changes to the current project since you last saved it, a message dialog box will be displayed first, giving you the option to discard the changes and create the new project or to cancel the New Project operation.

   Click Discard Changes to throw out the changes and close the current project.

   Click Cancel if you want to save the current project. Save the current project before creating the new project.

2. Type a name (all lowercase) for the project and click Apply.

   The name of the project (with `.bip` added as a suffix) will be displayed in the title bar at the top of the App Builder primary window. Every module you create or import will be part of the current project until you open another project.

Project names should be all lowercase so that there is no conflict between the name of the project resource file and the project executable file. `
`The name of the resource file created when you generate code is the same as the name of the project, minus the `.bip` suffix, but it is given an initial capital letter. `
`

### To Open an Existing Project

1. Choose Open Project from the File menu of the App Builder primary window or Open from the Project menu of the Project Organizer.

   The Open Project dialog box will be displayed.

   If you have made changes to the current project since you last saved it, a message dialog box will be displayed first, giving you the option to discard the changes and open the other project or to cancel the Open Project operation.

   Click Discard Changes to throw out the changes and close the current project.

   Click Cancel if you want to save the current project. Save the current project before opening the other project.

2. Change folders, if necessary.

   You have to press Return or click Update before the folder change is registered.

3. Double-click the appropriate project file (`.bip` suffix) in the Files list

   Or, select the file and click Open.

   The name of the project will be displayed in the title bar of the App Builder primary window and the selected project will be displayed in the Project Organizer.

4. In the module array of the Project Organizer, select the modules you want to display and choose Show from the Module menu to display the module interfaces.

   See ABUG.proj.mkr.9 for detailed instructions.

### To Save a Project

A project is only saved when you explicitly choose to save it, so be sure to save often and regularly.

1. Choose Save Project from the File menu of the App Builder primary window or Save from the Project menu of the Project Organizer.

   If you have saved the project before, the project will be saved without comment.

   If this is the first time you have saved the project, the Save Project dialog box will be displayed.

2. Change to the appropriate folder.

   You will normally want a separate folder for each project you work on. You are apt to have Makefile problems otherwise.

3. Type a file name in the Enter file name field.

   You do not have to append `.bip` to the project name; this is done automatically when you save a project.

4. Click Save.

   The project will be saved.

### To Save a Version of a Project

Do the following to save a version of the current project in a different folder. You might want to do this so that you can compare two versions of a project or put the two versions out for review. If you have made unsaved changes to the current project those changes will be saved in the new project only.

1. Choose Save Project As from the File menu of the App Builder primary window or Save As from the Project menu of the Project Organizer.

   The Save Project dialog box will be displayed, with the current project name in the Enter file name field.

2. Change to another folder.

3. Type a name in the Enter file name field.

4. Click Save.

   The project—the project file (`.bip` suffix) and all of the module files (`.bil` suffixes)—has been copied to another folder. The original project and module files are not affected. The new project will now be the current project; its name will be displayed in the title bar of the App Builder primary window.

### To Rename a Project

Do the following to give the current project a different name. The modules that comprise the current project will become part of a new project with a new name and the current project will no longer exist. See ABUG.proj.mkr.5 above if you want to save a version of the the current project.

1. Choose Save Project As from the File menu of the App Builder primary window or Save As from the Project menu of the Project Organizer.

   The Save Project dialog box will be displayed, with the current project name in the Enter file name field.

2. Modify the name or type in a new name in the Enter file name field.

3. Click Save.

   A message dialog box will be displayed for each module in the project, telling you that the module exists and giving you the option to overwrite it or cancel the operation.

4. Click Overwrite for each module if you want to rename the project and save the module.

   Click Cancel if you do not want to rename the project and overwrite the current module.

   If you click Overwrite for each of the modules the project will be renamed; the new project name will be displayed in the title bar of the App Builder primary window. The old project file (`.bip` suffix) will still be in the folder, but it will not be the active project file. If you generate code for the project and run `make` in the folder, the new project name will be used.

### To Save a Project to a File (Encapsulate Project)

A project is comprised of one or more modules. Normally a project file is saved in a file with a `.bip` suffix, and each module file is saved in a separate file with a `.bil` suffix. To save a project as a single file (for convenience in mailing the project to someone, for instance):

1. Open the project, as described in ABUG.proj.mkr.4.

2. Choose Save Project As from the File menu of the App Builder primary window or Save As from the Project menu of the Project Organizer.

3. Change to the appropriate folder, if necessary.

4. Select Save As Encapsulated Project.

   The name of the current project will be displayed in the Enter file name field, with a `.bix` (builder interface exchange) suffix.

5. Click Save or press Return.

When a project is saved as an encapsulated file, the `.bip` file is not affected. When an encapsulated project is opened in App Builder, it is opened just like any other project. When you attempt to save a project that was opened from an encapsulated file, a message dialog box will be displayed, explaining that the project will be saved as individual files. Choose Save Project As if you want to save it as an encapsulated project again.

### To Close a Project

1. Choose Close Project from the File menu of the App Builder primary window or Close from the Project menu of the Project Organizer.

   If you have made changes since saving the project a message dialog box will be displayed, giving you the chance to discard the changes or to cancel the close operation.

## Creating, Importing, Exporting, and Saving Modules

A module is a logical unit of a project. Each window and dialog in App Builder is a module of the App Builder project, for instance. A module is created when you choose New Module from the File menu of the App Builder primary window or New from the Module menu of the Project Organizer.

You do not have to create a new module for each window, but in most cases you will want to: this will make maintaining modules simpler and will allow you to use a module for various applications.

All module files in a project are saved when the project is saved. You can explicitly save a particular module by choosing Save from the Module menu of the Project Organizer. A saved module file has a `.bil` (builder interface language) suffix.

### To Create a New Module

Do the following to create a new module, which will become part of the current project.

1. Choose New Module from the File menu of the App Builder primary window or New from the Module menu of the Project Organizer.

   The Module Name dialog box will be displayed, with Untitled selected as the default name:

   If you drag and drop a window on the workspace after creating a new project, the Module Name dialog box will be displayed, just as if you had chosen New Module from the File menu.

2. In the dialog box, type in the name you want to give the new module.

3. Click Apply or press Return.

   The name of the new module will appear in the Editing Module field at the bottom of the App Builder primary window. Any windows you drag from the Windows palette and drop on the workspace will be part of the new module.

### To Import a Module into a Project

To import an existing module into the current project:

1. Choose Import Module from the File menu of the App Builder primary window or Import from the Module menu of the Project Organizer.

   The Import File dialog box will be displayed.

2. Change to the folder where the module (`.bil` suffix) file is saved.

3. Change the Import Format type, if necessary.

   By default, BIL format is selected. If the file you are importing is a UIL file, click the UIL button. The file will be converted to BIL format when it is imported.

4. Change Import By method, if necessary.

   By default, Import By Copy is selected. If you want to import the module by reference rather than making a copy of it, click the Reference button.

   Import By Reference, which causes module files to be shared, can be dangerous, since the actual module file may be changed or deleted inadvertantly.

5. Double-click on the module to be imported in the Files list.

   Or, select the file and click Import.

   The module will be added to the current project the next time you save the project.

### To Save a Module

All modules in a project are saved when you save the project. If you want to save individual modules, you can do so in the Project Organizer.

1. Display the Project Organizer by choosing Project Organizer from the File menu of the App Builder primary window.

2. In the module array of the Project Organizer select the module you want to save.

3. Choose Save from the Module menu.

   If you have saved the module previously during this App Builder session, the module will be saved without comment.

   If this is the first time you have saved the module, the Save BIL File dialog box will be displayed, with the name of the selected module (with a `.bil` suffix) in the Enter file name field.

4. Change to the folder where you want to save the module, if necessary.

5. Click Save or press Return.

### To Rename a Module

Use Save As from the Module menu of the Project Organizer to rename a module. When you save the current project, the new module name will replace the old name in the project (`.bip`) file. The original module will still be in the project folder, but it will not be part of the project. To save a module without affecting the project, see ABUG.proj.mkr.7.

1. Display the Project Organizer by choosing Project Organizer from the File menu of the App Builder primary window.

2. Select the module you want to rename.

3. Choose Save As from the Module menu.

   The Save BIL File dialog box will be displayed, with the name of the selected module (with a `.bil` suffix) in the Enter file name field.

4. Type a file name in the Enter file name field.

5. Click Save or press Return.

   The new module name will replace the old name in the project (`.bip`) file the next time you save the project.

### To Export a Module

Do the following to save a copy of a module in the current project. The current project is not affected when you export a module. A new module is created, which is not part of the current project; the original module remains as part of the project.

1. From the File menu of the App Builder primary window choose Export Module and select one of the currently open modules from the submenu displayed.

   Or, in the Project Organizer select the module to be exported in the module array and choose Export from the Module menu.

   The Export File dialog box will be displayed, with the selected module name in the Enter file name field.

2. Type a new file name in the Enter file name field

   Or, change to the folder where you want to save the module and type a file name in the Enter file name field.

   If you want to save a version of the module in the current folder, do not change folders. Simply give the module a different name.

3. Click Export or press Return.

   A copy of the selected module has been created.

### To Save a Module in UIL Format

To save a module in UIL (user interface language) format instead of BIL (builder interface language) format:

1. Choose Export Module from the File menu of the App Builder primary window and select the module you want to export from the submenu that is displayed.

   Or, in the Project Organizer select the module to be exported and choose Export from the Module menu.

   The Export File dialog box will be displayed, with the selected module name in the Enter file name field.

2. Change to the folder where you want to save the module, if necessary.

3. Select Save As UIL (above the Enter file name field).

   The file name suffix will change from `.bil` to `.uil`.

4. Type a file name in the Enter file name field, if necessary.

   If the name in the Enter file name field is OK, leave it as it is.

5. Click Export or press Return.

   The file will be saved with a `.uil` suffix.

## Showing, Hiding, and Removing Modules

For a small project you may always want to show all modules. For a large project with many modules you may want to show only one or two modules at a time. Use the Project Organizer to show and hide modules, and to remove modules from projects. The Project Organizer displays icons for all of the modules that comprise a project. In the Project Organizer you can display or hide the interfaces for selected modules and you can remove modules from a project.

### To Show a Hidden Module

1. Display the Project Organizer by choosing Project Organizer from the File menu of the App Builder primary window.

2. Double-click the module icons in the module array of the Project Organizer that you want to show.

   Or, select the module icons and choose Show from the Module menu.

   The user interfaces for the selected modules will be displayed.

If a module you want to show is in a different project, you will first have to open the other project. See ABUG.proj.mkr.4 for instructions.

### To Hide a Shown Module

To hide a module that is displayed (to clean up the workspace so that you can more easily work on another module, for instance):

1. Display the Project Organizer by choosing Project Organizer from the File menu of the App Builder primary window.

2. Select the modules in the module array that you want to hide.

   Select one module by clicking mouse button 1 on it. To add to the selection click mouse button 2 on other modules. To select a number of adjacent modules drag-select with mouse button 1 or mouse button 2, starting above and to the left of the first module to be selected.

3. Choose Hide from the Module menu.

   The user interfaces for the selected modules will be hidden.

### To Remove a Module from a Project

When you remove a module from the current project, the module file will still exist in the project folder, but it will no longer be part of the project. The module file name will be removed from the project file (`.bip` suffix) the next time the project is saved. With the appropriate project open, do the following to remove one or more modules from the project.

1. Display the Project Organizer by choosing Project Organizer from the File menu of the App Builder primary window.

2. Select the modules in the module array that you want to remove.

3. Choose Remove from the Module menu of the Project Organizer.