We will add a standard button that will open a set of pre-built swipe-windows for the PD 850 module. Further, we will also create our own button that opens the same windows.
What we will build:
The diagram below shows what you will build in this tutorial. The red dots show tutorial steps.
Step 1: Add a standard button that opens a PD850 swipe view
a. Right-click on view list
c. Select PD_8640 – Open_view_with_pushbutton.
a. Find the data field Open_Info for the view.
c. Find and double-click on the device PD850.
d. Select "PD_24499- Swipe_PD850_MF_IO".
4. Change default label text on "open view with pushbutton" to "PD850".
5. At this point, you can start the graphic editor and place the button where you want on the main view.
Step 2: Create a custom icon that opens a PD 850 swipe view
1. Open "PD_2322 – PD850_MF_IO".
3. Rename to "XX_Button for PD_850".
4. Set view region – bottom right to y=50[mm] and x=50[mm].
b. Set scale factor to 0.4
b. Select PD_16706 – Open_view_in_new_window.
a. Right-click on the Open Info.
c. Find and double-click on the device PD850. Select "PD_24499 – Swipe_PD850_MF_IO".
The last thing you need to do is to make sure the window opens, no matter where the user clicks on the button.
What your code should look like:
Now all mouse clicks or screen taps will go to the "open view in new window".
Step 3: Add your button to the main view
3. Select "XX_Button for PD_850".
4. Start the graphic editor and place your two buttons where you want. Your view should look something like this:
Step 4: Save, build and run your project
2. Save and build the project.
3. Make sure your testbed is still connected and that the PC device is started.
4. Start the project downloader and configure all modules.
5. Open the different views and make sure to try the swipe functionality.
6. Press on both left and right mouse button to close a view.