Customizing Browses

Description

Browses and forms are layouts you use to enter, edit, and view data. You can customize browses and forms to make data entry easier, to improve readability, and create calculated fields. In this lesson, you learn how to design and use custom browses. You will learn how to create and use forms in the next lesson.

Alpha Anywhere Layouts 

Layouts are the primary means by which you enter, view, and output data in Alpha Anywhere. Alpha Anywhere has five types of layouts: Forms, Browses, Reports, Letters, and Labels. In this tutorial lesson, you work with browses. Each type of layout has its own Design Editor that you access in Design Mode. In Design Mode, you create and arrange the layout contents. Design Mode lets you construct layouts to display database information. You switch from Design Mode to View Mode. View Mode lets you view and work with the database information, using the layouts you created in Design Mode.

Creating Layouts 

When creating a new layout, you can copy the design of an existing layout, create one from scratch, or edit the Default Browse or Default Form. Use the following general procedure for creating new layouts. To create a new layout:

  1. In the Control Panel, click the Forms or Browses tab, corresponding to the type of layout you want to create.

  2. Click the New button in the Control Panel. Alpha Anywhere opens a Genie to guide you through creating the new layout.

To copy an existing layout:

  1. In the Control Panel, right-click the layout you want to copy.

  2. From the right-click menu, select Duplicate. Alpha Anywhere prompts you to name the new copy.

  3. Give the layout a name, and click OK to save.

Switching between Design Mode and View Mode 

To switch to Design Mode: While working in a layout, click the Design Mode button on the toolbar.

  • In the Control Panel, select the layout, and click the button .

    images/Design_Mode_button.gif
  • In the Control Panel, right-click the layout, and select Design from the right-click menu.

images/Design_Mode_button.gif

To switch from Design Mode to View Mode:

  • While in the Form Designer, click the Form View button.

    images/Form_View_Button.gif
  • While in the Browse Designer, click the Browse View button.

    images/Browse_View_button.gif

In the following procedures, you look at the Browses in AlphaSports, and create a custom browse for AlphaMovies.

Working with Browses 

A browse displays table and set data as a single table. You can view this tabular display using the Default Browse or a custom browse that you define. While viewing a browse, you can modify resize and move columns. However, appearance modifications remain only as long as the browse window is open; once you close the browse window, Alpha Anywhere restores the default settings. However, you can create and save custom browses in which you rearrange, and reformat columns. A custom browse retains its saved settings when re-displayed.

Looking at AlphaSports Browses 

AlphaSports has four saved browses. Use the following procedure to view the records in each browse. To view an AlphaSports custom browse:

  1. Open the AlphaSports database.

  2. In the Control Panel display the Browses tab.

  3. Double-click a browse to view the records.

Compare the Customer table Default Browse to the CustomerBrowse. You see that the CustomerBrowse presents a subset of the table data, useful for quick access to customer contact information. In the following procedure, you create a browse with some special features for AlphaMovies.

Creating a New Browse 

When creating a new browse, you can either copy the design of an existing Browse or create one from scratch. In the following procedure, you use the New Browse Genie to create a browse for AlphaMovies.

You should have already created the AlphaMovies database in the Creating a Database lesson.

To create a new browse:

  1. Open the AlphaMovies Control Panel.

  2. Click the Browses tab, and click the New button. The New Browse window appears.

    images/browseNew.gif
  3. Select the "Inventory" table, and click Next. The New Browse window displays the fields in the selected table.

    images/New_Browse_Commented.gif
  4. From the Available Fields pane, you select fields to include in the new browse. You can select the fields one at a time, or all at once, using the navigation buttons located between the windows.

    • Add a single field to Fields in Browse.

      images/Move_Right_Button.gif
    • Add all fields to Fields in Browse.

      images/Move_Last_Button_2.gif
    • Remove a single field from Fields in Browse.

      images/Move_Left_Button.gif
    • Remove all fields from Fields in Browse.

      images/Move_First_Button_3.gif
  5. Select the following Available Fields: "Tape_ID", "Title", "Availability", and "Sales_Price".

    images/New_Browse_Fields_Commented.gif
  6. Use the arrows in the right-hand column to reposition the fields, and set the browse field order.

    • Move selected field to the top of Fields in Browse.

      images/Move_First_button.gif
    • Move selected field up one position in Fields in Browse.

      images/Move_Up_Button.gif
    • Move selected field down one position in Fields in Browse.

      images/Move_Down_Button.gif
    • Move selected field to the bottom of Fields in Browse.

      images/Move_Last_button.gif
  7. Click Next. The New Browse dialog box appears from which you can select to apply a stylesheet to the browse.

    images/browseNew4.gif
  8. Preview some of the stylesheet choices by selecting them in the Stylesheet list.

  9. Keep the Alpha Anywhere default stylesheet, and click Next.

  10. In the next dialog box, you may view the Xbasic code for the browse by clicking Show Xbasic.

  11. Click Finish. The Browse Editor displays the selected field objects.

    images/browseNew7.gif
  12. Click the 'save' button on the toolbar. The Save Browse Layout as Dialog box appears.

  13. Enter the name "StockInfo" and click OK. Alpha Anywhere saves the StockInfo Browse.

  14. Close the Browse Editor and open the AlphaMovies Control Panel. The StockInfo Browse appears on the Browses tab.

    images/browseNew9.gif

In the next procedure, you modify the StockInfo Browse.

Modifying a Browse 

You can modify custom browses by adding and removing fields, reformatting columns, and creating custom column headings. When Alpha Anywhere displays a browse in Design Mode, the following Browse Design Toolbar appears.

images/Browse_Design_Toolbar.GIF

