Displaying Bitmaps/Icons |
|
Using the following techniques in PxPlus, you can retrieve and incorporate bitmaps and icons for a variety of uses in your graphical user interface based applications:
• |
Display images via the 'PICTURE' mnemonic. |
• |
Associate images for graphical user interface controls using the control object directives BUTTON, CHECK_BOX, LIST_BOX, RADIO_BUTTON, TRISTATE_BOX, MENU_BAR, POPUP_MENU. |
• |
Specify icons to customize the upper left corner of dialogue windows via the 'OPTION' mnemonic or the ICON= INI file setting. |
In addition, the NOMADS toolset provides a fully integrated development environment for creating and modifying graphical screen layouts. For information on handling images in NOMADS, see Images/Pictures.
Some of the general concepts and PxPlus functionality involving the use of images in PxPlus applications are explained below.
Images are recognized as internal in PxPlus if they have a leading ! exclamation mark in their filenames:
PRINT 'PICTURE'(220,210,600,500,"!Binoculars",2)
Internal images can be accessed if they are embedded within the PxPlus executable itself, supplied in an associated resource library, or exist in a file located in the *BMP directory. All internal images have an implied light gray transparency.
Use the 'PICTURE' mnemonic to return a list of available internal images (including the set of standard operating system icons).
Example:
X$='PICTURE'(*)
PRINT X$
To access images that are external to PxPlus, specify the path and filename instead of the ! (exclamation point):
PRINT 'PICTURE'(1,1,100,100,"C:\WINDOWS\CLOUDS.BMP,T",0)
The following table shows the internal bitmap images (as of PxPlus 2014) that can be referenced by specifying the image name prefixed by an ! (exclamation point):
Pre-PxPlus 2014 Image Library
Versions of PxPlus/ProvideX prior PxPlus 2014 had a different set of images, mostly low-resolution using only 16 colors. If you wish to retain these older images, PxPlus 2014 is shipped with a .dll (oldimages.dll) which contains these older images that can be added to your system as a resource library using the following command:
SETDEV (0) SET "ResourceLib" TO "oldimages.dll"
Alternatively, the ResourceLib may be included in your INI file.
By default, only bitmap (bmp) or icon (ico) file types are supported automatically in PxPlus. By using the Multiple Image Type feature, you can extend graphic image support to include other file types such as jpg, tiff, png, pcx, pax, wmf, emf, apm and tga.
PxPlus is also able to use ico files that contain multiple icons, different sizes, and different colour formats. Icons can also be retrieved from other file types including .exe, .dll, .ocx, .drv, .cpl, .scr and .icl (icon libraries). See Icon File Types below.
The following optional syntax items may be applied in the 'PICTURE' and 'OPTION' mnemonics, as well as in control object directives, to define the location and attributes of an icon to be retrieved from an enhanced icon source:
[filename] [@resourcename| @resourcenum] [%size] [,T | ,G | ,N ]
filename |
File containing icon(s). If no filename is given, then the currently loaded resource library is searched. |
@resourcename |
String name of the specific resource identifying the icon. If no resource is specified, the first icon in the file will be loaded. |
@resourcenum |
Specific resource number identifying the icon. If no resource is specified, the first icon in the file will be loaded. |
%size |
1 to 3 digit number of pixels representing the X or Y size of the icon displayed. This size is used for both X and Y axes; e.g. %16 displays the icon in 16 x 16 pixels. If no %size is given, then the first format available for the icon is used. If %0 is specified, then the default operating system icon size is used. |
T, G or N |
Transparency substitution indicator where (can also be applied to internal images): T - Means use upper left most pixel colour |
Standard PxPlus search rules apply to the filenames. A leading exclamation will also search the *BMP directory. Colour depth selection (16, 256 or 24-bit) is chosen automatically by the operating system based on the user's current video card colour depth and the colour depth of the icon available within the file.
C:\Pvx\Pvx.ico%16,T C:\Windows\System32\Shell32.dll@137%32,T C:\Windows\System32\Shell32.dll@137%32,T
!myico.ico%48
!myico.ico%48,G
@PxPlus,T
<path>\pxplus.exe@PxPlus%16,T
PxPlus accepts icons from the following file extensions:
File Suffix |
Description |
.ico |
Does not support loading by resource name/resource number. You must specify the filename (with or without path) ending in .ico. |
.exe, .dll, .ocx, .drv, .cpl, .scr |
(Any file type that the MS Windows API allows a LoadImage from). You must specify a resource name or number. |
.icl |
Icon Library (commonly used by Icon editing tools). You must specify a resource number only (0 based). It ignores icon size specifications. Note: |
The [Config] section of your INI file, allows for an ICON= using any of the above syntax for specifying the icon. If no filename is given or there is no leading @ sign, then the name given is assumed to be a resource name from either the currently loaded resource library (if any) or from the PxPlus executable:
[Config]
Icon=myname ! Would be the icon "myname" in a resource library
Icon=@myname ! Same as above
Icon=mydll.dll@myapp
When using enhanced icons in objects, the filename and syntax must be enclosed in curly braces:
BUTTON 10,@(40,2,8,3)="{pxplus.exe@PxPlus%32,T}" BUTTON 10,@(40,2,10,2)="{@90w%32,T}"