How to Implement an Edit Mode

By default, VPM Enterprise forms do not require you to activate an edit mode to begin changing data on a form. When a VPM Enterprise form is displayed, you can freely change data. The changes are not commited, however, until you click the Save toolbar button. This style of data entry became popular with the introduction of Visual FoxPro and is preferred by most developers.

Some developers, however, prefer an edit mode for forms. An edit mode requires a user to click an Edit button before data can be changed.

VPM Enterprise provides form properties and toolbar classes that facilitate the implementation of an edit mode for a form. However, please read the “Edit Mode – What You See Is What You Get” section below.

Ø To implement an edit mode for a form

1.   Set the form’s lEditMode property to .T.

Tip: A form’s lEditModeOn property is set to .T. when edit mode is on and .F. when it’s not. You can use the lEditModeOn property in your code to check whether edit mode is on.

2.   Only those controls on the form whose lEnableDisableControl property is set to .T. are disabled when not in edit mode. A VPME control’s lEnableDisableControl property is set to .T. by default. You can make a VPME control editable while edit mode is off by setting its lEnableDisableControl property to .F.

3.   Set the DisabledForeColor property of controls to whatever color you desire. The default color is gray.

4.   Change the form’s cToolBar property to “Toolbar_All_Edit” to select the VPME toolbar class that has an Edit control.

Tip: If your form uses the VPME onform toolbar, use the “OnForm_Toolbar_Edit container class to select the VPME onform toolbar that has an Edit control. See the “How to Put the Toolbar Controls Directly on a Form” section earlier in this chapter.

Tip – nSetFocusToFirst_EditPage Property: When using an edit mode, the number in the nSetFocusToFirst_EditPage property of a form determines which page of a pageframe is activated when the Edit button is clicked. By default, the number is zero (0), and the currently active page remains the active page. However, you can change the number to force a particular page to become the active page when entering the edit mode.

Edit Mode – What You See Is What You Get

Please be aware that the edit mode functionality for forms in VPM Enterprise is intended only to provide basic edit mode functionality for those of you who need to implement an edit mode. Let us explain.

Only a few (very few) VPME Users want to implement edit mode functionality for forms in their applications. 

VPME gives users a helpful start if they needed to implement an edit mode. It may be that for most VPME users who need to implement an edit mode, the functionality that is provided will be all they need. We recognized that different users would want to implement an edit mode in different ways and that the best thing we could do in the VPME was to provide the basics and leave it up to VPME Users to extend the basic functionality as needed.

Accordingly, what you see in VPME with regard to the edit mode functionality is what you get. If you want to extend or modify the edit mode functionality, it is up to you to become familiar with what is there and modify/extend it as you desire. We will not:

·       Write or suggest code for you to modify the edit mode functionality to meet your needs. That's up to you.

·       Debug or provide technical support for your modifications to the edit mode functionality.

We do not encourage or promote the use of an edit mode. The edit mode is a thing of the past, and no software developer can afford to support the past for very long. However, if you must implement an edit mode for forms, there's a good chance that there will be some behaviors in various VPME form classes that you may want to change as you prefer. But please remember that you are on your own when it comes to making those changes.


Activating the Form Toolbar with No Application Toolbar