Buttons: 

  • Display table records in Browse view.

    images/Browse_View_button.gif
  • Create a new Browse.

    images/New_Query_button.gif
  • Open an existing Browse.

    images/Folder_button.gif
  • Save the Browse layout.

    images/Save_button.gif
  • Print Browse data.

    images/Print_button.gif
  • Preview Browse data.

    images/Preview_Form_button.gif
  • Define print settings; for example, printer, # of copies, and page orientation.

    images/Print_Properties_button.gif
  • Delete the selected column.

    images/Delete_button.gif
  • Define column or Browse properties, such as setting the filter and order expression.

    images/Properties_button.gif
  • Define Browse or object events.

    images/Event_button.gif
  • Display DragDrop List window for inserting additional objects on the Browse.

    images/Drag_and_Drop_List_button.gif
  • Toggle Text Toolbar on and off.

    images/Toggle_text_button.gif
  • Toggle Border Toolbar on and off

    images/Toggle_border_button.gif
  • Toggle Copy Format Toolbar on and off

    images/Toggle_copy_format_button.gif
  • Create or modify calculated fields

    images/Calc_Fields_button.gif
  • Create or modify variables.

    images/Variables_button.gif
  • Display the Control Panel.

    images/Control_Panel_button.gif

In the next procedure, you modify the appearance of StockInfo. To modify a Browse:

  1. Select the StockInfo browse in the Control Panel, and click the Design button. The Browse Editor appears, as does the Browse Design toolbar.

  2. Select the Tape_ID column by clicking its title. Alpha Anywhere highlights the entire column.

  3. Click the Properties button on the toolbar, or press F12. The Column Properties dialog box appears.

    • You can also customize the Browse column display using the Font, Border, and Format tabs of the Column Properties dialog box.

    images/Properties_button.gif
    images/columnProperties.gif
  4. Select the Setup tab, and enter "ID" in the Column title field.

  5. Select the Border tab, select "Green White" in the Fill section, Foreground color.

  6. Click OK. The Tape_ID column displays a new name and color.

  7. In the StockInfo Browse, right-click the Availability column title, and select Properties from the right-click menu.

  8. The Column Properties dialog box appears.

  9. In the next steps, you specify a font color change, when certain conditions are met. For example, you set the text color to red when a tape is not available.

  10. Select the Other tab, select Enable Color Equation, and click the Expression button.

  11. The Color Equation Genie appears.

    images/colorEquationGenie.gif
  12. Select "Red" for the Text Color, and click the 'xy' button.

    images/colorEquationGenieExpress.gif
  13. Enter Inventory -> Availability = .F. in the Expression Builder, by doing the following:

    • 1. Click the Insert button.

    • 2. Select "Availability".

    • 3. Select the = (equals sign) button in the Expression Builder.

    • 4. Select the .F. button in the Expression Builder.

    • 5. Click OK.

  14. Click OK to close the Expression Builder.

  15. Click OK to close the Properties dialog box.

The StockInfo Browse displays a red letter F, for films that are not available. These steps show how customizing a Browse can provide useful information about your data at a glance. Additionally, you can make the following Browse modifications:

  • Use the Browse menu to add and delete columns.

  • Use the Stylesheets menu to format the Browse.

  • Transfer formatting of one column to another, using the Copy Appearance command on the right-click menu.

Creating a Calculated Value 

Alpha Anywhere gives you the ability to build simple and complex calculations based on fields in the underlying table. These calculations, called calculated values, can display table data in many ways. Click the Calculated Values 'xy' button on the toolbar. The Define Calculated Values window appears.

  1. Click the F10 - Expression Builder button. The Expression Builder appears.

  2. In the Expression Builder, enter "QTY_TO_ORDER = IF(".

  3. Press F2 - Fields. The fields of the Product table appear.

  4. Select "Quantity_In_Sto" and click Insert.

  5. Complete the expression shown in the picture below. If you are unsure of a field name, you can retrieve it by pressing F2 - Fields.

    images/GS_Define_Calculated_Fields.gif
  6. On the next line create a second calculated field named Total. The expression is Total = Cost * Qty_In_Sto .

  7. Click OK when you are finished.

  8. The Product List Browse appears. You do not see the calculated field in the Browse. To see the calculated field, you must include it as a column in a browse.

In the next procedure, you add a column using the Drag-and-Drop List window.

Using the Drag-and-Drop List Window 

The Drag-and-Drop List window, includes all fields such as table, calculated, and system, that you can add to a layout. To add a field to the Browse using the Drag-and-Drop List window, click and drag the field to the desired location in the browse. To use the Drag-and-Drop List window:

  1. With the Product List Browse in Design Mode, click the DragDrop List button on the toolbar. The Drag-and-Drop List window appears.

    images/DragDropList.gif
  2. In the Drag-and-Drop List window, select the Total field, and drag it next to the Qty column, in the Product List Browse.

    • In the Drag-and-Drop List window, a check mark appears next to the Total field, indicating that it was added to the Browse.

    images/ProductListBrowse.gif
  3. In the Product List Browse, select the Total column, and select Properties from the right-click menu.

  4. In the Column Properties dialog box, select the Format tab.

  5. Select Right alignment, Width "10", Decimal Places "2", and Format Style "$123,456.78", and click OK.

    • The formatted Total column appears in Product List Browse.

      images/ProductListBrowse2.gif
    images/ColumnPropsTotal.gif
  6. Click the Save button on the toolbar.

  7. Click the Browse View button.

  8. Change the quantity of the first item, ABC Baseball Glove Conditioner, to 200, and press Enter. The Total changes to $470.00.

Summary 

In this lesson, you learned how to design and use a custom browse. You learned how to use the New Browse Genie to select fields for a new browse, and to modify the browse appearance. You also learned how to set column properties, and to create and include calculated fields in a browse.

See Also