Database Solutions - Hints & Tips

Tip 27:
Advanced use of the Edit Statement

Prior to UNIFACE 7.2.04, the only way to activate (for editing) UNIFACE’s Structure Editor was by placing an "Edit" statement in the EXECUTE trigger. In version 7.2.04, it is now possible to use the "Edit" statement in an operation, but only if followed by one of three new-subswitches - "/modal", "/nonmodal" or "/modal/deferred".

Normally, when the structure editor of a modal form is invoked via the EXECUTE trigger, that particular instance of the form can no longer be accessed once processing in the EXECUTE trigger has completed. If, however, the structure editor is invoked through an operation, the form will remain instantiated even after processing in that operation has completed. This means that the Structure Editor can be restarted at a later time.

Using the "edit" statement outside of the EXECUTE trigger without any of these subswitches will produce an error.

NB: Documentation for these subswitches only appears in versions of the Adobe Acrobat "PL2" manual dated March 25th 1999 or later.

Edit/modal

The "edit/modal" statement is only valid in modal forms. Once executed, the structure editor is activated, and control only returns to the operation when the structure editor is closed. Code following the "edit/modal" statement will only be activated when the structure editor is closed.

For example, FORMB contains the following operation:

operation editmodal

message/info "In Operation"
retrieve/e "entity"
edit/modal
message/info "End of operation"

end

FORMA activates FORMB through the following statements:

new_instance "FORMB", "FORMBTEST"
activate "FORMBTEST".editmodal()
message/info "Completed"

Control will behave as follows;

  1. FORMB instantiated and activated.
  2. Message "In Operation" displayed.
  3. Data retrieved.
  4. Structure Editor activated. At this point, FORMB appears to the user, and FORMA will not be accessible (since the application is modal).
  5. After the Structure Editor is closed (e.g., the user fires the <ACCEPT> trigger), the message "End of operation" appears.
  6. The message "Completed" from FORMA appears.

Edit/modal/deferred

The "edit/modal/deferred" statement is only valid in modal forms. Once executed, the structure editor is activated but the form will only be displayed to the user when all statements in the current operation have been completed. This allows the developer to add additional lines of code that will still take place before anything is displayed to the user.

For example, FORMB contains the following operation (note that in this example, the retrieve statement appears after the "edit" statement")

operation editmodaldef

message/info "In Operation"
edit/modal/deferred
retrieve/e "entity"
message/info "End of operation"

end

FORMA activates FORMB through the following statements:

new_instance "FORMB", "FORMBTEST"
activate "FORMBTEST".editmodaldef()
message/info "Completed"

Control will behave as follows:

  1. FORMB instantiated and activated.
  2. Message "In Operation" displayed.
  3. Instructions to start Structure Editor processed. The form does not appear at this stage.
  4. Data retrieved.
  5. Message "End of operation" appears.
  6. End of operation encountered, so the form is displayed to the user. Since the application is modal, FORMA is not accessible.
  7. After the Structure Editor is closed (e.g., the user fires the <ACCEPT> trigger), control returns to the calling form and so the message "Completed" appears.

Edit/nonmodal

The "edit/nonmodal" statement is only valid in non-modal forms. Once executed, the structure editor is activated, but the form is only displayed to the user when processing in the current operation has finished.

For example, FORMB contains the following operation:

operation editnonmodal

message/info "In Operation"
edit/nonmodal
retrieve/e "entity"
message/info "End of operation"

end

FORMA activates FORMB through the following statements:

new_instance "FORMB", "FORMBTEST", "modality=non-modal"
activate "FORMBTEST".editnonmodal()
message/info "Completed"

Control will behave as follows;

  1. FORMB instantiated and activated
  2. Message "In Operation" displayed.
  3. Structure editor activated, but does not appear at this stage.
  4. Data retrieved.
  5. Message "End of operation" appears.
  6. End of operation encountered, so the form is displayed to the user. However, processing still continues in the calling form.
  7. Message "Completed" appears - the dialogue box for this message appears on top of FORMB.
  8. Control given to the structure editor in FORMB. Since the application is non-modal, the user is free to click between FORMA and FORMB.

compuware_01.gif (3977 bytes)


Copyright ©2000 OCS Consulting plc

dbs_block_logo.gif (2150 bytes)
Refresh Frames