The tools increment the widget IDs differently, depending on which tool you use. When assigning static widget IDs, the AppBuilder or Widget ID Assignment Utility use the following simple pattern:
1. The widget ID of the first frame in the container is the value specified in the Starting widget ID for frames preference.
2. The widget ID for the first widget in that frame is 2.
3. The widget ID for each additional widget in that frame increments by 2.
4. When all widgets in the frame have a widget ID, the tool moves to the next frame.
5. The tool sets the widget ID of the next frame by incrementing the widget ID of the previous frame by the value in the Frame widget ID increment preference.
6. The tool repeats Step 2 through Step 4 until all the widgets have widget IDs.
7. When the ADM renders the object, it adds the widget IDs of the widget and the frame together to produce the final widget ID value. For example, using the default values, the first widget in the first frame has a widget ID of 102; the second widget is 104; the first widget in the second frame is 202; the second widget is 204; and so on.
The Runtime WIDGET-ID Assignment Tool uses a different scheme when assigning widget IDs to widgets. Each object type has a different increment assigned in the adecomm/_widgaps.p procedure. As the tool assigns widget IDs in a container, it adds the widget ID of the preceding widget and the increment for the preceding widget's object type together to calculate the widget ID of the current object. Some widgets also act as containers for other widgets. For these widgets, the widget ID of the first contained widget is always zero plus the widget's increment. When the ADM renders the container at runtime, it assigns the final widget ID for the contained widgets by adding the container's widget ID to the widget ID of the contained widget. The following table lists the default increments used by the tool.
Note: If these increments are not wide enough to create unique widget IDs for your application's widgets, you can customize the adecomm/_widgaps.p procedure as needed. However, remember that the WIDGET-ID attribute only accepts even INTEGER values of 2 through 65534.
For example, for a static SmartWindow with a SmartToolbar, SmartDataBrowser, SmartDataViewer, and a SmartFilter, the tool generates the following widget IDs:
1. The widget ID of the SmartWindow's default frame is 200, by default.
2. The tool adds the frame's widget ID, 200, to the frame's increment, 200, to create the next widget ID, 400. It assigns 400 as the widget ID of the first widget on the default frame, the SmartToolbar.
3. The tool adds the SmartToolbar's widget ID, 400, to its increment, 200, to create the next widget ID, 600. The SmartToolbar is a container for its SmartToolbarActions, which visualize as buttons. So, the buttons are on the SmartToolbar's frame, rather than the SmartWindow's default frame. The tool skips the buttons and assigns 600 to the next widget on the default frame, the SDB.
4. The SDB's widget ID and its increment, 250, makes the next widget ID, 850. The tool assigns 850 to the next widget on the default frame, the SDV.
5. The SDV's widget ID and its increment, 1000, makes the next widget ID, 1850. The tool assigns 1850 to the last widget on the default frame, the SmartFilter.
6. The tool moves to the next frame on the SmartWindow, the SmartToolbar's frame. The tool starts at 0 and adds 2, the increment for the first contained widget. Thus the first button's widget ID is 2 in the XML file. When the ADM renders the object, it adds the SmartToolbar's widget ID to the button's widget ID to get a final widget ID of 402.
Note: Menu options cannot be assigned widget IDs; only the buttons can have widget IDs.
7. The tool assigns widget IDs to all the buttons on the SmartToolbar and then moves on through the remaining frames. In this example, it assigns widget IDs for the columns in the SDB, the widgets on the SDV, and the fields on the SmartFilter.