DoOperate

Description:

Used by tags that can be operated from the Tag Browser, this displays an input dialog where users can enter the new value to write.

Should be overridden for use with tags other than those that write analog, digital or string values.

Returns: Nothing
Usage: Script or steady state.
Function Groups: Variable
Related to: IsTagOperable
Format: \DoOperate(TagObj)
Parameters:  
TagObj
Required object value. The tag to be examined.
Comments:

For typical I/O tags that are operable, this will display a predefined dialog containing a widget that is appropriate for the tag instance.

If the tag in question contains its own DoOperate() submodule, that will be called instead.

Example

<
{============================= Report.DoOperate ==============================}
{ This is an override for the DoOperate window. The Report Tag doesn't fit    }
{ into the general set of output widgets so this module has its own custom    }
{ method to "Operate" this tag type.                                          }
{=============================================================================}
DoOperate

[
  PROTECTED ConfirmMsg        { Are you sure message for this tag             };
  PROTECTED WhichBtn          { Which button was chosen                       };
]

Main [
   { Get the output message, keeping up to date with current language }
  If Watch(1, GetUserLanguage());
  [
    ConfirmMsg = GetTagOutputConfirmMsg(Root, 1);
  ]

   { Ask the user if they are sure they want to do this }
  WhichBtn = \System\4BtnDialog(\System\Question_Icon { Icon },
                                GetPhrase("OKLabel"), GetPhrase("CancelLabel"), Invalid, Invalid { Buttons },
                                Name, ConfirmMsg, Invalid {Text},
                                1 { Open }, ! \NoModal { Modal },
                                0 { No Bold }, GetPhrase("AreYouSureLabel") { Title },
                                &MsgDlgXPos, &MsgDlgYPos,
                                2 { cancel btn }, 1 { def focus },
                                \DlgHelpFile, Invalid { No help });

   { A choice was made }
  If Valid(WhichBtn);
  [
     { They chose yes }
    IfThen(WhichBtn == 1,
       { Add the entry to the operator log }
      \OperatorLog\AddEvent(Name, 1);
       { Tell the tag to run the report }
      \Set(1);
    );

    Slay(Self);
  ]
]

{ End of Report.DoOperate }
>