Sunteți pe pagina 1din 48

Chapter 3: User Interfaces

CHAPTER 3: USER INTERFACES


Objectives
The objectives are: Use projects in Microsoft Dynamics AX 2009 Design and build Forms in Microsoft Dynamics AX 2009 Create customized menus and menu items Describe Microsoft Dynamics AX 2009 graphical interfaces Describe non-graphical objects in Microsoft Dynamics AX 2009 Create Queries and describe where queries can be used Use the Microsoft Dynamics AX 2009 Help documentation

Introduction
This chapter discusses how to develop the user interface without writing a single line of code. Forms are created to make it possible for the end user to enter and view data. To make navigation easier for the end user, menus and menu items will be created. Different options for obtaining help will be examined. First the Project tool that helps organize the MorphX objects that will be worked will be discussed to help build good development organization and practices.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-1

Development I in Microsoft Dynamics AX 2009

Projects
Projects organize new or customized application objects. Think of a Project as a reference folder for related objects. The project keeps related objects together in a container to help organize and identify items that are part of a customization or modification. Even though objects can be accessed through projects, they reside in their original location in the AOT. Projects are like a shortcut to application objects.

What are Projects?


One advantage of Projects is the ability to save a project's contents and state separately for each user by using Private Projects. This improvement makes it possible to have multiple users who work at the same time in Microsoft Dynamics AX 2009 without conflicts. Public Projects are used to make a Project available to all users. An additional advantage of creating a project is the ability to export the Project as one file. Another developer can then import this file. This is useful when developing in a test environment where several developers contribute to a modification. A Project file can be exported and imported from any Microsoft DynamicsAX 2009 installation to any other installation without compatibility issues. Service packs and upgrade wizards are often delivered as Projects and contain version-specific objects that are accessed for performing the upgrade.

Creating Projects
Project containers are not visible within the AOT. They are stored in their own object tree. To access projects in Microsoft Dynamics AX 2009, use the Project icon on the toolbar as shown in the Figure.

FIGURE 3.1 PROJECT ICON ON THE TOOLBAR

3-2

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


Clicking the Project icon on the Microsoft Dynamics AX 2009 toolbar opens the project tree shown in this figure.

FIGURE 3.2 PROJECT TREE

The project tree is divided into Private and Shared branches: 1. Private - Only visible to the user who created them 2. Shared - Visible to all users of the specific application

Demonstration: Create a Project for the CustBirthday Table


This demonstration describes creating a shared Project for everything you have done using the CustBirthday table. 1. Right-click the Shared projects node in the Projects tree and select NEW > PROJECT. You have a choice of three types of projects: o Project - The standard project that uses standard Microsoft Dynamics AX 2009 objects. o SysTestProject - A project node that is used for storing test projects. Test projects work as a repository for collections of tests, for example, test suites. o Help Book - A help book used for creating a help manual for a project. 2. Rename the Project CustomerBirthday. 3. After renaming the project, use the same right-click menu to open the project by using the Open item shown above. o A separate window opens that contains only the CustomerBirthday project.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-3

Development I in Microsoft Dynamics AX 2009


4. Add a group by right-clicking CustomerBirthday and selecting NEW > GROUP. A group lets you organize objects of the same type such as tables, forms, and more. o Add a group for tables, remembering that other types of objects belong in the project, such as forms, extended data types, views, or other object types that you created for the Customer Birthday project. o A new group named Object1 is created in the project window. 5. Rename Object1 to BirthdayTables by right-clicking on Object1 and selecting Rename. This gives the group a more meaningful name. 6. Open the Properties sheet for the group and specify the ProjectGroupType Properties. o Give a ProjectGroupType of Tables. This restricts the group to only allow for Tables to be added or created in this group. 7. To add tables to the group, drag tables from the Data Dictionary node in the AOT into the BirthdayTables group in the new project. Drag the CustBirthday from the AOT to this group. You can also drag objects from other projects. When moving objects within projects, the object moves to the new location and is removed from the donor project. Holding down the CTRL key when dragging creates a copy of the object. 8. Save the Project by using the icon on the project toolbar. o Add new objects into a Project without a group by selecting the New option on the right-click menu on the base node of the Project.

FIGURE 3.3

Forms
Forms are the primary method of interaction between Microsoft Dynamics AX 2009 and a user. An understanding and exploration of existing forms will allow the development of new forms to retain the same look and feel as standard Dynamics AX 2009 forms.

3-4

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


Elements that Compose a Form
Forms, just as other Microsoft Dynamics AX 2009 objects, are composed of multiple object categories. The basic object categories of a form are as follows: Methods Data Sources Designs

To examine these categories, open the AOT and locate the CustTable form within the Forms branch of the AOT and expand the CustTable form node as shown in the Figure.

FIGURE 3.4 CUSTTABLE FORM NODE

Form Designs
To understand Forms and their design, examine a form at run-time in the application. Some forms can be opened directly from the AOT, whereas other forms rely on information passed to it before they can open. This section works with the CustTable form, which can be opened directly from the AOT.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-5

Development I in Microsoft Dynamics AX 2009


Demonstration: Examining a Form's Design
This demonstration walks through the design of a pre-existing form. Open the CustTable form by right-clicking the CustTable form in the AOT and selecting Open. The customer Form opens and shows all its design and functionality as if it were opened from the Navigation Pane.

FIGURE 3.5 CUSTOMER FORM

Notice there is a Data Grid for the tab labeled Overview in the Customer form. This form is composed of nine tab pages, arranged on the top of the form and nine command buttons or button groups arranged at the right side. After viewing the CustTable form, open the Designs branch and compare the objects residing within it versus the Form. Navigate to the Design branch of the CustTable form in the AOT as shown below.

FIGURE 3.6 DESIGN BRANCH OF THE CUSTTABLE FORM

The groups of objects are Tab and ButtonGroup. These are referred to as controls or form controls. To view all the available controls, right-click the Design node and select New Control.

3-6

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


A sophisticated set of controls exists in the MorphX toolbox for designing forms. The controls range from simple objects such as List boxes to items like Animation controls. The advanced lessons for MorphX, which are outside the scope of this manual, go into more depth and examine the functionality and implementation of these controls. To understand the CustTable Form design and compare it to the assessment, expand the branches of the tab and button group controls on the form.

FIGURE 3.7 THE CUSTTABLE FORM DESIGN

The branches of the Design branch show all the controls that belong to the CustTable form; there are eight Tab controls and seven Buttons. The names of the controls and labels displayed on the CustTable form match what appears in the AOT. As a last examination of this design, expand the Tab Page branch labeled Overview under the Tab branch. This reveals all the objects on the first tab page of the customer form. A data grid or Grid control exists with its attached data columns. Later in this section, you design a simple form, learn how to add controls, and assign them to Data Sources.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-7

Development I in Microsoft Dynamics AX 2009


Forms and Their Data Sources
Because forms present data to users, they must provide a source for the data. These collections of data are called Data Sources and links to the Tables in the AOT.

FIGURE 3.8 DATA SOURCES FOR CUSTTABLE FORM

Open the Data Source for the CustTable form and view its Properties sheet to view which Property values are typically assigned when constructing a Data Source. The Property sheet lists useful Properties for the CustTable data source on the CustTable Form. For example, the AllowCreate and AllowDelete properties control whether new rows can be created or old rows deleted from the customer form. The Table property specifies which table the data source is based on (in this case, the CustTable). The Index Properties controls what index is used for sorting data within the Form. More than a single Data Source can be used on a Form; the linking of data between sources is performed by using the JoinSource Properties. This allows for any level of custom form design. Joining data sources on a form is examined later in this chapter.

3-8

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


Forms and Their Methods
The methods involved with forms are for example methods for opening and closing the Form, and the class declaration node. Methods are the actions application objects perform. Open the methods for the CustTable Form and view the available methods.

FIGURE 3.9 METHODS FOR CUSTTABLE FORM

The init method executes when the form initializes. The close method executes just before the form closes. The ClassDeclaration method is a constructor that defines what classes the form can access. The numberSeqFormHandler method involves calling the class by the same name.

When you create a new form, understanding how to program these methods is not required, Microsoft Dynamics AX 2009 handles them automatically. The custom modification of these methods is beyond the scope of this manual as it involves knowledge of X++ and will be handled in the next class.

Creating Forms
To enter, edit, or delete data in a table from the user interface it must have an accompanying Form. When a new Form is created, MorphX automatically generates a visual layout. Microsoft Dynamics AX 2009 uses the information from its data sources to accomplish this auto-generated layout. In many cases, the system-generated layout is ready to use, but can be modified if it is required. BEST PRACTICES: Use a Project to collect all related development in a central location. This practice will allow the developer to ensure that all components are exported as a unit.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-9

Development I in Microsoft Dynamics AX 2009


Demonstration: Building a Form
This demonstration shows how to build a form. 1. Right-click the Forms node in the AOT and select New Form. 2. Rename the Form CustBirthdayForm. a. Forms retrieve information from data sources. The form you create here will display data from the CustBirthday and CustTable tables. 3. Add Data Sources to the form by dragging and dropping the tables onto the Data Sources node. a. In the AOT, right-click the Tables node and select Open New Window. b. Drag the necessary CustTable and CustBirthday tables onto the Data Sources node of the CustBirthday Form. c. This method of dragging and dropping automatically assigns the Name and Table properties of the data source. 4. Now that there are two data sources on the form, join them so the data is displayed correctly. a. Because the CustBirthday table is our primary data source in this form, join CustTable to this source. b. Set the JoinSource property to CustBirthday on the CustTable data source. Make sure that the LinkType property is set to Delayed.

FIGURE 3.10 JOINED DATA SOURCES FOR CUSTBIRTHDAYFORM

3-10

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


In the following list are the different types of links that can be used on data sources on a Form. Link Type Passive Description Linked child data sources are not updated automatically. Updates of the child data source must be programmed on the Active method of the master data source. A pause is inserted before linked child data sources are updated. This enables for faster navigation in the parent data source because the records from child data sources are not updated immediately. For example, the user could be scrolling past several orders without immediately seeing the order lines for each one. The child data source is updated immediately when a new record in the parent data source is selected. Notice that continuous updates are resourceconsuming. Selects records from the main table with matching records in the joined table - and vice versa. For example, retrieve one record for each match. Records without related records are eliminated from the result. Selects records from the main table regardless of whether they have matching records in the joined table. Selects a record from the main table for each matching record in the joined table. The difference between InnerJoin and ExistJoin: When the join type is ExistJoin, stop searching for matches after locating the first matching record. When the join type is InnerJoin, search for all matching records. Select records from the main table that do not have a match in the joined table.

Delayed

Active

InnerJoin

OuterJoin

ExistJoin

NotExistJoin

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-11

Development I in Microsoft Dynamics AX 2009


Creating Form Designs
The layout of the Form is created under the Designs node. Drag the fields or field groups from the data source to the Design node. Within this area you can organize the fields in groups, on a grid, or arrange the fields on different tab pages.

FIGURE 3.11 DESIGNS FOR CUSTBIRTHDAYFORM

Demonstration: Creating the Form Design


This demonstration shows you how to display information in a grid format. 1. Set the Caption property on the Properties sheet of the Design to Customer Birthday's so the title bar of the form is not blank. 2. Add a grid control to display the data by right-clicking on the Design node and selecting NEW CONTROL > GRID from the context menu.

3-12

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


3. To add fields to the grid, open the CustBirthday and CustTable data sources in a new window and drag the fields onto the Grid control. Add the following fields to the Grid. a. From the CustBirthday table: AccountNumber, birthday, GiftIdeas b. From the CustTable table: Name

FIGURE 3.12 ADDING A GRID AND FIELDS

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-13

Development I in Microsoft Dynamics AX 2009


A new Form with an auto-generated method is completed. Before you use this Form, review the auto design and modify as it is needed. 4. Edit the Form design by right-clicking the Design node and selecting Edit. 5. The new Form's Properties sheet and a toolbox appear.Use the toolbox to add a text box to display the current date. To add a text box, select the DateEdit component from the toolbox and select the destination on the form for the DateEdit field.

FIGURE 3.13 ADDING A TEXT BOX

6. Modify the properties of the DateEdit component on the form. Set the DateValue property to date. 7. Use the Find Label dialog to find the label Today and set it as the Label property for the new DateEdit control.

3-14

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


The final form appears below.

FIGURE 3.14 COMPLETED FORM

Forms Creation
Create a new Form accessing the CustTable table called CustTest. Create a new Form in Microsoft Dynamics AX 2009 that has the following requirements Properties: Uses the customer table CustTable as the Data Source. Use a Tab in your design. Add a Tab Page to your Tab. Use a Grid control as the Tab Page. The following columns should be on your Grid - AccountNumber and Name. Label the Tab Page as Customer Info. Set the Caption Properties of your design to @SYS19920 using the label finder. There is a Properties named TitleDatasource which must be set for the Caption to operate correctly. Set it to your Data Source. Name your new form to CustTest.

The final form when it is compiled and saved should resemble this form:

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-15

Development I in Microsoft Dynamics AX 2009

Lab 3.1 - Forms Creation


Create a new Form accessing the CustTable table called CustTest.

Challenge Yourself!
Create a new Form in Microsoft Dynamics AX 2009 that has the following requirements Properties: Uses the customer table CustTable as the Data Source. Use a Tab in your design. Add a Tab Page to your Tab. Use a Grid control as the Tab Page. The following columns should be on your Grid - AccountNumber and Name. Label the Tab Page as Customer Info. Set the Caption Properties of your design to @SYS19920 using the label finder. There is a Properties named TitleDatasource which must be set for the Caption to operate correctly. Set it to your Data Source. Name your new form to CustTest.

3-16

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


The final form when it is compiled and saved should resemble this form:

FIGURE 3.15

Step by Step
Solution
1. Right-click the Forms node in the AOT and select New Form. 2. Right-click the NewForm1 and Rename it CustTest. 3. Expand the CustTest form node and right-click Data Sources and select New Data Source. 4. Right-click DataSource1 and select Properties to open the Properties sheet. 5. Set the Table Properties to CustTable. Close the Properties sheet. 6. Expand the Designs node, right-click the Design branch, and select New Control and Tab. 7. Right-click the Tab branch and select New Control and TabPage. 8. Expand the Tab branch, right-click TabPage:TabPage, and select New Control and Grid. 9. Right-click the Grid: Grid branch and select New Control and StringEdit. 10. Repeat step 9 to create a second field. 11. Right-click the StringEdit:StringEdit branch and select Properties to open the Properties sheet. Set the DataSource property to DataSouce1 and the DataField property to AccountNum. 12. Right-click the StringEdit1:StringEdit1 branch and select Properties to open the Properties sheet. Set the DataSource property to DataSuouce1 and the DataField property to Name.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-17

Development I in Microsoft Dynamics AX 2009


13. Right-click the TabPage: TabPage branch and select Properties to open the Properties sheet. Set the Caption property to Customer Info. 14. Right-click the Design branch under the Designs node and select Properties to open the Properties sheet. 15. Search for the symbol @sys19920 in the Caption property. 16. When the symbol is located, click the Paste Label button to paste the label ID to the Caption property. 17. Right-click the CustTest form and select Properties to display the properties sheet. Set the Name Properties to CustTest. 18. Open the Form; it should resemble the one above.

3-18

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces

Menus Items in MorphX


Use menu items to enable activation of application objects from the user interface. A menu item contains five key properties: Name - The name of this menu item Label - The label appearing on the menu item ObjectType- The type of object this item points to Object - The object name that this item points to RunOn - The location (Client or Server) where the called object will run Security Key - A key defined in the data dictionary that defines the security access for the menu item

There are three types of menu items that can be created: Display Output Action

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-19

Development I in Microsoft Dynamics AX 2009


Display Menu Items
Display menu items open objects that appear on the screen, typically forms. For example, clicking the Customers menu item in the Accounts Receivable module opens the CustTable form. This Display Menu item points to the Form object CustTable.

FIGURE 3.16 MENU ITEMS

3-20

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


The Properties sheet of the Display Menu Item associated with opening the Customer form.

FIGURE 3.17 MENU ITEMS

There are two important Properties to notice. Class property = Form Object property = CustTable

The Class property sets the class of item that appears, whereas the Object property is the name of the object itself. When you open the menu item, a form named CustTable opens.

Demonstration: Creating a Display Menu Item


This demonstration creates a menu item named ZipMenuItem. This new menu item displays the ZipCode form when it is put in a menu. 1. Create a new menu item to start a form by right-clicking on the Display menu item node in the AOT. 2. Rename the menu item to ZipMenuItem.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-21

Development I in Microsoft Dynamics AX 2009


3. In the properties sheet, set the Object property to AddressZipCodes. Because this is a display menu item, the Class property is automatically set to Form. 4. Assign the label ZIP/postal Code reference to this menu item by searching for this label using the Find Label dialog box. 5. Save the menu item.

FIGURE 3.18

The new menu item is now available to be added to a new or existing menu.

Output Menu Items


Use output menu items for starting objects that generate output, typically reports. These objects often open a standard report directly or can be classes that generate dialog forms used for printing reports. These dialog forms have a similar structure. The basic buttons always visible on these output forms are as follows: Select Default Options

3-22

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


The buttons prepare report output as follows: Select - Displays an Inquiry window for report preparation Default - Regenerates the default parameter setup for printing the report Options - Enables selection of printing options

The figure illustrates the form that enables the outputting of the Customer Turnover report (CustRevenue).

FIGURE 3.19 CUSTOMER TURNOVER FROM OUTPUT MENU ITEM

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-23

Development I in Microsoft Dynamics AX 2009


This Figure illustrates the Properties sheet for the CustRevenue menu item.

FIGURE 3.20 CUSTREVENUE PROPERTIES SHEET

There are two important properties to notice. Class property = Class Object property = CustReport_Revenue

The CustRevenue Output Menu Item directly calls the class named CustReport_Revenue.

Action Menu Items


Action menu items link to objects that are used for producing actions. An action in Microsoft Dynamics AX 2009 is an event such as creating a customer collection letter, or a BOM approval. The action menu item is a link to execute a certain class or query, or to open a form related to a particular event.

3-24

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


The Figure illustrates the output resulting from creating a collection letter.

FIGURE 3.21 COLLECTION LETTER FROM ACTION MENU ITEM

The property sheet of an action menu item is structurally identical to an Output menu item.

Navigation Pane and Area Pages


The Navigation Pane contains all of the menus that have been added to the menu MainMenu. The Navigation Pane also includes the Places and Forms sections.

Menus Access By Using MorphX


This section discusses creating new menus in Microsoft Dynamics AX 2009 and adding menu references. Menus are forms used for navigating within Microsoft Dynamics AX 2009 application. Menus always contain menu items, sub-menus, or references to other menus. Menus are essentially containers for menu items. The standard components consisting of a menu are in the following list: Menu Items - These point to a specific display, output, or action object Sub Menus - Folders that act as sub-menus within menus Separators - The graphical separators between menu items Menu References - References (shortcuts) to other menus

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-25

Development I in Microsoft Dynamics AX 2009


To understand how Microsoft Dynamics AX 2009 uses a menu within the Content Pane form, review the Figure:

FIGURE 3.22 ACCOUNTS RECEIVABLE CONTENT PANE

The Cust menu in the AOT represents the accounts receivable menu. Recall this menu is a part of a larger menu, the MainMenu. To understand how these menu objects interact, expand the Menus node in the AOT as shown in the following figure.

FIGURE 3.23 EXPANDED MENUS NODE IN THE AOT

3-26

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


Search the Menus node for the folder named MainMenu. Expand the MainMenu objects node as shown in the following figure to view the design of Microsoft Dynamics AX 2009's Navigation Pane.

FIGURE 3.24 EXPANDED MAINMENU NODE

The small arrow on the folder indicates that these are menu references for the Microsoft Dynamics AX 2009 Navigation Pane. If you view the properties for the Accounts receivable menu reference in the MainMenu, note the object name of the menu is Cust. The menu reference points to the Cust menu. Locate the Cust menu and open its node. Notice you are viewing the objects that are seen from the Accounts receivable menu of Microsoft DynamicsAX 2009. The Cust menu consists of the following submenus: Journals Inquiries Reports Periodic Setup

The visible menu items shown within the parent menu are as follows: Sales order Free Text Invoice Customers

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-27

Development I in Microsoft Dynamics AX 2009


When you create menus use menu items, submenus, and menu references. Insert separators for grouping similar items together and for cosmetic purposes.

Demonstration: Adding a Menu Item to a Menu


A previous demonstration walked through creating a menu item named ZipMenuItem that was a link to the ZipCodes form. This demonstration discusses adding the ZipMenuItem to the Cust menu. 1. Locate the Cust menu in the Menus node in the AOT by rightclicking on the Cust node and selecting New > Menu item. o To improve the look of the menu, drag the new menu item to the area where the other menu items reside.

FIGURE 3.25 ADDING A NEW MENUITEM

2. Assign the MenuItemName property ZipMenuItem. The properties associated with ZipMenuItem such as Label and Object Properties are inherited. 3. To test the menu item highlight it and open it. Verify it contains the ZipCodes form. A quicker alternative for adding a menu item to an existing menu is using the drag and drop functionality in MorphX. Drag the menu item onto the specified menu.

3-28

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


Demonstration: Create a Menu and Add a Menu Reference
This demonstration discusses creating a menu and adding a menu reference. 1. Create a new menu to contain the ZipMenuItem by right-clicking on Menus in the AOT and selecting New Menu. 2. Rename the new menu ZipCode and give it a label of Zip Codes. 3. Drag the ZipMenuItem menu item onto this menu. o At this point you could set certain security rights on this menu in the properties of the menu. 4. Add this menu as a menu reference to the Navigation Pane by locating the MainMenu in the Menus node, right-clicking, and selecting New > Menu Reference. 5. Locate the ZipCode menu from the new window and drag it as shown to the MainMenu. Rearrange menu references as you want. 6. To test the new menu, close and open the Navigation Pane to determine whether the Zip Code menu is available. The Navigation Pane now has another tab labeled Zip Codes. Within this tab you can access the Zip code reference menu item.

FIGURE 3.26 DRAGING A NEW MENU REFERENCE

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-29

Development I in Microsoft Dynamics AX 2009


Navigation Pane
The Navigation Pane is on the left-hand side of the AX 2009 window. It contains all of the menus that have been added to the menu MainMenu within AX 2009s AOT. New in Dynamics AX 2009 the Navigation Pane contains the Places and Forms sections.

FIGURE 3.27 NAVIGATION PANE

Places
Places is a new functionality in Dynamics AX 2009 located within the Navigation Pane. The Places section contains an Area Page link and links to Menu Items that have been appropriately designed. Clicking on a Menu Item other than the Area Page, in the Places section of the Navigation Pane will launch that Menu Item as either a List Page or as a Single Document Interface (SDI) form.

3-30

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


A Menu Item is automatically added into the Places section if that Menu Item has the property IsDisplayedInContentArea = Yes. In the figure the Chart of Account Details menu item is displayed in the Places section of the Navigation Pane because it has IsDisplayedInContentArea = Yes.

FIGURE 3.28 A MENU ITEM IN PLACES

NOTE: Single Document Interface (SDI) forms are one of the biggest changes to the user interface in Dynamics AX 2009. In previous versions of Dynamics AX 2009 all forms were Multi-Document Interface (MDI) forms. The advantage of SDI forms is that they located outside of the Content Frame as a separate Window.

Forms
Forms is a new section within the Navigation Pane that contains links to all other Menu Items that are not set to be displayed in Places.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-31

Development I in Microsoft Dynamics AX 2009


Area Pages
Clicking on the Area Page link in the Places section of the Navigation Pane will open the Area Page for that module in the Content Frame (the area to the right of the Navigation Pane).

FIGURE 3.29 NAVIGATION PANE AND GENERAL LEDGER AREA PAGE

