Promotic
WikipediaLinkedInYoutubeTwitterFacebook

GetState - method of object TrendsView

Description:
The method returns the viewer state according to the request specified in the nType parameter.
Syntax:
GetState(nType As Long) As Long
Calling:
n = oTView.GetState(nType)
Parameters:
nType(Long) Specifies the state mask, i.e. the viewer state that will be returned by calling the method. It is possible to enter even the combination of values, for example 2+4.
1 - Check if at least one of objects of the tvTrend type isn't connected to the data source (e.g. the tvTrend.Connect hasn't been called).
2 - Check if at least one of objects of the tvTrend type is connected to the data source (e.g. by calling the tvTrend.Connect method) and it has data ready (former requests to the data, for example when moving the time scale, have already been processed).
4 - Check if at least one of objects of the tvTrend type is connected to the data source and it waits for the data (the data from the server haven't come).
8 - Checks whether at least one of tvTrend type objects has tried to connect to the data source (to a variable in the PmTrend object) (e.g. by calling the tvTrend.Connect method or from the PROMOTIC runtime by the 'edit' button) and this failed by error (connection of the object failed).
16 - Check if at least one of objects of the tvTrend type connected to the data source, has been waiting for the data but these haven't come (waiting ended by the timeout, see: DataTimeout).
32 - Check if the range of the time scale hasn't been extended so that it wouldn't be possible to read all required data from this range. See: PointsMaxVisibleCount.
Return Values:
The method returns the bit combination of values that refers to the viewer state according to the request specified in the nType parameter. If the value, for example, 4 is set in nType, then (if the viewer is in the corresponding state) it returns 4, otherwise 0.
See also:
Example1:
The state of the trends viewer is checked whether some of trends (tvTrend objects) is currently waiting for the data.
If oTView.GetState(4) = 4 Then
  '... some of trends is waiting for the data from the server
End If
Example2:
The state of the trends viewer is checked whether some of trends is currently waiting for the data (value 4) and whether waiting at some of objects was finished by the timeout (value 16). The value 20 is the sum of 4+16.
Dim nState
nState = oTView.GetState(20)
If nState = 20 Then
  '... some of trends is waiting for the data from the server and, at the same time, wating at some of objects was finished by the timeout.
ElseIf nState = 16 Then
  '... none of trends is waiting for the data from the server but waiting at some of trends was finished by the timeout, i.e. the viewer has the data ready (but not all of them) and probably it won't get the remaining data.
ElseIf nState = 4 Then
  '... some of trends is waiting for the data from the server.
Else
  '... nState=0, none of trends is waiting for the data and waiting at none of trends was finished by the timeout. I.e. the viewer has already got all data and they are ready.
End If
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice