PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Retrieving and modifying the caption of the button
  • Retrieving the caption
  • Modifying the caption
  • Finding out and modifying the status of an On/Off button
  • Changing the target of a button
  • To use a simple target (frame of the frameset for example) in most cases and a new browser in some cases:
  • To open a browser in most cases and to use a specific destination in some cases:
  • Modifying the image displayed in the button
  • To change the image of a button in browser code
  • Properties specific to the management of button images
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 a Button control by programming
Overview
WINDEV, WINDEV Mobile and WEBDEV allow you to handle a Button control by programming. To do so, use the variable of the Button control in the code.
The variable of the Button control:
  • corresponds to the name of the button.
  • is initialized with the caption of the button.
Retrieving and modifying the caption of the button

Retrieving the caption

To retrieve the caption of the button, use the following syntax:
  • direct syntax:
    <Caption> = <Button Name>
  • using ..Caption:
    <Caption> = <Button Name>..Caption
<Caption> is Character String variable.
Versions 20 and later
WINDEV Note: If the caption is in RTF ("RTF" checked in the "General" tab of the control description), the retrieved caption will contain the RTF tags. To get the caption without the RTF tags, use RTFToText.
For example:
MyCaption is string
MyCaption = RTFToText(BTN_Button..Caption)
New in version 20
WINDEV Note: If the caption is in RTF ("RTF" checked in the "General" tab of the control description), the retrieved caption will contain the RTF tags. To get the caption without the RTF tags, use RTFToText.
For example:
MyCaption is string
MyCaption = RTFToText(BTN_Button..Caption)
WINDEV Note: If the caption is in RTF ("RTF" checked in the "General" tab of the control description), the retrieved caption will contain the RTF tags. To get the caption without the RTF tags, use RTFToText.
For example:
MyCaption is string
MyCaption = RTFToText(BTN_Button..Caption)

Modifying the caption

To modify the caption of the button, use the following syntax:
<Button Name> = <Caption>
<Caption> is Character String variable.
Versions 20 and later
WINDEV Note: If the caption is in RTF ("RTF" checked in the "General" tab of the control description), the new caption may (or may not) contain RTF text.
New in version 20
WINDEV Note: If the caption is in RTF ("RTF" checked in the "General" tab of the control description), the new caption may (or may not) contain RTF text.
WINDEV Note: If the caption is in RTF ("RTF" checked in the "General" tab of the control description), the new caption may (or may not) contain RTF text.
Finding out and modifying the status of an On/Off button
WINDEVAndroidWindows MobileUniversal Windows 10 AppJava ..Pushed is used to find out the status of the button:
<Status> = <Button Name>..Pushed
<Status> is a Boolean variable:
  • True if the button is pressed,
  • False if the button is released.
Changing the target of a button
WEBDEV - Server code The target of a button is defined in the page editor at the same time as the action to perform (in the description window of the button). See Action associated with the button for more details.
WEBDEV gives you the ability to modify this target by programming. Indeed, in some sites, the target of a button can be modified according to the action performed by the Web user.
Example: if the Web user types his name and password:
  • if the password is correct, the application continues in the current page
  • if the password is incorrect, a new browser is opened to ask for the name and password again.
In this example, in most cases, the Web user will enter a correct password. The error is an exception.
WEBDEV - Server code

To use a simple target (frame of the frameset for example) in most cases and a new browser in some cases:

  1. In the button description, define the "simple" target (frame of the frameset, current browser, ...).
  2. In the browser code of the button, use ChangeTarget:
    IF <Condition> THEN
    // Change the target
    // Display in a new browser
    ChangeTarget(NewBrowser, "New")
    END
WEBDEV - Server code

To open a browser in most cases and to use a specific destination in some cases:

  1. In the button description, define the "New browser" target by defining the parameters of the new browser.
  2. In the browser code of the button, use ChangeTarget:
    IF <Condition> THEN
    // Change the target
    // Display in the "FRM_Target" frame
    ChangeTarget(FRM_Target)
    END
Modifying the image displayed in the button
WINDEVAndroidiPhone/iPadWindows MobileUniversal Windows 10 AppJava To modify the image displayed in the button, use ..Image:
<Button Name>..Image = <Image Path>
<Image Path> is a Character String variable.
The following image formats are supported in Windows:
  • Bitmap (*.BMP)
  • Graphics Interchange Format (*.gif)
  • Joint Picture Experts Group (*.jpg ; *.jpeg)
  • Kodak Photo CD (*.pcd)
  • PaintBrush (*.pcx)
  • Adobe Photoshop Format (*.psd)
  • TrueVision TARGA (*.tga)
  • Tagged Image File Format (*.tif ; *.tiff)
    Note: the "tiled tiff" option of the tiff 6.0 standard is not supported. In this case, we advise you to save the image in tiff 5.0 standard.
  • Portable Network Graphics (*.png)
  • Windows MetaFiles (*.emf ; *.wmf)
  • Icons (*.ico ; *.icw)
    Versions 22 and later
    Notes:
    • HQ display (High Quality) available.
    • Management of sheets in transparent BMP format (32 bits).
    New in version 22
    Notes:
    • HQ display (High Quality) available.
    • Management of sheets in transparent BMP format (32 bits).
    Notes:
    • HQ display (High Quality) available.
    • Management of sheets in transparent BMP format (32 bits).
  • Cursors (*.cur)
  • Portable Document Format (*.pdf)
  • Versions 15 and later
    Scalable Vector Graphics (*.svg)
    New in version 15
    Scalable Vector Graphics (*.svg)
    Scalable Vector Graphics (*.svg)
Note: To manage the pdf and svg formats, GDIPLUS.DLL must be installed for the computers running Windows 2000 and earlier. For the later versions, this DLL is supplied with Windows. See GDI+ framework for more details.
Windows Mobile The recognized image formats are: BMP, ICO, PNG, JPEG or GIF
Note: To manage the images in TIFF, GIF and JPEG format, Wxxximg.dll must be installed with the other DLLs of WINDEV.
WEBDEV - Browser code

To change the image of a button in browser code

  1. Save the new image in the "<ProjectName>_WEB" directory.
  2. Use FolderWeb. For example:
    BTN_IMAGE = FolderWeb() + "/VSXP15022_MODIF.gif"
Properties specific to the management of button images
The following properties are used to manage the images displayed by a button.
PushedAllows you to find out and modify the status of an on/off button (pressed or not).
ImageAllows you to find out and modify the image of a button.
ImageStateAllows you to find out and modify the number of drawings found in the image associated with a button.
BackgroundImageAllows you to find out and modify the image associated with the border of a button.
BackgroundImageStateAllows you to find out and modify the number of drawings found in the image associated with the border of a button.
ValueAllows you to find out and modify the caption of a button.
To find out the entire list of WLanguage properties that can be used with a Button control, see Properties associated with the Button control.
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment