×

Starting with dynamic windows (forms)

Last updated: August 4, 2022

You can start building windows (the technical name is forms) with the default MA!N or with an empty shell. In both cases it works the same and in our example we will use the latter. The empty shell option only contains a standard dropdown menu at the top.

Empty MAIN container Window

The command window

First:

  1. Start MA!N.
  2. Go to menu bar and select View.
  3. Select Configuration > Commands.

A separate command window opens.

The commands window is a standard MA!N window in which you build dynamic forms. You make it visible through the menu view (View => Commands) in the menu bar.

After opening the commands window, the container application shows the commands window as a ‘fixed’ positioned window.

MAIN commands window

Create or edit a command

Select “New” or “Edit” and a separate window “Edit command” appears. For now, only Command ID, Description, Active and Command will be highlighted. The other elements aren’t relevant for the dynamic forms.

MAIN new command window with some code
  • Command ID: each dynamic form has a unique command ID which is assigned by MA!N after saving the command. Other forms or commands can call this form by its ID. ID’s can change when moving Commands to another environment.
  • Command ID Reference: this looks a bit like the Command ID, but the Command ID reference is a unique ID that you assign as a developer. The regular Command ID is assigned by MA!N. Other than the regular Command ID the Command ID reference never changes.
  • Description: choose a description for the dynamic form. This description appears in the list with commands. Note that this is not the title of the window.
  • Active: selecting this option marks the form as active in the database
  • Command (area in the lower left): the command area is the place where you type (or copy) the XML tags and SQL commands. MA!N uses this code for building the dynamic forms.

Use the following format as default:

“Dynamic Form: Form_[user friendly name]”

Example: “Dynamic Form: Form_SearchBox”.

Key tags

The key tags are:

  • <?xml version=’1.0’?>: Every dynamic form has to start with this tag.
  • <Form></Form>: These are the container tags of the dynamic form.
  • <Caption></Caption>: This tag contains the title of the window.
  • <Group></Group>: Each form must contain at least one group.
  • <Data></Data>: The data section holds the definition of the data displayed on the window. You can edit this in the rest of the form. Each group can only hold 1 data section.

In this example we will start with the following SQL query for selecting the data.

SELECT [Customer ID]()
FROM [Customers]()
  • <Controls></Controls>: The controls section holds the definition of the controls displayed in the window. Common used controls are the datagrid and buttons.

Continue reading: Setting controls for dynamic windows.