PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Displaying an image file in an Image control
  • In a window
  • In a page
  • Retrieving the name of the image file displayed in the Image control
  • In a window
  • In a page
  • Retrieving the position of the mouse in a clickable image
  • Clearing or reinitializing the content of an Image control
  • Properties specific to the Image controls
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
Handling an Image control by programming
Overview
WINDEV, WEBDEV and WINDEV Mobile allow you to handle an Image control by programming. To do so, use the variable of the Image control in the code.
The variable of Image control corresponds to the name of Image control. This variable is a text variable.
Displaying an image file in an Image control
WINDEVAndroidAndroid Widget iPhone/iPadWindows MobileUniversal Windows 10 AppJava

In a window

To display an image file in an Image control, a simple assignment is sufficient.
Some examples:
  • direct assignment:
    IMG_MyImage = "C:\Temp\MyImage.gif"
  • assignment by variable:
    ImagePath = fCurrentDir() + "\MyImage.gif"
    IMG_MyImage = ImagePath

    Note: An Image control can also be initialized from a buffer variable or from a text variable containing the image value in binary format.
Note: if the control is associated with a file item, the assignment is automatically performed by using FileToScreen. See Linking an Image control to an item for more details.
WEBDEV - Server code

In a page

To display an image file in an Image control, a simple assignment is sufficient.
If the image is available in the "<ProjectName>_WEB", directory, you have the ability to use the following syntaxes:
  • WEBDEV - Server code Server code:
    <Image Control> = <Image Name>

    Note: In server code, if the image is available in a directory other than "<ProjectName>_WEB", you must:
    • specify the full path of image.
    • have read rights in this directory.
  • WEBDEV - Browser code Browser code:
    <Image Control> = FolderWeb() + <Image Name>

    Note: if the option "Locate the images in the _WEB directory in browser code" is checked ("General" tab in the description window of control), FolderWeb is useless. The following syntax can be used:
    <Image Control> = <Image Name>

    <Image Control> = FolderWeb() + <Image Name>

    Note: if the option "Locate the image in the _WEB directory in browser code" is checked ("Details" tab in the description window of control), FolderWeb is useless. The following syntax can be used:
    <Image Control> = <Image Name>
    Note: If the control is associated with a file item, the assignment is automatically performed by using FileToPage. See Linking an Image control to an item for more details.
Retrieving the name of the image file displayed in the Image control
WINDEVAndroidAndroid Widget iPhone/iPadWindows MobileUniversal Windows 10 AppJava

In a window

To retrieve the name of the image displayed in an Image control:
  • perform a simple assignment. For example:
    EDT_CurrentImageContent = IMG_Image1
  • retrieve part of the name, with fExtractPath. For example:
    NameImageFile = fExtractPath(IMG_Image1, fFileName + fExtension)
  • use ..Value
Note: To retrieve the image (or its name) in the item associated with the Image control:
  1. If the control is associated with a text item, the value typed is automatically retrieved by using ScreenToFile. You also have the ability to use the following notation: CUSTOMER.NAME = EDT_Edit1.
  2. If the control is associated with a binary memo, use HLinkMemo to associate the image file with the item.
  3. If the Image control was assigned from a buffer variable or from a string variable, ..Value returns an empty string.
    See Linking an Image control to an item for more details.
WEBDEV - Server code

In a page

To retrieve the name of the image displayed in an Image control:
  • perform a simple assignment. For example:
    EDT_CurrentImageContent = IMG_Image1
  • use ..Value.
  • use ..Caption (server code only).
WEBDEV - Server code In server code, these syntaxes are used to retrieve the image name defined in the "General" tab of control.
Example: ./background.gif
WEBDEV - Browser code In browser code, these syntaxes are used to retrieve the full image name on the server.
Example: http://localhost/addressbook_Web/background_fr.gif
Note: To retrieve the image (or its name) in the item associated with the Image control,
  1. If the control is associated with a text item, the value typed is automatically retrieved by using PageToFile. You also have the ability to use the following notation: CUSTOMER.NAME = EDT_Edit1.
  2. If the control is associated with a binary memo, use HLinkMemo to associate the image file with the item.
    See Linking an Image control to an item for more details.
Retrieving the position of the mouse in a clickable image
WINDEVAndroidiPhone/iPadWindows MobileUniversal Windows 10 AppJava To retrieve the position of the mouse in a click area, the following functions must be used in the click code of the image:
MouseXPosReturns the horizontal coordinate of the mouse click.
MouseYPosReturns the vertical coordinate of the mouse click.
Clearing or reinitializing the content of an Image control
To clear or reinitialize an Image control, all you have to do is assign an empty string to the Image control. For example:
IMG_MyImage = ""
Note: You also have the ability to use dStartDrawing/dEndDrawing on the Image control.
Properties specific to the Image controls
WINDEVAndroidiPhone/iPadWindows MobileUniversal Windows 10 AppJava The following properties are used to manage the characteristics of an Image control by programming.
AnimationUsed to find out the current status of the animated image or to stop the animation of an animated image (animated GIF image for example)
InitialAnimationUsed to find out the initial status of the animation in an Image control
HorizontalAlignmentUsed to find out and modify the horizontal alignment of the image caption
VerticalAlignmentUsed to find out and modify the vertical alignment of the image caption
ImageModeUsed to find out and modify the display mode of an image in an Image control.
To find out the entire list of WLanguage properties that can be used with an Image control, see Properties associated with an Image control.
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment