ChangeEditMode - cWebView

Sets a drilldown view's edit mode and updates the enabled state of the DEOs

Type: Procedure

Parameters: Boolean bEdit

ParameterDescription
bEditPass True to make a view editable, False to disallow editing.


Syntax
Procedure ChangeEditMode Boolean bEdit

Call: Send ChangeEditMode bEdit


Description

Sets a drilldown view's edit mode and updates the enabled state of the data entry objects (DEOs).

ChangeEditMode is used to change the edit mode of a drilldown view (peWebViewStyle = wvsDrilldown). The bEdit parameter determines if the view should be editable (True) or read-only. The pbEnabled state of all DEOs will be updated to reflect this change.

When a drilldown view is navigated to, the tWebNavigateData member bReadOnly can be set to make a True inside of OnGetNavigateForwardData. All DEOs within the view will be enabled or disabled appropriately to represent this.

After the view has been activated, you can change this state by calling ChangeEditMode.

You can determine a view's read-only state by calling IsViewReadOnly.

Note that this should only be used with drilldown style views.

// The Invoking object makes the view read-only 
Procedure OnGetNavigateForwardData tWebNavigateData ByRef NavigateData Handle hoToView
       Move True to NavigateData.bReadOnly
End_Procedure

// This action button could be added to the invoked view, to change its edit state
Object oEditBtn is a cWebMenuItem
    Set psCaption to "Edit"
    Set psCSSClass to "WebEditMenuItem"
    Procedure OnClick
        Send ChangeEditMode True
    End_Procedure
End_Object

// This action button could be added to the invoked view, to toggle its edit state
Object oEditBtn is a cWebMenuItem
    Set psCaption to "Edit"
    Set psCSSClass to "WebEditMenuItem"
    Procedure OnClick
        Boolean bIsViewReadOnly
        Get IsViewReadOnly to bIsViewReadOnly
        Send ChangeEditMode bIsViewReadOnly // note True is enabled, False disabled. So this toggles 
    End_Procedure
End_Object


If you set pbClearAfterSave to False and don't close a cWebView after saving, you probably want to send ChangeEditMode False from OnViewSaved, so that after a save, edit mode is disabled again until the user endables it again.

Procedure OnViewSaved Handle hoServer Boolean bChanged
    // re-disable edit mode
    Send ChangeEditMode False
End_Procedure