How to: Add a Button to a Mobile Client for LightSwitch

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

When you develop an HTML mobile client for your LightSwitch app, you can add code that runs when the user taps a button on a screen in that client. For example, you might add code that launches a different screen or performs a calculation.

To add a custom button to a screen

  1. In the Screen Content Tree, choose the node where you want the button to appear.

  2. On the Screen Designer toolbar, choose the Add Layout Item drop-down list, and then choose Button.

    The Add Button dialog box appears.

  3. To use a built-in method
    1. In the Add Button dialog box, choose the Choose an existing method option button.

    2. In the showDialog list, choose the method to run.

      If you choose a method that displays a screen or a dialog box, additional choices may appear. For more information, see How to: Control Navigation.

    3. Choose the OK button to create the button.

  4. To create your own method
    1. In the Add Button dialog box, choose the Write my own method option button.

    2. In the Method text box, enter a name for the button, and then choose the OK button.

    3. In the Screen Content Tree, open the shortcut menu for the new button node and choose Edit Execute Code code.

      The code editor appears.

    4. In the code editor, add code that will run when the user taps the button.

HTML Client Screens

Show: