Using the EWSGridDisplayManager component - HxGN EAM - Version 11.07.01 - Customization & Programming - Hexagon

HxGN EAM Web Services Toolkit Programmer Help

Language
English
Product
HxGN EAM
Search by Category
Customization & Programming
HxGN EAM Version
11.7.1

The BrowseWithManagerForm form demonstrates the EWSGridDisplayManager component. This component handles retrieving the Grid data and uses existing controls to display and manage the data. It does not present any visual controls of its own.

To use this component, you should first add the controls that will display the data. These controls will be assigned to the appropriate properties of the component so that it may use them to display and manage the data. The following table lists the EWSGridDisplayManager component properties that can be assigned to existing form controls:

Property

Description

DataspyComboBox

List of available Dataspys

DataspyApplyButton

Apply the selected Dataspy

FilterFieldsComboBox

List of available filterable fields

OperatorComboBox

List of filter comparison operators

FilterValueInputBox*

A text box to enter the value to compare against the selected filter field.

LookupButton

Bring up the lookup dialog to select the value that will be entered in the above TextBox

FilterApplyButton

Apply the specified filter to the data.

GridControl

DataGrid control to display the actual Grid data that was returned.

*This sample uses the EWSFilterInputBox control in place of a standard text box. See EWSFilterInputBox. Since this control has a built-in lookup button, the LookupButton property is not set to anything.

The following steps outline how to use the component on a Windows form.

  • Add all the controls that will display the Grid data.

  • Drag the EWSGridDisplayManager from the Visual Studio Toolbox onto the form. The component will show up in the tray area at the bottom of the Form Designer.

  • Click on the EWSGridDisplayManager component to select it and have its properties shown in the Property Editor.

  • Assign the appropriate controls to the properties of the component shown in the table above.

  • Set the required GridName and FunctionName properties for the desired Grid data.

  • The form's Activated event handler calls the InitialLoad routine to load the Grid data.

    Static dataLoaded As Boolean

    Static dataLoading As Boolean

    If Not dataLoaded Then If Not dataLoading

    Then dataLoading

    = True

    Me.Refresh() ' Force form to draw fully Me.InitialLoad()

    dataLoaded = True ' Only do this once dataLoading = False

    End If

    End If

    The handler uses static variables to keep the routine from being called multiple times.

  • The InitialLoad routine first attempts to fill in any missing properties by reading the values from the application config file.

  • To load the data, the Session property must be set to an instance of the Datastream.EWS.Session class. The sample uses a global instance that is stored in Globals.Session and was created by the MainForm. The Session property can either be set directly or the instance can be passed as an argument to the LoadData method. The call to LoadData will attempt to fetch the data into an instance of Datastream.EWS.GridData, exposed through the GridData property, and will populate the associated controls with the appropriate data.

    GridDisplayManager.Session = Globals.Session

    GridDisplayManager.LoadData()

    Always make the call to LoadData in a Try/Catch block, since any problems encountered by the component will be raised as exceptions.

The EWSGridDisplayManager component automatically handles pertinent events from the controls that have been assigned to it. For example, if any of the Apply buttons are clicked, they will attempt to gather the appropriate information and reload the data with the new information. Another example is if more records remain cached and the DataGrid is scrolled to the bottom, it will attempt to load more Grid data.