|
||||||||||||||||
Fast, High-Speed, Real-Time Display ComponentsKINETICART.CONTROLS.USING CONTROL COMPONENTS KineticaRT Controls are all based on Microsoft's Windows Forms Controls and may be used anywhere a Forms Control may be used. The following text describes how to use them within Microsoft Visual Studio and within a KineticaRT Frame Control. The KineticaRT Dial Control is used as an example throughout but all KineticaRT Controls work in the same way. Installing the ControlsTo install the control, run its installer (setup application) which is available on the KineticaRT web site at http://www.kineticart.co.uk. This will install the executable code into the selected installation directory; typically "C:\Program Files\KineticaRT Ltd\KineticaRT.Controls.Dial" At this point, the control is unlicensed. Most of the KineticaRT Controls require a design time license. You will be asked to enter this the first time you attempt to build your product. If you enter an incorrect license code or no code at all, the control will still work normally but will have the word "demo" written across it. If you develop a product without a license, then rebuild entering the correct license code the "demo" message will disappear and your controls will work normally. Using Microsoft Visual Studio - Visual Basic or C#Making the control availableThe control must be added to your projects references list by right clicking on the project and selecting "Add Reference". The following three files must be added:
Adding the control to a formSelect the control from the toolbox and drop it on the form. It can then be resized and repositioned using the drag handles. Configuring the controlUse the properties window. here will be many properties, they will vary between controls and so cannot be described here. The properties are arranged in groups, most of which are common between controls. Selecting a property will display a description and explanation of it at the bottom on the properties window. Setting the controls valueYou may set the "Value" property in the properties window at design time. You may also set the "Value" property from your code at run time. Connecting the control to a channelInstead of continually having to set the "Value" property in order to update the control, you can connect the control to a KineticaRT Channel object using the "SourceChannel" property during initialization. The control will then automatically update its value every time the channel objects value changes. There are a wide range of KineticaRT Channel objects including OPC Client items which collect data from OPC servers (see the Servers section) and the KineticaRT Expression object (see the Logic section) all of which can be connected to a display control using the source properties or to output controls such as the Slider and Button using the destination properties. Using this method you need to Initialises the control but don't need to write any code to update it. This generally makes applications far simpler to write, provides more efficient processor usage and provides multi-threading, and thus real-time performance, without having to do any work. Auto connection to a channel listConnect the control to a KineticaRT Channel using the "Source" property. This property takes the name of a channel; the control will generate an "ObjectSearch" event when it wants to find the channel. You must then provide some code to handle the event which given a channel name has to return the appropriate channel. This has the advantage that if the "AllowDrop" property is set then channel names may also be dragged and dropped onto the control at run time; it will then be able to connect itself. Auto configurationIf the control has its "SourceChannel" or "Source" properties set, and the "UseSourceFormat" is set true then it will use the properties of the channel object to automatically configure itself. If the Control is a KineticaRT.Controls.Dial control and the channel is a KineticaRT.Channels.NumericChannel then the dial can set its description, tool tip, scale minimum and scale maximum properties to provide a sensible display for any channel dropped onto it at runtime. The amount of auto-configuration will depend on which control is used and on to what sort of channel it is connected. Using a KineticaRT Frame ControlMaking the control availableThe control must be added to the frames references list by editing the frames "AddList" file. The following three files must be added:
Adding the control to the frameSelect the control from the right click menus add list and drop it on the frame. It can then be resized and repositioned using the drag handles. Configuring the controlUse the frame's right click menu to select the properties window. There will be many properties, they will vary between controls and so cannot be described here. The properties are arranged in groups, most of which are common between controls. Selecting a property will display a description and explanation of the property at the bottom of the properties window. Setting the controls valueNormally the value will be set by connecting the control to a channel; however, you may set the "Value" property in the properties window at design time. Auto connection to a channel listYou can set the "Source" property of the control to the name of a channel. The control will ask the frame to look up the channel using the channel name. If the "AllowDrop" property is set then the control will also ask the frame to look up any channels dropped onto it. Note that the frame must have a way of looking up the channel based on its channel name; it will use the "ObjectSearch" event to do this. How this event is handled depends on where the Frame is being used. If you are using KineticaRT Studio it will have been handled for you, if you have put the frame onto a Visual Studio form then you should write an event handler to handle the event. Auto configurationIf the control has its "Source" property set, and the "UseSourceFormat" is set to true, then it will use the properties of the channel to which it is connected to automatically configure itself. The amount of auto-configuration will depend on which control is used and on the type of channel to which it is connected. For example, if the Control is a KineticaRT.Controls.Dial control and the channel is a KineticaRT.Channels.NumericChannel then the dial can set its description, tool tip, scale minimum and scale maximum properties to provide a sensible display for any channel dropped onto it at runtime. |
|
|
||