PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

  • Characteristics of item
  • How to proceed?
  • Storing the images in the data file as Text items
  • Storing the images in the data file as "Image" items
  • Retrieving the content of the image in an item
  • HFSQL thumbnails
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Image control linked to an item
Characteristics of item
An Image control can correspond to an item found in a data file, in a query, ... Two types of items can be associated with an Image control:
  • A "Text" item: the stored information is the path of the image.
  • A "Sound, image, binary" item: the stored information is the image itself.
In both cases, the Image control is used to display the information found in the data file.
How to proceed?

Storing the images in the data file as Text items

This solution is used to store the path of images in the data file.
To manage the images as Text items:
  1. In the data model editor:
    • Create a Text item (PHOTO_Path for example). This item will be used to store the path giving access to the image.
    • Don' forget to resize this item (255 characters for example).
    • In the shared information of the item, this control is associated with an edit control.
    • Generate the analysis to take the modifications into account.
  2. In the window (or in the page) that will be used to edit/view the image:
    • Create an Image control (IMG_Photo in our example). This Image control is linked to no item.
    • Create an edit control linked to the PHOTO_PATH item (this control is named EDT_Photo in our example).
      To create this control, Drag and Drop the item found in the "Analysis" pane to your window or page.
      This control allows the user to specify the path of the image file to use. A button used to select the requested image can be added beside this control. The click process of the button can contain the following code for example:
      // Opens an image picker
      EDT_Photo = fImageSelect("c:\my documents", "", "Select the customer photo")
      // Runs the process of EDT_Photo edit control
      // to update the Image control
      ExecuteProcess(EDT_Photo, trtChange)
    • In the "Whenever modified" process of this control, type the following code:
      IF fFileExist(MySelf) = True THEN
              IMG_Photo = MySelf
      ELSE
              IMG_Photo = ""
      END

      This code is used to:
      • check the existence of the image file.
      • display the image in the Image control. All you have to do is assign the path of the image to the Image control in order for the image to be displayed. If the image does not exist, no image is displayed.
    • When displaying the window or the page, force (if necessary) the execution of the process for control modification with ExecuteProcess. For example:
      ExecuteProcess(EDT_Photo, trtChange)
  3. The information will be automatically saved in the data file when using:
The path of the image will be automatically saved in the Text item.

Storing the images in the data file as "Image" items

This solution is used to directly store the images in the data file.
To manage the images in the format of "Image" items:
  1. In the data model editor:
    • Create a "Sound, image, binary" item (PHOTO_Image for example). This item will be used to store the image.
    • In the "General" tab of item, specify the "Image (binary memo)" sub-type.
    • In the shared information of the item, this control is associated with an Image control.
    • Generate the analysis to take the modifications into account.
  2. In the window (or in the page) that will be used to edit/view the image:
    • Create an Image control (IMG_Photo in our example). This Image control is linked to the "Sound, image, binary" item created in the analysis. To create this control, Drag and Drop the item found in the "Analysis" pane to your window or page.
    • Create an edit control if necessary (EDT_Photo in our example). This control allows the user to specify the path of the image file to use. This control is linked to no item. A button used to select the requested image can be added beside this control. The click process of the button can contain the following code for example:
      // Opens an image picker
      EDT_Photo = fImageSelect("c:\my documents", "", "Select the customer photo")
      // Runs the process of EDT_Photo edit control
      // to update the Image control
      ExecuteProcess(EDT_Photo, trtChange)
    • In the "Whenever modified" process of this control, type the following code:
      IF fFileExist(MySelf) = True THEN
              IMG_Photo = MySelf
      ELSE
              IMG_Photo = ""
      END

      This code is used to:
      • check the existence of the image file.
      • display the image in the Image control. All you have to do is assign the path of the image to the Image control in order for the image to be displayed. If the image does not exist, no image is displayed.
  3. The information will be automatically saved in the data file when using:
The image will be automatically saved in the "Sound, image, binary" item.
Retrieving the content of the image in an item
1st case: the window (or the page) is associated with a data file
All the items of the data file (or linked file) associated with a control found in the window (or in the page) will be assigned by:
2nd case: the window (or the page) is not associated with a specific data file
For a Text item: The controls must be assigned one by one via the following syntax:
<FileName>.<ItemName> = <ControlName>
For a Binary Memo item: The controls must be assigned one by one with HLinkMemo.
HFSQL thumbnails
The item linked to the Image control can use HFSQL thumbnails. In this case, the display of images will be optimized.
See HFSQL thumbnails for more details.
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment