Previous Topic

Book Contents

Book Index

Next Topic

Formatter: Single Picture Control

Formatter Properties for the Single Picture Control:

  • Border Visible

    If selected, the image border will be visible.

  • Enabled

    Determines whether the picture selection drop-down box and paste button are displayed below the picture control. If disabled, images are only displayed but cannot be added or removed. This is intended for situations when fixed picture sets are supplied which the user is not supposed to change.

  • Height of Image

    Height of the control in pixels. This property determines the actual vertical size of the viewer while Row Span only determines how many other controls of row span=1 may be placed alongside the viewer.

  • Scale Down

    If any of the dimensions of the picture is bigger than corresponding dimensions of the control, then setting this property to 'True' causes the picture to be scaled down to fit the control while preserving the picture's aspect ratio.

    If set to 'False', the picture is displayed without scaling and only part of it can be seen in the control with scroll bars provided to enable scrolling to see the rest.

  • Scale Up

    If both dimensions of the picture are smaller than corresponding dimensions of the control, then setting this property to 'True' causes the picture to be scaled up to fill maximum space available while preserving its aspect ratio.

    If set to 'False', then the picture is displayed without scaling.

  • Visible

    Enable / disable a display of the control on the View. The control may exist on the View layout but may be prevented from being displayed on the actual View. It can also be used creatively to leave a "virtual" blank space in the left column of the view.

    Note the specific appearance of this option in the View Designer: If selected, the view element will be hatched.

  • Select Action...

    Click to open the Action browser and select the requested action. The action will be assigned and visible at the right edge of the attribute control. The action visibility is determined by the existing editor action assignments (state, mode, rules...).

    Once assigned, you can edit the action using the Edit button or remove it using the Remove button.

Single Picture Control in Use

An Object Type attribute with the 'image' semantic (specified by its 'Image Attribute' extended property in the Object Type customizer) can be assigned the 'Single Picture Control' formatter which is the default formatter for attributes of this type. The control offers the same formatting options as the 'Picture Viewer Control'.

Help Image

In the editor, the Single Picture control shows a picture that is referred by the underlying attribute. It allows to paste an image from the clipboard to the attachments of the currently opened business object, the value of the underlying attribute is then set to 'ATTACHMENT:nameOfAttachedImage', where the name includes automatic incremental numbering ensuring uniqueness of the attachment name.

The Single Picture Control can also be used with calculated image attributes, in which case the control should be disabled (i.e. the 'Enabled' attribute should be unchecked). Such picture control cannot be edited or used for pasting of images. See the 'getPicture()' function for more information on calculated images.

The following actions are possible in the Single Picture Control:

Help Image

  • Paste picture from clipboard

    The action pastes an image from the Windows clipboard to the Single Picture Control. At the same time the image is added to object attachments.

    Differences between Rich and Web client:

    • In the Rich client, the popup menu for the single picture control is visible only when the control is enabled. When there is no image in the clipboard, the 'Paste Image' action is disabled.
    • In the Web client, the popup menu is always enabled. When the 'Paste Image' action is call with no image in the clipboard, an info message is displayed.
  • Attach picture from file

    The action opens an 'Upload File' dialog enabling to browse for a file and insert it in the Single Picture Control. The file also gets attached to object attachments.

  • Link to picture in attachments

    The action is available when at least one picture is attached to current business object. The pictures in the attachments are then offered in a submenu where one of them can be selected for insertion in the Single Picture Control. This picture replaces the previous picture in the Single Picture Control. The previous picture does not get deleted, it stays among object attachments.

  • Unlink from attachments

    The action removes the current picture from the Single Picture Control. The picture does not get deleted, it stays among object attachments. The Single Picture Control remains empty - the value of the underlying attribute is set to null.

  • Delete

    The action deletes the current picture from the Single Picture Control and also from object attachments. The Single Picture Control remains empty - the value of the underlying attribute is set to null.

Single Picture Control: Object Type Customizer

In order to use a string attribute as a Single Picture Control, it needs to be specified as 'Image' attribute in the Object Type customizer.

  1. Open the object type in the Object Type customizer and locate the string attribute.
  2. Open its 'Extended Properties' and click the 'Add' button.

    Help Image

  3. For the extended property, specify: name = 'Image Attribute' and value = 'true'.
  4. Click OK.

     

Single Picture Control: Calculation with the getPicture() function

The Single Picture Control can be used with a calculation using the getPicture() function. Function returns object of type Picture when parameter of the function refers to a real picture, or null if it does not.

Example: The function is used with the Catalog Picture attribute of Product Type. This attribute displays Product Type 'Picture' attribute (called 'Main Picture' on the GUI) if available, otherwise it displays the 'Picture' attribute of corresponding Product Class.

Help Image

This is achieved by the following calculation 'itemtype_pictureAny' for attribute 'Catalog Picture : text' (string attribute with 'image' semantics).

Help Image

The 'getPicture()' function in the calculation checks if the 'picture' attribute references an existing image and retrieves the reference if the test is positive, otherwise value of the 'Picture' attribute of Product Class object type (itemtypeclass) is used. Note that the parameters in the formula must be in apostrophes to distinguish attribute names.

See Also

Formatter: Image Formatters

Formatter: Attached Pictures Viewer