RESOURCES
Resources are usually .dll files that have bitmaps, icons or other files.
With dBASE Plus we include a large set of resource dlls with png images.
These are installed to the C:\Users\Public\Documents\dBASE\Plus12\Media\RESOURCES folder.
NOTE: dBASE creates a source alias for this folder
on startup called 'RESOURCES'
With these resource .dlls you will also see a .pdf relating to each resource .dll file.
for example the resource dAction1.dll has a corresponding dAction1.pdf in which details of each image included in the .dll are layed out.
We also include (as of 10.1.0.0) a form called Show Resources.wfm. You can find this in both the :Samples: and :Resources: folders.
(NOTE: :Samples: default folder is C:\Users\<username>\Documents\dBASE\Plus12\Samples :Resources: default folder is C:\Users\Public\Documents\dBASE\Plus12\media\Resources)
Now it's all well and good to see that these images are there. but, how do they get used?
You can do this programmatically for any object that can use a RESOURCE image (so long as the image type is also available for that object)
NOTE: you must designate the image type in the resrouce .dll by putting the <image type><forward slash> directly before the image name if it is not a standard .bmp (bitmap) image.
The code for setting up an image for the PNG type (currently all of the
resource .dlls have a PNG image type) would be..
<imageproperty> = "RESOURCE PNG/<imagename> <directory\
or SourceAlias><resource filename>"
like..
pushbutton.upbitmap = "RESOURCE PNG/ic_3d_rotation_grey600_48x48 :RESOURCES:dAction1.dll"
for example this simple form which uses three different images in dAction1.dll
for a pushbutton...
** END HEADER -- do not remove this line
//
// Generated on 07/22/2015
//
parameter bModal
local f
f = new mediaImagesForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class mediaImagesForm of FORM
with (this)
height = 7.9091
left = 17.2857
top = 6.7727
width = 34.0
text = ""
endwith
this.PUSHBUTTON1 = new PUSHBUTTON(this)
with (this.PUSHBUTTON1)
height = 4.0
left = 4.0
top = 1.0
width = 27.0
text = "Pushbutton1"
upBitmap = "RESOURCE PNG/ic_3d_rotation_black_48x48 :RESOURCES:dAction1.dll"
downBitmap = "RESOURCE PNG/ic_3d_rotation_white_48x48 :RESOURCES:dAction1.dll"
disabledBitmap = "RESOURCE PNG/ic_3d_rotation_grey600_48x48 :RESOURCES:dAction1.dll"
endwith
this.DISABLEPB = new PUSHBUTTON(this)
with (this.DISABLEPB)
onClick = class::DISABLEPB_ONCLICK
height = 1.0909
left = 6.0
top = 5.5
width = 15.2857
text = "Disable"
endwith
function DISABLEPB_onClick()
if form.pushbutton1.enabled
form.pushbutton1.enabled = false
this.text = "Enable"
else
form.pushbutton1.enabled = true
this.text = "Disable"
endif
return
endclass