Provide an AddressAssist Module
A driver may provide a custom AddressAssist module to assist the user in building addresses when configuring I/O tags. An example may be seen in any I/O tag that is using an SNMP or OPC Client driver.
The module is commonly stored in its own file, with a unique name matching the driver it is meant for, but within the driver itself it must be declared using the name "AddressAssist". The PAddressEntry function (used in the I/O tag's configuration) will check for the existence of an AddressAssist module and (if found) display your code instead of the usual edit field.
The AddressAssist must provide the code for the user interface elements that will be displayed in the I/O tag's configuration panel as well as whatever user-interface tools will be provided to help the developer to select the address. For the configuration panel element, you may:
- draw an edit field with a browse button (as shown in the preceding example),
- create a drop-list or drop-tree with possible addresses,
- create any other address selector that fits within the space of the usual edit-field for address entry.
A simplified example of an AddressAssist module follows.
{======================= AddressAssist ===================================} { A custom address selection module for a driver. It consists of } { the usual edit field, along with a button that launches an } { address browser. } {=========================================================================} ( Left { The left coordinate of the address assist }; Bottom { The bottom coordinate of the address assist }; Right { The right coordinate of the address assist }; Top { The top coordinate of the address assist }; Var { The variable that we're going to set }; SupportedData { Digital, Analog, or Text }; FunctionType { Read/Write }; ID { Focus ID of the editfield }; Trigger { Set when var changed }; BGColor { Background color to use in the edit field }; FGColor { Foreground color to use in the edit field }; ) Main [ { Display the edit field with a Browse button } System.Edit(Left, Top, Right - SmlBtnWd - Space, Bottom + EditHt { Coordinates }, Invalid, Var, ID, Trigger, Invalid, 4 {Text}, 0 { no bevel }, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, BGColor, FGColor); If GUIButton(0, 1, 1, 0 { Unit box }, 1 - (Right - SmlBtnWd) { 1 - Left }, Top + BtnHt { Bottom }, Right { Right }, 1 - (Top) { 1 - Top }, 1 { Scaling }, 0, 0 { Movement }, 1, 0 { Visibility, Reserved }, PickValid(ID, 1) != 0 ? 68 : 0, PickValid(ID, 1), 0 { Selectability }, ButtonFace, ButtonShadow, ButtonHighlight, ButtonTextColor { Colors }, 0, 0 { Sides, Reserved }, "...", "..." { UpLabel, DownLabel }, _DialogFont, 0, 1, 2 { Font, DownValue, UpValue, Variable}, SmallButtonImgs); [ { Implement custom code here to display your address browser } ] Return(TRUE); ]