Game Development Community

dev|Pro Game Development Curriculum

GuiBitmapButtonCtrl revision to solve bug#00122

by Mark Owen · 01/01/2004 (7:53 pm) · 1 comments

Download Code File

Installation:
Replace your existing GuiBitmapButtonCtrl.* files with the two files containted in the zip file attached to this article.

Synopsis of the Bitmap Button Control Revision:

Set 'bitmap' console field to the names of one or more bitmaps to use for specific states of the control as described below...

Usage in persistant field assignment:
bitmap = ;

Usage in method call:
obj.setBitmap();

::= [[ ]]
::= \[_]
::= [[]]
::=
- single image used for all states (implies nhdi)
n - name is normal state image - button up, mouse elsewhere
h - name is highlighted state image - button up, mouse over
d - name is depressed state image - button down, mouse over
i - name is inactive state image - button up, mouse irrelevant

is limited to 511 characters in length maximum
extension (.png, .gif, .jpg) is optional
must not include any underscores other than flags

Examples:
from gui script as persistant field assignment:
bitmap = "./UpArrow";
bitmap = "./UpArrow_n ./UparrowRed_h ";
bitmap = "./UpArrow_n ./UparrowRed_hd ./UparrowGrey_i";
as method call:
setBitmap("./UpArrow");
setBitmap("./UpArrow_n ./UparrowRed_h ./UparrowRed_d");

In the examples above, the image UpArrow is a normal state image, UpArrowRed is used as a highlight and a down state image, UpArrowGrey is used as an inactive state image.

If no bitmap is found the control will render a default bitmap.
If the extent is set to (0,0) in the gui editor and apply is pressed, this control will set its extent to the size of the normal bitmap (if any).