Difference between revisions of "Midware TMWTable"

From Overbyte
Jump to navigation Jump to search
Line 61: Line 61:
 
== Events ==
 
== Events ==
 
{|
 
{|
| width="140" valign="top" | [[Midware_TMWTable.OnAfterProcessRequest | OnAfterProcessRequest]] |||| The OnAfterProcessRequest is called when a request has been processed by a [[Midware_TAppServer.TServerObject | TServerObject]].
+
| width="140" valign="top" | [[Midware_TMWTable.AfterCancel | AfterCancel]] |||| Write an AfterCancel event handler to take specific action after an application cancels changes to the current record.  
 
|-
 
|-
| valign="top" | [[Midware_TMWTable.OnAfterSendReply | OnAfterSendReply]] |||| The OnAfterSendReply event is called once the reply header and body has ben written to the internal buffer for sending in the background.
+
| valign="top" | [[Midware_TMWTable.AfterClose | AfterClose]] |||| Write an AfterClose event handler to take specific action immediately after an application closes a dataset.
 
|-
 
|-
| valign="top" | [[Midware_TMWTable.OnBeforeProcessRequest | OnBeforeProcessRequest]] |||| The OnBeforeProcessRequest event is triggered just before anything is done with a request received from the client.
+
| valign="top" | [[Midware_TMWTable.AfterDelete | AfterDelete]] |||| Write an AfterDelete event handler to take specific action immediately after an application deletes the current record in a dataset.
 
|-
 
|-
| valign="top" | [[Midware_TMWTable.OnBeforeSendReply | OnBeforeSendReply]] |||| The OnBeforeSendReply event is called when a reply is ready to be transmitted to the client.  
+
| valign="top" | [[Midware_TMWTable.AfterEdit | AfterEdit]] |||| Write an AfterEdit event handler to take specific action immediately after dataset enters edit mode.
 
|-
 
|-
| valign="top" | [[Midware_TMWTable.OnClientConnected | OnClientConnected]] |||| This event is triggered when a client connect to the server.
+
| valign="top" | [[Midware_TMWTable.AfterInsert | AfterInsert]] |||| Write an AfterInsert event handler to take specific action immediately after an application inserts a record.  
 
|-
 
|-
| valign="top" | [[Midware_TMWTable.OnClientClosed | OnClientClosed]] |||| Occurs when a client disconnect from the server.  
+
| valign="top" | [[Midware_TMWTable.AfterOpen | AfterOpen]] |||| Write an AfterOpen event handler to take specific action immediately after an application opens the dataset.
 
|-
 
|-
| valign="top" | [[Midware_TMWTable.OnClientCommand | OnClientCommand]] |||| Clients connects to the server to send commands (also called requests) and wait for server responses.  
+
| valign="top" | [[Midware_TMWTable.AfterScroll | AfterScroll]] |||| Write an AfterScroll event handler to take specific action immediately after an application scrolls to another record as a result of a call to the First, Last, MoveBy, Next, Prior, FindKey, FindFirst, FindNext, FindLast, FindPrior, and Locate methods.
 
|-
 
|-
| valign="top" | [[Midware_TMWTable.OnClientTimeout | OnClientTimeout]] |||| When a client had no more activity during some time specified by the ClientTimeout property, it is automatically disconnected. If this occurs, the OnClientTimeout event is triggred.
+
| valign="top" | [[Midware_TMWTable.BeforeCancel | BeforeCancel]] |||| Write a BeforeCancel event to take specific action before an application carries out a request to cancel changes.  
 
|-
 
|-
| valign="top" | [[Midware_TMWTable.OnClientBgException | OnClientBgException]] |||| Client communication is handled by a TWSocket descendent component which works in the background.  
+
| valign="top" | [[Midware_TMWTable.BeforeClose | BeforeClose]] |||| Write a BeforeClose event to take specific action before an application closes a dataset.  
 
|-
 
|-
| valign="top" | [[Midware_TMWTable.OnDisplay | OnDisplay]] |||| Sometimes, the server can display some infos about his internal working.
+
| valign="top" | [[Midware_TMWTable.BeforeDelete | BeforeDelete]] |||| Write a BeforeDelete event handler to take specific action before an application deletes the current record.
 
|-
 
|-
| valign="top" | [[Midware_TMWTable.OnServerBgException | OnServerBgException]] |||| The OnBgException event is triggered when an exception occurs in the background (occuring in an event handler called from the message pump).
+
| valign="top" | [[Midware_TMWTable.BeforeEdit | BeforeEdit]] |||| Write a BeforeEdit event handler to take specific action before an application enables editing of the current record.  
 
|}
 
|}

