Navigation:  DataServer Classes > DaoServer Class >

DaoServer:Notify() Method

Previous pageReturn to chapter overviewNext page

Purpose

An event handler that responds to events that have occurred in methods of this server, or in other servers that are linked to this server in some way.  The standard implementation notifies all the server's clients of the event.

 

Important!        This method is automatically called by the various action methods of the data server, and should normally not be called by application code.

 

Parameters

kNotifyNameIdentifies the event, specified as one of the following constants:
uDescriptionUsed only with some notification types, as described below.

 

ConstantRefers To

 

NOTIFYAPPENDA blank record has been appended; the server is still positioned on this record, and its values have not been finalized.
NOTIFYCLEARRELATIONA relation between servers is being cleared
NOTIFYCLOSEThe server intends to close itself.
NOTIFYCOMPLETIONThe server has completed some large operation that did not involve repositioning of the server or change to the data (such as reindexing).  This gives the browser a chance to update visual indication to the user that some operation has been completed.  In this situation, <uDescription> is the name of the method that was just completed, as a symbol.
NOTIFYDELETEThe current record has been deleted, and the server is now positioned according to its rules for how a deletion is handled.  The clients should refresh their displays accordingly.
NOTIFYFIELDCHANGEA field has changed.  <uDescription> is the field name as a symbol.  Note that some clients may not have a field with the indicated name: the server knows only that it has a field of that name and that it changed, and it notifies its clients in case they are interested.
NOTIFYFILECHANGEThe server has executed some method that perform many changes to the data; all the clients' knowledge about the server and its data is potentially obsolete, and they should refresh all information from the server and all calculations that depend on the data or its position.
NOTIFYGOBOTTOMThe server has moved to its last record.  Many clients treat this merely as a record change, but for some types of clients positioning to the end is treated as a special case.
NOTIFYGOTOPThe server has moved to its first record.  Many clients treat this merely as a record change, but for some types of clients positioning to the top is treated as a special case.
NOTIFYINTENTTOMOVEThe server intends to make a move.  The clients should make sure that all their data is saved, if necessary, before the movement is done.  In the data window and data browser, the standard implementation checks validation status:  if the client contains data that is invalid, the user has a choice of correcting the errors or discarding the data.
NOTIFYRECORDCHANGEThe record position of the server has changed.  <uDescription> might indicate the length of the move (the number of records).  The clients can use this information for display optimization, but cannot rely on its availability.
NOTIFYRELATIONCHANGEThe server has been made the child in a relation with another server, or the parent in a relationship has repositioned itself.  All information about the server is potentially obsolete.

 

Returns

NIL except if NOTIFYINTENTTOMOVE is specified for <kNotifyName>.

In this case, the return value is TRUE if successful; otherwise, FALSE.

 

Description

This method is at the heart of the automatic notification among linked windows and servers.  When certain actions are performed on a data server, the methods that perform those actions automatically call their Notify() method upon completion of the action.  The data server then sends a broadcast Notify message to all of its clients to notify them of the action.

This ensures that all clients (for example, data windows or data browsers) remain in sync with their underlying servers and reflect the change (for example, update a field value or add a new record).

 

Any class that is registered as a client of a server must respond intelligently to these Notify messages.

In some cases, the notification may come from another object rather than from a method of the same server object.  Relations among servers, for example, cause file change notifications to be sent from the parent to the child server.

As always with defined constants, you should never rely on the actual values of the constants--they will not necessarily stay the same.  However, the constants do maintain their order:

 

ConstantValue Level
NOTIFYFIELDCHANGELowest
NOTIFYCLOSE...
NOTIFYCOMPLETION...
NOTIFYINTENTTOMOVE...
NOTIFYRECORDCHANGE...
NOTIFYGOBOTTOM...
NOTIFYGOTOP...
NOTIFYDELETE...
NOTIFYAPPEND...
NOTIFYFILECHANGE...
NOTIFYRELATIONCHANGE...
NOTIFYCLEARRELATIONHighest

Thus, you can reliably write:

 

IF    kNotifyName > NOTIFYINTENTTOMOVE;

 

.AND. kNotifyName < NOTIFYFILECHANGE

 ... // Only record level moves

ENDIF

 

 

Class

DaoServer