Procedure NavigatePath
Call: | Send NavigatePath |
Performs the navigation registered for this web object.
This message should be sent to the invoking object to perform the forward navigation. If multiple paths are specified with the object as invoking object, then an error will be thrown, in that case NavigateForward should be called on the view to perform the navigation.
Use WebRegisterPath to register a navigation path.
Object oNewButton is a cWebMenuItem Set psCaption to "New Product" Set psCSSClass to "WebClearMenuItem" WebRegisterPath ntNavigateForward oZoomInventory Procedure OnClick Send NavigateForward of oZoomInventory Self End_Procedure Procedure OnGetNavigateForwardData tWebNavigateData ByRef NavigateData Handle hoToView Move True to NavigateData.bNewRecord End_Procedure End_Object
The code example above shows how a navigation path is registered on a menu item that navigates into the oZoomInventory view, to create a new inventory item. In this code example the zoom view and navigation type are specified twice, which is slightly inconvenient. To get around this a new navigation message is now available called NavigatePath which will execute the path registered for the object. This changes the code into the following:
Object oNewButton is a cWebMenuItem Set psCaption to "New Product" Set psCSSClass to "WebClearMenuItem" WebRegisterPath ntNavigateForward oZoomInventory Procedure OnClick Send NavigatePath End_Procedure Procedure OnGetNavigateForwardData tWebNavigateData ByRef NavigateData Handle hoToView Move True to NavigateData.bNewRecord End_Procedure End_Object
Each navigation path gets a name that has to be unique for the invoking view. By default, the command uses the psStateViewName of the navigate forward view. If there are multiple paths to this view from the invoking view, this will be extended with an auto-number. Because the oSelectInventory view, which contains the button used in the samples above, already has the oList object that allows to navigate to existing inventory items, this results in the `/WebOrderMobile_19_1/Index.html#Inventory/Product2' URL when using the oNewButton. The optional fourth parameter of the WebRegisterPath command can be used to customize the name.
Object oNewButton is a cWebMenuItem Set psCaption to "New Product" Set psCSSClass to "WebClearMenuItem" WebRegisterPath ntNavigateForward oZoomInventory Self "NewProduct" Procedure OnClick Send NavigatePath End_Procedure Procedure OnGetNavigateForwardData tWebNavigateData ByRef NavigateData Handle hoToView Move True to NavigateData.bNewRecord End_Procedure End_Object
This changes the URL into `/WebOrderMobile_19_1/Index.html#Inventory/NewProduct'.
See Also