eva/3 Application BuilderDeveloping Additional eva/3 ComponentsUser CommandsExamples for Tasks of an CommandExamples for form commands 

Reading Data from a Dialog

The following example describes, how data can be read from a closed dialog and then be written in the form.

Example:

// A String [] with the size 3 will be create.
final String [] fields = new String [3]; 
// Get the SDialogs.
SDialog dia = (SDialog)EvaUtils.getActiveSWindow(); 
dia.addWindowListener(
    // A new WindowAdapter will be assigned to the Dialog 
    new WindowAdapter() { 
        // Implement the Methode windowClosed. Will be execuded when the dialog closes
        public void windowClosed(WindowEvent e) { 
            // Get the parent window
            SWindow window = EvaUtils.getActiveSWindow(); 
            // Get the first SFormattedField of the form
            SFormattedField field1 = (SFormattedField)window.getObject("txt1"); 
            // Writes the text from the array to the SFormattedField
            field1.setText(fields[0]); 
            // Gets the second SFormattedField
            SFormattedField field2 = (SFormattedField)window.getObject("txt2"); 
            // Writes the text from the array to the SFormattedField
            field2.setText(fields[1]); 
            // Get the third SFormattedField of the form
            SFormattedField field3 = (SFormattedField)window.getObject("txt3"); 
            // Writes the text from the array to the SFormattedField
            field3.setText(fields[2]); 
        }
    });

// Get the first SFormattedField of the dialog
SFormattedField txt1 = (SFormattedField)dia.getObject("txt1"); 
// Write the text to the String [].
fields[0] = txt1.getText(); 
// Get the second SFormattedField of the dialog
SFormattedField txt2 = (SFormattedField)dia.getObject("txt2"); 
// Write the text to the String [].
fields[1] = txt2.getText(); 
// Gets the third SFormattedField of the dialog
SFormattedField txt3 = (SFormattedField)dia.getObject("txt3"); 
// Write the text to the String [].
fields[2] = txt3.getText(); 
// Close the dialog
dia.dispose(); 
return null;