Revision as of 13:56, 6 May 2011

Main page -> Midware component reference -> TMWTable

Overview

unit MWdatSet.pas

TMWTable component is much like standard Delphi TTable or TQuery components. TMWTable is used as an interface between data and your program or visual interface.

TMWTable is a TDataSet descendent so you can use it with data-aware controls such as TDBEdit and TDBGrid. Just like you use TQuery or TTable.

TMWTable is an interface that present MidWare communication buffer (TMWBuffer component) as a standard Delphi data table. It let you navigate thru all records and fields. You can and locate data, insert, delete or edit data. TMWTable has no storage for data: all data is stored in TMWBuffer component.

TMWTable has no knowledge of table structure. You must specify it using FieldLayout property. You can fill this property at design time if you know what it will be at runtime, or you may fill it at runtime once you know the value. The value may be known at runtime because your client application query the application server for field layout. You may also sent field layout in first record in result set, feed it to the property and then delete it from result set.

Properties

Active Active property is TRUE when TMWTable is opened and FALSE when TMWTable is closed.
AppSrvClient To execute a request at design time, TMWTable need an TAppSrvClient component which will handle communication with MidWare application server.
AutoCalcFields Set AutoCalcFields to control when the OnCalcFields event is triggered to update calculated fields during dataset processing.
CanModify CanModify readonly property returns TMWTable ReadOnly value.
Data Data property is a link to TMWBuffer component used to hold all data.
FieldLayout FieldLayout property is used to describe columns content.
FunctionCode FunctionCode and Params properties are the design time request. It's main purpose is to populate data aware controls link to TMWTable at design time. It can also be executed at runtime using ExecuteRequest.
MWBufferFieldCount The number of fields. Based on FieldLayout property.
ReadOnly ReadOnly property is used to get or set TMWtable read only status. See also CanModify.
RecordSize The record size property gives the size of the record.
Params FunctionCode and Params properties are the design time request.
TimeOut When executing a request at design time, TMWTable will stop waiting for answer after Timeout seconds.

Methods

Close Close the communication with the application server.
CreateBlobStream Call CreateBlobStream to obtain a stream for reading and writing the value of the field specified by the Field parameter.
DesignTimeRequest DesignTimeRequest procedure will execute the request specified at design time.
ExecuteRequest Call ExecuteRequest procedure to execute design time request.
Locate Implements a method for searching a dataset for a specified record and makes that record the current record.
Lookup Implements a method to retrieve field values from a record that matches specified search values.
Send Send a FunctionCode and Request (parmeters) to the application server.

Events

AfterCancel Write an AfterCancel event handler to take specific action after an application cancels changes to the current record.
AfterClose Write an AfterClose event handler to take specific action immediately after an application closes a dataset.
AfterDelete Write an AfterDelete event handler to take specific action immediately after an application deletes the current record in a dataset.
AfterEdit Write an AfterEdit event handler to take specific action immediately after dataset enters edit mode.
AfterInsert Write an AfterInsert event handler to take specific action immediately after an application inserts a record.
AfterOpen Write an AfterOpen event handler to take specific action immediately after an application opens the dataset.
AfterScroll Write an AfterScroll event handler to take specific action immediately after an application scrolls to another record as a result of a call to the First, Last, MoveBy, Next, Prior, FindKey, FindFirst, FindNext, FindLast, FindPrior, and Locate methods.
BeforeCancel Write a BeforeCancel event to take specific action before an application carries out a request to cancel changes.
BeforeClose Write a BeforeClose event to take specific action before an application closes a dataset.
BeforeDelete Write a BeforeDelete event handler to take specific action before an application deletes the current record.
BeforeEdit Write a BeforeEdit event handler to take specific action before an application enables editing of the current record.