The Area Page can be used as an alternate means of navigating through the system as it displays all of the forms that are listed within the Navigation Pane. The Area Page cannot be developed. It is generated by Dynamics AX 2009 using the structure of the menu that is displayed. An Area Page and its link will be created automatically whenever a new menu is created in the AOT. NOTE: List Pages are a new type of form that will display read-only lists within the Content Frame. List Pages are beyond the scope of this course, and are addressed in a more advanced course.

Menu Items Creation


Develop a new menu item that will open the CustTest form you have developed in the previous exercise.

3-32

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


Requirements of this exercise are the completion of a new menu item with the following Properties: Menu Item opens the CustTest form that you created in the previous exercise Select the appropriate type of menu item Select the correct object class and object Name and label the new menu item CustTest Put the new menu item on the Accounts Receivable menu, located below the Customers form

Your completed menu item, when it is opened, contains the CustTest form.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-33

Development I in Microsoft Dynamics AX 2009

Lab 3.2 - Menu Items Creation


Develop a new menu item that will open the CustTest form you have developed in the previous exercise.

Challenge Yourself!
Requirements of this exercise are the completion of a new menu item with the following Properties: Menu Item opens the CustTest form that you created in the previous exercise Select the appropriate type of menu item Select the correct object class and object Name and label the new menu item CustTest Put the new menu item on the Accounts Receivable menu, located below the Customers form

Your completed menu item, when it is opened, contains the CustTest form.

Step by Step
Solution
1. Expand the Menu Items node in the AOT. Right-click the Display node, and select New Menu Item. 2. Open the Property sheep and set the Class property to Form. 3. Set the Object property to CustTest. 4. Set the Name and Label Properties to CustTest. 5. Right-click the CustTest branch under the Display node and select Save. 6. Right-click the CustTest branch under the Display node and select Open. 7. Your CustTest Form should open. 8. In the AOT, expand the Menus node and locate the Cust menu and expand. Right-click the Cust menu and select New then Menu item. 9. Open the properties for the new menu item. The MenuItemType should be Display and the MenuItemName should be CustTest. 10. Position the new CustTest menu item below the Customers menu item. 11. When you now open the Navigation Pane your CustTest menu should be available in Accounts Receivable.

3-34

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces

Microsoft Dynamics AX 2009 Non-graphical Objects


This section discusses additional objects that are used in Microsoft Dynamics AX 2009 applications, such as classes that are dedicated to data processing and event management. This section also covers macros and jobs, which are used for: Project containment Scripting and testing application code Scripting and testing custom developed X++ code segments

Classes
Classes have the following characteristics: Classes allow reuse common functionality or business logic. Classes are a design or blueprint for a programming object. After a set of Classes is defined, they can be used programmatically from all the other application objects. Classes can be run directly from the AOT if a Main method is defined, although this is not a common practice. Classes are used for solving tasks for other application objects, such as forms and reports. Classes in Microsoft Dynamics AX 2009 share the same attributes a class in C# has, such as inheritance, polymorphism, and encapsulation.

You may be tempted to start with coding as the first step. This approach is not ideal in a Microsoft Dynamics AX 2009 application because code runs in the context of an application object and an associated event. A class contains all the properties, methods, and variables needed by an object. A class can be created by right-clicking the Classes node of the AOT, and selecting New class or by using the Class Wizard located in the Tools menu.

Class Methods
When developing a class it contains three nodes by default: The Class Declaration node specifies the name of the class and the necessary variables. It can also specify inheritance.

NOTE: Class Declaration is not a method. It is a class-level scope area that defines global variables for all methods within the class.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-35

Development I in Microsoft Dynamics AX 2009


The New method is used every time that a new object is instantiated. You can also assign values to object variables using this method. The method is hidden until it is overridden. The Finalize method terminates the object. This method is rarely used, because the object no longer exists when the object handle is set to null. This method is not visible until it is overridden.

Classes are covered in detail in the course Development II: Introduction to X++, and are beyond the scope of this tutorial on MorphX.

Macros
Macros act as a container for defining variables used for frequent tasks. The purpose of macros is to make statements easy to reuse. A macro cannot be executed independently of a class. They serve in the same manner a header file might serve for data structure definition, because they provide definition values of Properties associated to an object. An example of a Macro is a File macro. The File macro provides: Definitions of file extensions Input/Output definitions XML file definition Delimiter information

A sample of a macro named File is shown in the following figure that describes file extensions. File extensions are definitions for objects in Microsoft Dynamics AX 2009 that must use files. This macro enables file extensions to be defined in a single central location, where all file aware classes can have use of it.

FIGURE 3.30 FILE EXTENSION MACRO

The macros node in the AOT contains macros used by the standard application. Here are some key points of macros. They can be declared wherever you can write X++ statements and contain code that can be useful in several places. An advantage of defining a macro is that the maintenance is done in only one place. A macro cannot run independently, but can be used anywhere you can write code in the system, such as in jobs, classes, and forms.

