上QQ阅读APP看书,第一时间看更新
How to do it...
- Open your AL project folder in Visual Studio Code.
- In order for Designer to work with our AL project, we need to make a small change to the project. Add the following property to the app.json file:
"showMyCode": true
- Press F6. This will publish your extension to your sandbox and launch Designer. When your browser opens, you will see that the design mode is active through the box in the top-center of your window:
While in design mode, you are still looking at the actual data in the system and can interact with the system, just as you would when Designer is not running.
- While still in design mode, navigate to the Items page, and then select any item in order to open the Item Card.
Move your cursor around the page, over the top of various controls on the page. As you move over the fields, you will notice that a triangle appears within the control. For page elements, such as fact boxes, you will notice that the element is highlighted and that the triangle appears within the control. Some examples are as follows:
We can have a single triangle, as in the following screenshot:
We can also have double triangles, as shown here:
- Move your cursor over any field on the page and click the triangle. Select Remove. The page will reload with the field now gone:
- Move your cursor over another field on the page, and then click and drag the triangle to move the field to another location on the page. Release the mouse button to place the field in the new location.
- Now, let's add a new field to the page:
- In the top-center of your screen, in the Designer box, click More.
- Select + Field. A list will open to the right listing all the fields that are available to add to the page.
- Drag any field from the list to anywhere on the page.
Each field in the list will have a status of either Re ady or Placed to indicate whether the field already exists on the page. Note that you can add a field more than once to a page.
- Now that we're done making our updates to the page, let's save the changes:
- In the top-right corner of your browser window, press Stop designing.
- Uncheck the Download Code option.
- Press Save in the bottom-right corner of your browser window.
- Now, we pull the changes into our AL project. In Visual Studio Code, press F7. This will pull back the changes you just made to the Item Card.
- In Visual Studio Code's Explorer pane, open the PageExtension50101.al file and take note of the code in it. The AL code represents the exact changes you made in Designer.
You have just generated AL code by writing no code at all! How cool is that!?