WeibullDataSet.GetDistrParameters: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Template:APIClass|WeibullEvents Class|WeibullEvents}}
{{Template:API}}{{Template:APIBreadcrumb|.[[WeibullDataSet Class|WeibullDataSet]]}}
Displays a prompt for entering customized parameters. This is called when the Calculate method is called and there is insufficient data to fit a model.


== Syntax ==
<ul><li>GetDistrParameters(
{{APIName|sender}}
{{APIPrefix|As}}
{{APIName|[[WeibullDataSet Class|WeibullDataSet]],}}
{{APIName|sMsg}}
{{APIPrefix|As String}}
{{APIName|,}}
{{APIName|GetOnlyOneParameter}}
{{APIPrefix|As Boolean}}
{{APIName|,}}
{{APIName|Params}}
{{APIPrefix|As}}
{{APIName|List(}}
{{APIPrefix|Of}}
{{APIName|[[ParamInputInfo Class|ParamInputInfo]] )}}
{{APIName|, Cancel}}
{{APIPrefix|As Boolean}})</li></ul>


Parameters
<onlyinclude>Occurs when there is insufficient data to fit a model. Displays a prompt for entering the parameters of the distribution.</onlyinclude>
:''sender'': A [[WeibullDataSet Class|WeibullDataSet]] object.


:''sMsg'': The main display label.


:''GetOnlyOneParameter'': The prompt for only one parameter.
{{Template:API_EventsNote}}


:''Params'': A list of [[ParamInputInfo Class|ParamInputInfo]] objects that would be updated by this prompt. After processing with this event handler, the Value of each ParamInputInfo object will be updated.
== Syntax ==
'''_GetDistrParameters'''(''sMsg'', ''InputInfo'', {{APIPrefix|ByRef}} ''Cancel'')


:''Cancel'': If the prompt was closed by any means other than clicking "Okay," this value will be set to True.
===Parameters===
''sMsg''
: Required. String. The message to display.
''InputInfo''
: Required. An array of [[DistrParametersInput Class|DistrParametersInput()]] type objects that represent the model's parameters.
''Cancel''
: Required. Boolean. Indicates whether the input was cancelled. Default value = False.


== Usage Example ==


{{APIComment|'Overrides requested. Create a new class, inherit WeibullEvents, and set the dataset's events.}}
== Example ==
  Private Class myEvents
The following example provides a simple demonstration on how to customize the event procedure.
      Inherits WeibullEvents
