Supporting a Custom Control

Silk4J supports managing custom controls over the UI for the following technology domains:
  • Win32
  • Windows Presentation Foundation (WPF)
  • Windows Forms
  • Java AWT/Swing
  • Java SWT

To create a custom class for a custom control for which Silk4J does not offer any dedicated support.

  1. Click Silk4J > Manage Custom Controls. The Manage Custom Controls dialog box opens.
  2. In the Silk4J Custom Controls Output Package field, type in a name or click Browse to select the package that will contain the custom control.
  3. Click on the tab of the technology domain for which you want to create a new custom class.
  4. Click Add.
  5. Click one of the following:
    • Click Identify new custom control to directly select a custom control in your application with the Identify Object dialog box.
    • Click Add new custom control to manually add a custom control to the list.
    A new row is added to the list of custom controls.
  6. If you have chosen to manually add a custom control to the list:
    1. In the Silk Test base class column, select an existing base class from which your class will derive. This class should be the closest match to your type of custom control.
    2. In the Silk Test class column, enter the name to use to refer to the class. This is what will be seen in locators. For example: //UltraGrid instead of //Control[13].
      Note: After you add a valid class, it will become available in the Silk Test base class list. You can then reuse it as a base class.
    3. In the Custom control class name column, enter the fully qualified class name of the class that is being mapped. For example: Infragistics.Win.UltraWinGrid.UltraGrid. For Win32 applications, you can use the wildcards ? and * in the class name.
  7. Only for Win32 applications: In the Use class declaration column, set the value to False to simply map the name of a custom control class to the name of a standard Silk Test class. When you map the custom control class to the standard Silk Test class, you can use the functionality supported for the standard Silk Test class in your test. Set the value to True to additionally use the class declaration of the custom control class.
  8. Click OK.
  9. Only for scripts:
    1. Add custom methods and properties to your class for the custom control.
    2. Use the custom methods and properties of your new class in your script.
      Note: The custom methods and properties are not recorded.
Note: Do not rename the custom class or the base class in the script file. Changing the generated classes in the script might result in unexpected behavior. Use the script only to add properties and methods to your custom classes. Use the Manage Custom Controls dialog box to make any other changes to the custom classes.