Managing Resources

Resources are used with dialogs. A resource is a non-Natural file (for example, an image file or a Word document) that has been created in the Windows environment. For more information, see Resource in the Object Types section of the Programming Guide.

Note:
The information in this section does not apply to the so-called "private" resources which are created when using ActiveX controls in a Natural dialog.

Resources can be created and edited in Natural Studio. Using copy-and-paste or drag-and-drop, they can also be imported/exported from/to the Windows Explorer. When you invoke the context menu for a resource, you will notice that Natural Studio provides commands that are also used for this type of file in the Windows Explorer. Using these Windows commands, you can manage (open, copy, print etc.) the resources in Natural Studio.

For example, when a print command is available for an image file, a Windows command is executed (not a Natural Studio command which may have the same name). The associated program is opened, the print command is automatically executed and the program is automatically closed. The resource is printed on the printer that has been defined in Windows.

The Properties command is an exception. Other than the Windows command with the same name, it shows only Natural-specific information: name, library, type, size, creation date and date of last access. See also Properties for the Nodes.

Start of instruction set To create a resource in Natural Studio

  1. Make sure that the library in which you want to store the new resource is selected.

  2. Invoke the context menu and choose New Resource > resource-type.

    The resource types that are listed in the cascading menu are those which are registered in your Windows environment.

    A new resource with a default name (for example, "New Bitmap Image" when you have chosen the corresponding command from the context menu) is now shown in the tree.

    The icon shown for a resource is the same as that used in Windows.

  3. Enter a name for the resource. Do not specify an extension. The correct extension will be used automatically when this resource is opened.

  4. Press ENTER.

    Or:
    Click any other position in the library workspace.

    Your new resource is now available in all views (sorted alphabetically). As long as you do not edit it as described below, it is empty.

Start of instruction set To open and edit a resource in Natural Studio

  1. Select the resource that you want to open, invoke the context menu and choose the Windows command that is used to invoke the corresponding program (Open or Edit in many cases).

    Or:
    Double-click the resource.

    The resource is opened in the associated program.

    Note:
    When an association for this program has not yet been defined in Windows, a dialog box appears and you have to specify the program with which this file is to be opened. This is standard Windows functionality.

  2. Edit the resource (for example, draw a bitmap), save your changes and close the program.

    If the buffer pool synchronization is enabled for the associated buffer pool, all of your changes will be visible the next time you open this resource from Natural Studio.

    Note:
    The buffer pool synchronization is enabled/disabled using the Configuration Utility. See Buffer Pool Assignments in the Configuration Utility documentation. The modified buffer pool assignments are only available after restarting either the buffer pool service or the entire system.