Using the EWSGridDisplayControl component - HxGN EAM - 12.0 - Customization & Programming - Hexagon

HxGN EAM Web Services Toolkit Programmer Help

Search by Category
Customization & Programming
HxGN EAM Version

The BrowseWithControlForm form demonstrates the EWSGridDisplayControl component. In contrast to the EWSGridDisplayManager component, this component contains all the controls needed to display and navigate the grid data. This removes the need to add multiple controls to the form and then associate them with the component. However, to provide flexibility in how the constituent controls will appear, many more properties are exposed by this control.

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

  • Drag the EWSGridDisplayControl from the Visual Studio Toolbox onto the form. Since this is a visual component, it will appear directly on the form. Resize the control to the desired dimensions.

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

  • 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.

    GridDisplayControl.Session = Globals.Session


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

The EWSGridDisplayControl component automatically handles the pertinent events for its constituent controls. An example of this is 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.