The CE WinForm Renderer only has a few methods and properties. It is intended to be a simple control that can be used with a minimum of effort.
In keeping with this philosophy, the properties, methods and events have been kept to the minimum. The following section lists describes them all.
Properties
The properties of the CE WinForm Renderer can be set via the Properties Window of the Visual Studio forms painter or in your client code.
Most properties relate to items required to identify and connect to the host runtime system. Some properties are used for identifying a download web server, from which missing or updated Generated Forms can be sourced. Other properties allow control over the behaviour of the rendered forms.
All the properties are described in the following table:
Property | Description |
---|---|
ApplicationName | The name of the runtime application used in the generation. |
BundleName | The name of the bundle used in the generation |
ConnectionMode | This effects the values of GLB.GUI and GLB.STYLE in the runtime logic. |
DefaultImagesSubDirectory | The sub-directory to look for any image file in. This is also be used as the location to download any images from the download server. |
Domain | The domain the usercode and password relate to. |
DownloadDestination | The location to download the IspecModel files to on the client. This is also used as the location to load the IspecModel files from on the host. |
DownloadServerURL | The URL of the download server with the IspecModel and Windows Forms. If this is not blank, a check for newer versions of the files is done when an ispec is first encountered in a session. |
GIWCompatibleBehaviourFlag | If set to true, on ispecs with more than one button group, pressing a button in one button group will blank out the values from all other button groups. |
Name | The name of the system for display purposes. |
PackagePrefix | The package prefix that was used in the generation. |
PackagePrefix | The package prefix that was used in the generation |
Password | The password to go with the User Name. |
PropagateLostFocusEvent | If set to true, lost focus events from rendered forms will be sent through to the clients event handler routine. Note: This particular property can only be set via code. |
RATLStartVersion | The RATL version to start connecting with. By default, CE tries to connect with the latest version it knows about. If the host RATL Server does not know about that version, it rejects the connection. The client then tries with a lower version. This repeates until a mutually acceptable version is found. This can slow down the logon process. In such cases, set the start version to one that the host RATL Server knows. This particular attribute can only be set via code. |
URL | The URL of the host runtime. This is in the form <protocol>:<hostname>:<port number>, for example, x-ratl:myHost:2889 or x-ratlssl:myHost:2889. |
UserName | The user name to log onto the host with. |
ViewName | The view name defined on the host to connect to the runtime system. |
Methods
All the methods are described in the following table:
Method | Description |
---|---|
int AutoConnect() | If all properties relating to connecting and logging into the runtime host have been set correctly, this method connects, logons and returns the fireup Ispec ready to render. It returns a CE Response code to indicate success or failure |
int DisplayIspec() | This method displays the current Ispec as known by the Session. If there is no Current Ispec, a list of ispecs in the bundle is shown. |
bool ShowErrorsOrStatus(bool showInDialog) | This method shows the current errors in the LINCStatus object. Generally, there should be a menu item on the client to call this method, so that users can retrieve the error list if they accidentally close it. |
Events
The CE WinForm Renderer raises four types of events while it is processing forms. The client might optionally intercept these events, examine data, take control of the session, or allow the CE WinForm Renderer to continue processing.
The client programmer needs to add their own event handler, and then wire it to the event processing of the CE Form Renderer. Each Event passes a CEFormEventArgs object. The contents of this object change depending on the type of event.
All the events are described below:
This event is raised whenever the CE Forms Renderer wants to show a status line message, or error messages. The client program should show any status line data in its own status line. (The CE WinForm Renderer does not have a status line.) The client program can optionally show any errors itself.
If this event is not canceled, the CE Forms Renderer shows any errors, but is unable to show any status messages as forms do not have status lines.
To intercept this event, the client must write an event handler that matches the event Delegate:
StatusLineEventHandler().
To stop the CE Forms Renderer from showing error messages, set the BypassStatusHandling attribute of the CEFormEventArgs to true.
Example client event handler. (Visual Basic.NET)
Sub SetStatusLine(ByVal sender As Object, ByVal e As PrototypeCEFormRenderer.CEFormEventArgs) Handles sampleSys.StatusLineEvent this.myStatusLine.Text = e.ObjStatus.Status End Sub
The PreTransactionEvent is sent before the CE Forms Renderer calls the CE Transaction() method to send data to the host.
If intercepted, the client programmer can access the Session and Status objects, and manipulate the data, for example, to check the data the user has just entered, change that data if required, send one or more transactions to the host, etc..
You can alter the normal processing of the CE WinForm Renderer by the CEFormEventArgs object.
By setting the CancelFormRendering attribute of the CEFormEventArgs to true, the client programmer can stop the CE WinForm Renderer processing, and can take control of all processing.
By setting the BypassTransaction attribute of the CEFormEventArgs to true, the client programmer can tell the CE WinForm Renderer to skip the actual call to the CE Transaction() method, and to continue processing as if the CurrentIspec and Status objects have been returned from the host. (that is, the client programmer has manipulated the data in some way, and wants the CE WinForm Renderer to show the resulting form.)
Note: If the client programmer bypasses the transaction() method by setting BypassTransaction attribute to true, the PostTransactionEvent is NOT be raised.
If the client programmer bypasses the transaction method, the ReturnCode of the CEFormEventArgs should be set to an appropriate value. Refer to CEWindowsAPI.ResponseCodes class for values to use.
In General, this is 100 for an ok.
By setting/leaving both values as false, the CE WinForm Renderer carries on processsing as normal. (transmitting any new data the client programmer might have altered, to the host)
Example client event handler. (Visual Basic.NET)
Sub ProcessPreTransactionEvent(ByVal sender As Object, ByVal e As PrototypeCEFormRenderer.CEFormEventArgs) Handles sampleSys.PreTransactionEvent Set CurrIspec = e.Session.CurrentIspec if CurrIspec.getFieldValue("ACTION") = "DRT231" then CurrIspec.setFieldValue("ACTION", "DRT123") end if End Sub
The PostTransactionEvent is sent after the CE Forms Renderer has called the Transaction() method.
Note: If the client programmer bypassed the transaction() method in the PreEventTransaction (that is, they processed the transaction themselves) the PostTransactionEvent is not raised.
If intercepted, the client programmer can access the Session and Status objects, and manipulate the data. that is, check the data the host has just returned, change that data if required, send one or more transactions to the host, etc. You can alter the normal processing of the CE WinForm Renderer by the CEFormEventArgs object.
By setting the CancelFormRendering attribute to true, the client programmer can stop the CE WinForm Renderer processing, and can take control of all processing.
By setting/leaving the value as false, the CE WinForm Renderer carries on processsing as normal. (using any new data the client programmer might have altered)
The client programmer can examine or change the response code by accessing the ReturnCode attribute of CEFormEventArgs.
Example client event handler. (Visual Basic.NET)
Sub ProcessPostTransactionEvent(ByVal sender As Object, ByVal e As PrototypeCEFormRenderer.CEFormEventArgs) Handles sampleSys.PostTransactionEvent Set CurrIspec = e.Session.CurrentIspec if CurrIspec.Name = "CUST" then users of this client not allowed to see customer addresses. CurrIspec.setFieldValue("POSTADDR1", "Not Available") CurrIspec.setFieldValue("POSTADDR2", "") CurrIspec.setFieldValue("POSTADDR3", "") end if End Sub
The LostFocusEvent must first be enabled before the client programmer can intercept the event. This enabling is required as raising extra events on every object of a form can degrade performance.
To enable this event, you need to set the CEFormRenderer.PropegateLostFocusEvent to true. This particular attribute can only be set in your clients code.
For example, sampleSys.PropagateLostFocusEvent = True
If intercepted, the client programmer can access the object that was sent the LostFocus event, and retrieve or alter the value of that item. The object that was sent in the LostFocus event is contained in the CEFormEventArgs SenderControl attribute.
While the Session and Status objects are available in this event, note that the individual GUI controls does not have set their values into the back end at this time. that is, if you want to check one fields value against another, you must interrogate the GUI controls directly. You cannot use the current ispec, as the values represented in it, and the GUI controls is likely to be different. (data is only transferred when a transmit is done)
The CEFormEventArgs is a class with a collection of objects that is passed in each event. Not all attributes of the CEFormEventArgs are populated for every event. Before using any particular attribute, check that it is used in the particular event that you are processing. Attribute
Attribute | Description |
---|---|
BypassStatusHandling | A boolean value to indicate that the CE WinForm Renderer should not display any error message dialog to show errors that have been raised as a result of this transaction. Valid in StatusLineEvent, PreTransactonEvent and PostTransactionEvent. Default value is false. |
BypassTransaction | A boolean value to indicate that the CE WinForm Renderer should not call the transaction() method, but should continue processing as if the transaction had already happened. It is expected that the client programmer have manipulated the Session object to provide an altered Current Ispec, and/or Status object. Valid in PreTransactionEvent. Default value is false. The client programmer should also set the ReturnCode to an appropriate value for subsequent processing. Refer to the CEWindowsAPI.ResponseCodes for a list of values. |
CancelFormRendering | A boolean value to indicate that the CE WinForm Renderer should cease processing, and HIDE the form to prevent any further user interaction. (The CE WinForm Renderer can be reactived by calling DisplayIspec() again) The CE WinForm Renderer is still valid, and its Session object can be used by the client programmer, it is just not visible. Valid in PreTransactionEvent and PostTransactionEvent. Default value is false. |
EventType | A string to indicate what sort of Event this CEFormEventArgs was sent for. |
HostFieldName | A string to indicate the Host Field Name of the GUI object that just lost focus. Valid in LostFocusEvent. (null string in all other event types) |
ReturnCode | An integer value containing the most recent ResponseCode from the host. If the programmer intends to BypassTransaction, they should set the ReturnCode to an appropriate value for the data they are supplying in the CurrentIspec or Status object. If the programmer intends to change the data in a PostTransactionEvent, they should set the ReturnCode to an appropriate value. Valid in PreTransactionEvent and PostTransactionEvent. |
SenderControl | The control object that is raising the LostFocusEvent. Use this object to check the text or state of the object. You should check what type the object is before trying to interigate its values. Valid in LostFocusEvent. |
Session | The CE Form Renderers Session object. Passed in the event for convenience. Valid in PreTransactionEvent, PostTransactionEvent, LostFocusEvent and StatusLineEvent. |
Status | The CE Form Renderers Status object. Passed in the event for convenience. Valid in PreTransactionEvent, PostTransactionEvent, LostFocusEvent and StatusLineEvent. |
Objects
The CE WinForm Renderer has two objects that allow the user to control a session.
The Session object is a CEWindowsAPI.LINCEnvironment object. Using this object, the programmer can control the entire session, or just some parts.
The CE WinForm Renderer also has a Status object. This is a CEWindowsAPI.LINCStatus object, that the CE WinForm Renderer uses in all of its internal logic, that is, the Status objects have the results of all transactions performed by the CE Form Renderer.
For details of both these objects, refer to the CEWindowsAPI class reference.