How Do I Create a Menu Button in a Column?

This Lesson presents how to create a column containing a menu button in a datagrid, using the Data Grid Helper Plugin.

Opening Columns Builder

Opening Columns Builder

First, drag a datagrid onto a stack and double click on it to open the Data Grid Helper (DGH) Properties Palette.

Click the "Edit..." button to open Columns Builder.

Building Columns in the Columns Builder Preview

Building Columns in the Columns Builder Preview

Click the (+) button and add three columns.

Name the last column "Menu".

Button Creation Using Classic Objects and Column Content

Button Creation Using Classic Objects and Column Content

Open the Classic Objects, Columns Builder Properties topic (1)

Double click on the "Checkbox" header (2)  to open the Column Content (3)

Next, drag the Option Menu image from the Column Builder Properties and drop it in the Column Content Area (4)

Update Columns Builder Preview

Update Columns Builder Preview

Click the Update button to refresh the Column Builder Preview content (1).

A field named "_ColumnData_" will also be automatically added in the Column Content.

We have no need of that field in this lesson. Remove it by selecting it's name in the Object List of the Column Content Area (2), after the field is selected in the Column Content, on your keyboard, press the Delete or suppr key.

Editing Menu Button Properties

Editing Menu Button Properties

Double clicking on the Menu Button in the Column Content, will open the Properties Inspector.

Enter a name for the menu. Example: myFirstMenu

Input a list of possible values for this menu.

Example:

  • Menu 1
  • Menu 2
  • Menu 3

Using DGH To Build The Required Script

Using DGH To Build The Required Script

DGH can now  build the required script for managing this menu according to the column data.

Click the Script Editor icon and select the "Build Script" menu.

Confirm Script Updating

Confirm Script Updating

Click the "Update" button to update the script of the column.

Confirming the warning message

Confirming the warning message

Click the "Erase" button to replace the column default script with the script built by DGH.

Update Column Content Then Apply The Column Builder Preview To The DataGrid

Update Column Content Then Apply The Column Builder Preview To The DataGrid

After the script is built, update the DataGrid Preview, by clicking the "Update" button.

Then, click on the "Apply" button to apply the modifications to the selected DataGrid (1).

Testing The Result

Testing The Result

To test the result, open the Contents tab of the LiveCode's Property Inspector, then input some data.

Separate data of each column by a tab, and each line by a return.

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.