Contents | Index | < Browse | Browse >
IMAGES (pictures, brushes, JPGs etc)
Images can be used, via the datatypes.library (OS V39+ only)
They are handled differently from icons, so that memory is saved.
You first load an image and give it a "Alias" (i.e. any name you want,
to which you can thereafter refer). Then you can use it in many guis,
as a background or as an Image, without having to load another copy
of it. When you're done, you unload it..
Image Commands :
--------------------
o LoadImage ImageFile Alias ScreenName|NoRemap
will load the ImageFile, call it the Alias you gave and if you give
a screen name, the image will be remapped to that screen's colors.
If "NoRemap" is given, the image will not be remapped.
o FreeImage Alias
will unload a previously loaded image. If you don't unload your
images they will be automatically freed when Gui4Cli quits.
o ChangeImage GuiFile GadID Left Top Alias
will change the specified picture, to the "Alias" named picture
which must have already been loaded.
L T of -1 means position unchanged.
The IMAGE Event :
---------------------
o IMAGE Left Top Alias
will place the (already loaded) picture at the position specified.
L T of -1 means center in window.
Note that no commands can be attached to this event, since it
is not selectable and does not "happen". You can, however, give
it an ID and use "ChangeImage" on it to show an other image.
You can also SHOW or HIDE it with the SETGAD and REDRAW commands.
If you want to be able to select an image, or any part of it (if you
need an image map for example), you can use the xAREA Event and overlay
invisible gadgets on the image where ever you want it to be clickable.
- You can get some information on images via it's internal vars .
- You can change palettes etc, with the Palette command
Example : Run Gui Source
How to use images
---------------------
Apart from displaying an image somewhere with the IMAGE event
you can also use them as follows :
o Embed them in listviews by stating the image Alias in the text
as follows : ESC\Image\ (ie Escape-BackSlash-ImageName-Backslash)
o A special case of the above is the images used in Directory
Listviews, which you can set with the Set command.
o As pointers, with the SetPointer command
o As background for windows, with the WinBackGround Command.
Example :
G4C
WinBig -1 -1 200 100 "Test.gc"
; declare the Alias of the image you want as a background
WinBackground IMAGE MyPicure ""
xOnLoad
; here, load the image, so that when the window opens and
; tries to use the image for it's background, it will find
; it already loaded and ready.
LoadImage Ram:MyImage.iff MyPicture Workbench
; now open the window..
GuiOpen Test.gc
xOnQuit
; on quiting, unload the image (unless you need it elsewhere)
FreeImage MyPicture