OnGetNavigateForwardData - cWebObject

Can be used by the developer to customize the data in tWebNavigateData during forward navigation in a mobile web application (drilldown interface)

Type: Event

Parameters: tWebNavigateData ByRef NavigateData Handle hoToView

ParameterDescription
NavigateData (ByRef)tWebNavigateData variable that can be manipulated in this event
hoToViewHandle of the object being navigated to


Syntax
Procedure OnGetNavigateForwardData tWebNavigateData ByRef NavigateData Handle hoToView

Description

When NavigateForward is sent to a view in a mobile web application (drilldown interface), the view will initialize the tWebNavigateData variable and send OnGetNavigateForwardData to the invoking object.

This event can be used by the developer to customize the data.

It is passes the navigation data in NavigateData. This is passed by reference, allowing the developer to make changes.

This can be used to designate that the view should be read only or new. The following would show the Zoom view with all DEOs disabled:

Procedure OnClick String sButton String sRowId
    Send NavigateForward to oZoomCustomer Self
End_Procedure

Procedure OnGetNavigateForwardData tWebNavigateData ByRef NavigateData Handle hoToView
    Move True to NavigateData.bReadOnly
End_Procedure

This would be used if you wanted to show a Zoom view for new record entry:

Procedure OnClick String sButton String sRowId
    Send NavigateForward to oZoomCustomer Self
End_Procedure

Procedure OnGetNavigateForwardData tWebNavigateData ByRef NavigateData Handle hoToView
    Move True to NavigateData.bNewRecord
End_Procedure


Note that OnGetNavigateForwardData is sent to the invoking object. This is the hoInvokingObject parameter that is passed to NavigateForward. The OnGetNavigateForwardData is added to the cWebBaseUIObject, which means that it is directly resolved by most web objects without the need to delegate.

The default behavior is to do nothing.

Using Custom Data and the NameValue Pair Array


During forward and back navigation additional data may be passed back and forth between views using the name/value pair array in the tWebNavigateData type. The paired data consists of a case insensitive name and a value. The data is added and searched for by name. NamedValueAdd is used to add data and NamedValueGet is used to find a value for a name. The developer has complete control over what data is entered and how that data is used.

During forward navigation the name/pair data will be set in the OnGetNavigateForwardData event. The data can be used to customize the new view's behavior using the OnNavigateForward event. It can also be accessed any time using GetNavigateData to access the tWebNavigateData instance. During back navigation, the name/value data will be passed back. It can be changed using the OnGetNavigateBackData event and used by the OnNavigateBack event.

This data allows the developer to pass and use any kind of data they wish. It will be used most often when the navigate From-Type is From-Undefined.

The data is stored in the tWebNavigateData struct in the NamedValues member. The NamedValue member is an array of type tNameValuePair, which is defined as follows:

Struct tNameValuePair
    String sName
    String sValue
End_Struct

While you may use the data in this struct member array directly, you are encouraged to use the NamedValueAdd and NamedValueGet interfaces defined in the cWebObject class.


An important debugging tip: You can check the eNavigateType member in the tWebNavigateData struct to see what the navigate From-Type was set to. The best place to view this is in the OnGetNavigateForward event, as this value is determined and set right before the event is called.

hoToView Handle

hoToView is the handle of the object being navigated to. In most cases, you will know what that handle is already, which is why we did not originally include this. However, in more complicated view navigations you may need to use this to know exactly where you are navigating to:

Procedure OnClick
     If (someKindOfTest) Begin
          Send NavigateForward of oMyList1 Self
    End
    Else Begin
          Send NavigateForward of oMyList2 Self
    End 
End_Procedure

Procedure OnGetNavigateForwardData tWebNavigateData ByRef NavigateData Handle hoToView
     If (hoToView=oMyList1) Begin
          // do this.
    End
    Else Begin
          // do that
    End 
End_Procedure

This will be rarely needed.

See Also

OnGetNavigateBackData | GetNavigateData