Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Selecting Elements via Element Selection Dialog

Code Block
languagejava
    // Use ElementSelectionDlgFactory.create(...) methods to create the element selection dialog.
    Frame dialogParent = MDDialogParentProvider.getProvider().getDialogParent(); 
    ElementSelectionDlg dlg = ElementSelectionDlgFactory.create(dialogParent);
 
    // Use ElementSelectionDlgFactory.initSingle(...) methods to initialize the dialog with a single element selection mode.
    ElementSelectionDlgFactory.initSingle(....);
 
    // Use ElementSelectionDlgFactory.initMultiple(...) methods to initialize the dialog with a multiple element selection mode. 
    ElementSelectionDlgFactory.initMultiple(....);
 
    // Display the dialog for the user to select elements. 
    dlg.setVisible(true);
 
    // Check if the user has clicked "Ok". 
    if (dlg.isOkClicked())
    {
         // Get the selected element in a single selection mode. 
        BaseElement selected = dlg.getSelectedElement();
 
        // Get selected elements in a multiple selection mode. 
        BaseElement selected = dlg.getSelectedElements();
    }


Info

You can find the code examples in <programinstallation direc tory><installation_directory>/openapi/examples/elementselection