3-36

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


Macro Types
There are three ways that macros in Microsoft Dynamics AX 2009 are packaged. Macro libraries Stand-alone macros Local macros

All types of packaging have identical syntax and functionality. The differences between the packaging are: A standalone macro is created by using the macro node of the AOT. A local macro is declared within a method or stand-alone macro. A macro library is a standalone macro that contains a collection of local macros.

Generally, define a class instead of writing macros for work involving statement logic. Macros are covered more in detail in advanced classes in X++ and MorphX development.

Jobs
The jobs node on the application object tree contains small X ++ programs that are executed as batch jobs. They are useful when developing and testing new functionality for Microsoft Dynamics AX 2009. The jobs node on the AOT is empty after installing and configuring the Microsoft Dynamics application. These batch jobs can be scheduled to run at specific times.

FIGURE 3.31 JOBS IN THE AOT

Create a new job by selecting New Job when right-clicking on the Jobs node in the AOT. The Job skeleton named Job1 is created. Use the Edit method from the MorphX right-click menu to create new X++ code you can test or modify existing code within a job.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-37

Development I in Microsoft Dynamics AX 2009


The following Figure illustrates that Job1 is a shell for a static method when you open it using the Jobs Editor.

FIGURE 3.32 JOB1 SHELL

Jobs have the following characteristics: When testing new code, jobs save development time by eliminating creating a new class and defining a new method. A job is a static method that returns nothing and can be attached to a form for testing. They are primarily used in the production environment only to run batch work in the background.

Microsoft Dynamics AX 2009 includes several batch processes already a part of the system. Jobs are discussed in Development II.

Queries
Queries ask questions about data stored in a database. The information selected by a query can be used as the basis for a form, auto report, or another query. The query extracts data from a database and presents it in a form for viewing. Although the query does not provide a graphical viewing interface, Microsoft Dynamics AX 2009 provides a specialized form named a query dialog form.

3-38

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


What are Queries and How Do They Work?
Using a query, retrieve data from tables within the database and/or views that are logical tables. When a query is designed in the AOT, the user must determine the information the query returns.

FIGURE 3.33 ASSETBOOK DATA SOURCE

The Asset Proposal query uses the AssetBook and AssetTable tables as its data source. Basic components of a query are composed of: Methods Data Sources

Data sources have their own field objects and methods such as sorting. A query resembles a view except it is not static because it can be modified at run time. Often, queries are used behind the scenes and are never viewed by the user. This is the case when X++ based queries set the position of a data source on a form. Query objects that are created in the AOT can be viewed by using the query dialog form. The query dialog form in this section is a system form named SysQueryForm. The SysQueryForm is the standard form used by Microsoft Dynamics AX 2009 for presenting graphical dialog boxes that enable the design and modification of queries by the end user. To show how the query is linked to the SysQueryForm, view the properties sheet of the AssetProposal query. Open the Asset Proposal query so for analysis in the query dialog form.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-39

Development I in Microsoft Dynamics AX 2009


The Asset Proposal query returns the query dialog form populated with the fields in the Ranges branch of its data sources.

FIGURE 3.34 ASSET PROPOSAL QUERY RESULTS

The query dialog shown in the proceeding figure is the result of the query design.

3-40

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


To understand the query dialog box, examine the data sources of the AssetProposal query. Expand the Ranges node and the Data Sources node as shown in the following figure.

FIGURE 3.35 EXPANDED RANGES AND DATA SOURCES NODES

The Data Sources branch refers to tables that are used by the query; Ranges refers to the fields available to the query dialog form. The data sources and Relations objects together form all the possible fields available to the query. Fields in the Ranges branches appear in the query Dialog design form when it opens. The design of a query at runtime is a temporary change that is not stored after the design change occurs. The user can add different tables, table joins, fields, field criteria, and have their custom design run one time.

Demonstration: Create a Query


This demonstration discusses creating a query based on the CustBirthdayView view. The query is designed so that it only selects customer accounts where the GiftIdea field is equal to Theater Tickets by default. You can later base an auto report on this query and run it any time to find which customers want theater tickets. 1. Right-click the Queries node in the AOT. Rename the query CustomerTickets and title it Ticket Needs. 2. To add the data source for the query, drag the CustomerBirthdayView onto the Data Sources node of the query.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-41

Development I in Microsoft Dynamics AX 2009


3. Add ranges to the query. Expand the Fields and Ranges branches. Add the AccountNumber, birthday, and GiftIdeas fields to the Ranges node. o Drag fields into the Ranges branch from the Fields branch. After dragging the fields to the Ranges node and closing the Fields node, the query appears as shown in the following figure.

FIGURE 3.36 QUERY IN THE AOT

4. Open the query to view its results. Set the criteria field for GiftIdea. 5. Set the Criteria property to the value of Theater Tickets using the drop-down menu on the query dialog form. The Customer Tickets query is finished and can be used in a report that shows customers who wants theater tickets as a gift.

