BeforeOpenFile Event - Java

<< Click to Display Table of Contents >>

Navigation:  Events Generated by the Java Control >

BeforeOpenFile Event - Java

Previous pageReturn to chapter overviewNext page

[GUI version only]

Is fired when the user clicked the Open File button in the toolbar (or pushed the corresponding key).

public void BeforeOpenFile(

CancelEvent e

)

CancelEvent e

The cancel event is defined as:

public class CancelEvent extends java.util.EventObject {

private boolean cancel = false;

 

public boolean getCancel() {

  return cancel;

 }

 

public void setCancel(boolean cancel) {

  this.cancel = cancel;

 }

 

public CancelEvent(VpeControl source) {

  super(source);

 }

}

 

You can call e.setCancel(true) if you want to cancel the event, i.e. deny that the file open dialog will be shown. Cancelling the operation allows you to display your own open dialog and to import or create your own document, for example from a database via a memory stream.

Example:

public void BeforeOpenFile(CancelEvent e) {

 e.setCancel(true);

}

 

See also:

OpenFileName