'''VBA'''
      Public Overrides Sub GetDistrParameters(sender As WeibullDataSet, sMsg As String,
      GetOnlyOneParamater As Boolean, Params As List(Of ParamInputInfo), ByRef Cancel As Boolean)
          MyBase.GetDistrParameters(sender, sMsg, GetOnlyOneParamater, Params, Cancel)
          MessageBox.Show("Additional overridden code here.")
      End Sub
  End Class
    
    
  {{APIComment|'Declare the WeibullDataSet.}}
  {{APIComment|'Specify a variable to handle the event.}}
  Dim WDS as New WeibullDataSet
  {{APIPrefix|Private WithEvents}} wds {{APIPrefix|As}} WeibullDataSet
 
{{APIComment|'Use the created myEvents class in place of the one created by the dataset.}}
{{APIComment|'----------------------------}}
  WDS.Events = New myEvents
  {{APIPrefix|Private Sub}} Main()
 
  {{APIComment|'Associate the event variable with an object.}}
{{APIComment|'Creates a new list of [[ParamInputInfo Class|ParamInputInfo]] objects. Populate the list.}}
    {{APIPrefix|Set}} wds = {{APIPrefix|New}} WeibullDataSet
  Dim Params As New List(Of ParamInputInfo)
  Params.Add(New ParamInputInfo("Param1", 0, 10, False, True))
  {{APIComment|'Set the application to use your event procedure.}}
   Params.Add(New ParamInputInfo("Param2", 0, Double.MaxValue, False, True))
    wds.UseEvents = True
    
  {{APIComment|'Create a Boolean for return of "Cancel" parameter.}}
  {{APIComment|'To trigger the event, call the Calculate method without defining a data set. }}
  Dim wasCanceled As Boolean
    wds.Calculate
    
    Msgbox({{APIString|"End"}})
  {{APIComment|'Prompt user to input the parameters.}}
   {{APIPrefix|End Sub}}
  WDS.Events.GetDistrParameters(WDS, "Message1", True, Params, wasCanceled)
    
{{APIComment|'----------------------------}}
  {{APIComment|'The new Parameter values are in their respective ParamInputInfo.Value variables.}}
  {{APIPrefix|Private Sub}} wds_GetDistrParameters({{APIPrefix|ByVal}} sMsg {{APIPrefix|As String}}, _
   Dim NewParameter1value As Double
                                    {{APIPrefix|ByVal}} InputInfo {{APIPrefix|As SynthesisAPI.DistrParametersInput}}, _
  Dim NewParameter2value As Double
                                    Cancel {{APIPrefix|As Boolean}})
  If Not wasCanceled Then
  {{APIComment|'<Add code here to handle the event.>}}
      NewParameter1value = Params(0).Value
    MsgBox (sMsg)
      NewParameter2value = Params(1).Value
   {{APIPrefix|End Sub}}
   End If
 
'''VB.NET'''
  {{APIComment|'Specify a variable to handle the event.}}
  {{APIPrefix|Private WithEvents}} wds {{APIPrefix|As}} WeibullDataSet
{{APIComment|'----------------------------}}
   {{APIPrefix|Private Sub}} Main()
  {{APIComment|'Associate the event variable with an object.}}
    wds = {{APIPrefix|New}} WeibullDataSet
   
  {{APIComment|'Set the application to use your event procedure.}}
    wds.UseEvents = True
  {{APIComment|'To trigger the event, call the Calculate method without defining a data set. }}
    wds.Calculate
    Msgbox({{APIString|"End"}})
   {{APIPrefix|End Sub}}
  {{APIComment|'----------------------------}}
   {{APIPrefix|Private Sub}} wds_GetDistrParameters(sMsg {{APIPrefix|As String}}, _
                                    InputInfo {{APIPrefix|As DistrParametersInput}}, _
                                    {{APIPrefix|ByRef}} Cancel {{APIPrefix|As Boolean}}) {{APIPrefix|Handles}} wds.GetDistrParameters
    {{APIComment|'<Add code here to handle the event.>}}
    MsgBox (sMsg)
   {{APIPrefix|End Sub}}

Latest revision as of 23:40, 6 September 2016

APIWiki.png


Member of: SynthesisAPI.WeibullDataSet


Occurs when there is insufficient data to fit a model. Displays a prompt for entering the parameters of the distribution.


Remarks: To hide the messages or write your own code for the event procedure, set the UseEvents property of the object to True. The event is raised by the class methods.

Syntax

_GetDistrParameters(sMsg, InputInfo, ByRef Cancel)

Parameters

sMsg

Required. String. The message to display.

InputInfo

Required. An array of DistrParametersInput() type objects that represent the model's parameters.

Cancel

Required. Boolean. Indicates whether the input was cancelled. Default value = False.


Example

The following example provides a simple demonstration on how to customize the event procedure.

VBA
 
 'Specify a variable to handle the event. 
  Private WithEvents wds As WeibullDataSet

 '----------------------------  
 Private Sub Main()
   'Associate the event variable with an object. 
    Set wds = New WeibullDataSet

   'Set the application to use your event procedure. 
    wds.UseEvents = True

   'To trigger the event, call the Calculate method without defining a data set.  
    wds.Calculate
    Msgbox("End")
 End Sub

 '---------------------------- 
 Private Sub wds_GetDistrParameters(ByVal sMsg As String, _
                                    ByVal InputInfo As SynthesisAPI.DistrParametersInput, _
                                    Cancel As Boolean)
   '<Add code here to handle the event.> 
    MsgBox (sMsg)
 End Sub
VB.NET

 'Specify a variable to handle the event. 
  Private WithEvents wds As WeibullDataSet

 '---------------------------- 
 Private Sub Main()
   'Associate the event variable with an object. 
    wds = New WeibullDataSet

   'Set the application to use your event procedure. 
    wds.UseEvents = True

   'To trigger the event, call the Calculate method without defining a data set.  
    wds.Calculate
    Msgbox("End")
 End Sub

 '---------------------------- 
 Private Sub wds_GetDistrParameters(sMsg As String, _
                                    InputInfo As DistrParametersInput, _
                                    ByRef Cancel As Boolean) Handles wds.GetDistrParameters
    '<Add code here to handle the event.> 
    MsgBox (sMsg)
 End Sub