Please enable JavaScript to view this site.

R:BASE 11 Beginners Tutorial

Navigation: Lesson 4 - Data Entry Forms

Defining a Pop-Up Menu

Scroll Prev Top Next More

A pop-up menu is similar to a combo box in that users select the data from a list. There are four types of pop-up menus:

 

Single column - a pop-menu displaying a list of values taken from a single column in a table

 

Multiple column - a pop-menu displaying a list of values from multiple columns in a table. You can display many columns, but only one column's value is returned to the field. This column does not have to be displayed.

 

Expression - a pop-up menu displaying a list of values from an expression. You can use this type of pop-up, for example, when entering a person's full name; use an expression that combines data from a first name column and last name column to list full names. The value displayed on the menu is returned to the field.

 

Expression with a column - a pop-up menu displaying a list of values from an expression, but returning a value from a column to the field

 

Because Charlie and Amelia only have seven employees, it often easier to just type in the employee number. The pop-up menu is optional. We will also define a look-up variable to display the employee's last name on the form.

 

To define a pop-up menu for EmployeeID:

 

1.In the "Form Designer" window, click on the existing EmployeeID DB Edit object to select it.
2.Right click on it and select "Object Property".
3.Across the top of the "DB Edit Properties" dialog, choose the "Pop-up Menus" tab.
4.Check "User can Access a Pop-up Menu".

 

Another option in the dialog box "Use a Custom Pop-up" is now activated.

 

5.Check "Use a Custom Pop-up".

 

The other options in the dialog are now activated.

 

6.Enable the options for "Automatic Pop-up" and "Skip to Next After".

 

By enabling these options, the pop-up will display automatically and then the cursor will jump to the next field once the selection is made.

 

7.Select "Employee" in "Table/View Name" drop down box.

 

You will notice that all of the tables and views are available to define the Pop-up menu.

 

8.Select "Multi Column" in "Pop-up Type".

 

The "Select Column(s)" menu is displayed listing the columns in the Employee table.

 

9.Using the arrows to move your selection from one panel to the other select EmployeeFirstName move it the right side, then select EmployeeLastName and move it to the right side.

 

DBEdit_PopupMenu

 

 

10.Click the OK button.

 

The column names are displayed in "Menu Values".

 

11.Select "EmployeeID" within "Column Returned".

 

The value that is selected from the EmployeeID column in the Employee table will be returned to the EmployeeID column in the Flights table. The relationship between the tables Employee and Flights is directly related to the primary and foreign keys that were defined on the EmployeeID columns in each table. Remember, EmployeeID is a primary key in the Employee table and a foreign key in the Flights table.

 

12.Enter "Employee List" in "Menu Caption".
13.Increase the "Number of Lines" field to 10 to display more employees, and to make room if more employees are hired later.

 

To define a hint for the EmployeeID object:

 

1.Select the "Properties" tab.
2.Enter "Press [Shift]+[F3] for Menu" in the "Hint" field, and verify the "Show Hint" attribute is checked.
3.Press the OK button.

 

Next, we'll define a look-up variable to display the employee's last name on the form. Then, we'll place the variable. A look-up expression is used to retrieve data from another table and display the data on a form.

 

To define a look-up expression:

 

1.In the "Form Designer" window on the menu bar, choose Variables: Add/Edit Variables.

 

R:BASE displays the "Expression Builder" dialog box in which you can enter the expression.

 

2.In "Define Expression," enter "vEmployeeLastName" in the "Name:" field.
3.In "Type," select the "TEXT" data type.
4.In "Define Expression," enter "EmployeeLastName IN Employee WHERE EmployeeID = EmployeeID" in the "Expression:" panel.
5.Click the Add button.

 

The variable is added and the expression is displayed in "Variables"

 

6.Click the OK button.

 

 

When the form is run, the look-up expression will find the employee's last name from the Employee table that matches the EmployeeID value we enter. We can enter the EmployeeID value by selecting it from the pop-up menu or by entering it directly into the field.

 

To place the vEmployeeLastName variable on the form:

 

1.In the "Form Designer" window, choose the "Variable Edit" button from the "Variable Controls" toolbar.
2.Position the cursor immediately to the right of the EmployeeID column object and click the left mouse button.

 

R:BASE displays the "Variable Edit Properties" dialog box. The R:BASE system variables and form variables are listed in the "Variable" drop down box.

 

3.Select the variable "vEmployeeLastName".
4.Click the OK button.