Help Documentation
Microsoft Dynamics AX 2009 2009 includes a Help system that is based on Compiled HTML Help files (chm files). The Help system can be accessed from Microsoft Dynamics AX 2009 to provide assistance with the application; however, it is also available from outside the application. The help system is spilt into several files to reflect the job roles associated with Microsoft Dynamics AX 2009. Each Help file is editable by using a Chm file tool such as HTML Help Workshop. The same tool can be used for creating new Help files for Partner Solutions. Chm files do not have to be indexed or initialized during installation. This can save time. The Help files are continuously updated and made available for download.

3-42

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces


System Documentation
The Microsoft Dynamics AX 2009 system documentation is under AOT's System documentation node and contains links to manuals for the development environment. To access system documentation: 1. Open the AOT from the toolbar and expand the System documentation node. The documentation is categorized by sub nodes. 2. Expand the sub nodes to view the documentation that is contained in each category. Under the Classes sub-node there are hundreds of classes. Documentation in this node describes properties and methods. The type of information in the system documentation node is intended for developers. Under the Functions sub-node there are hundreds of useful functions you will use when programming in X++.

Application Developer Documentation


The Microsoft Dynamics application developer documentation is located under the Application developer documentation node and contains links to reference documentation for application tables and classes. To access the application developer documentation: 1. Open the AOT from the toolbar and expand the Application developer documentation node. The documentation is categorized by sub nodes. 2. Expand the sub nodes to view the documentation that is contained in each category. Under these nodes you find documentation about the tables and classes used by Microsoft Dynamics AX 2009. The documentation is intended for developers. The information in this node is technical, not functional information. To find functional information for end users, look in the application documentation.

Application Documentation
The Microsoft Dynamics AX 2009 application documentation is located under the Application documentation node and contains reference documentation for the Microsoft Dynamics AX 2009 application. Documentation is also available on forms in the application.

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-43

Development I in Microsoft Dynamics AX 2009


To access the application documentation: 1. Open the AOT from the toolbar and expand the Application documentation node. The documentation is categorized by sub nodes. 2. Expand the sub nodes to view the documentation that is contained in each category. This documentation is available through the general Microsoft Dynamics AX 2009 help menu in the application toolbar.

FIGURE 3.37 ACCESSING HELP

NOTE: You can check if there is an updated version of the Help file. Just click Check for Updates on the Help menu. You can also check this site for more information: http://www.microsoft.com/dynamics/ax/using/default.mspx

Summary
This course discussed how to develop the user interface without writing a single line of code. This course also made it possible for end users to enter and view information using Forms that were created. To make navigation easier for the end user, menus and menu items were created. Different options for obtaining help were examined. Tools such as the Project Tool were reviewed to help organize the MorphX objects that were worked upon. The next course examines the Report functionality in Microsoft Dynamics AX 2009.

3-44

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces

Test Your Knowledge


Test your knowledge with the following questions. 1. The three (3) elements for a Form include: ( ) Methods, Data Sources, and Views ( ) Designs, Methods, and Data Sources ( ) Display Menu Items, Data Sources, and Designs ( ) Jobs, Menu Items, and Macros 2. The Area Pages can be customized by: ( ) Making changes to the Areas node in the AOT ( ) By making changes to the Menus that the Areas page will automatically be generated from ( ) By setting the IsDisplayedInContentArea property of the Navigation Pane ( ) The Area Pages cannot be changed 3. Available Project types available are: Mark all that apply. (Select all that apply.) ( ) Project ( ) Help Project ( ) SysTestProject ( ) Test Project 4. Available Menu Items are: Mark all that apply. (Select all that apply.) ( ) Display Menu Items ( ) Output Menu Items ( ) Project Menu Items ( ) Report Menu Items

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-45

Development I in Microsoft Dynamics AX 2009

Quick Interaction: Lessons Learned


Take a moment and write down three key points you have learned from this chapter: 1.

2.

3.

3-46

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

Chapter 3: User Interfaces

Solutions
Test Your Knowledge
1. The three (3) elements for a Form include: ( ) Methods, Data Sources, and Views () Designs, Methods, and Data Sources ( ) Display Menu Items, Data Sources, and Designs ( ) Jobs, Menu Items, and Macros 2. The Area Pages can be customized by: ( ) Making changes to the Areas node in the AOT () By making changes to the Menus that the Areas page will automatically be generated from ( ) By setting the IsDisplayedInContentArea property of the Navigation Pane ( ) The Area Pages cannot be changed 3. Available Project types available are: Mark all that apply. (Select all that apply.) () Project ( ) Help Project () SysTestProject ( ) Test Project 4. Available Menu Items are: Mark all that apply. (Select all that apply.) () Display Menu Items () Output Menu Items ( ) Project Menu Items ( ) Report Menu Items

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

3-47

Development I in Microsoft Dynamics AX 2009

3-48

Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement

S-ar putea să vă placă și