SetInstanceRefBox
(Engine-Level Function)
| Description: | Programmatically, set the module reference box of a single module instance. |
| Warning: | This statement should be used by advanced users only since irrevocable alteration of your application may occur. |
| Returns: | Invalid. |
| Usage: | Script Only. |
| Function Groups: | Compilation and On-Line Modifications, Graphics, Advanced Module |
| Related to: | SetModuleRefBox |
Format: ![]() |
SetInstanceRefBox(Module, Left, Bottom, Right, Top) |
| Parameters: |
| Module |
| Required. Any expression for the object value of the instance of the module. |
| Left |
| Required. Any numeric expression for the left side of the reference box for Module's graphics. |
| Bottom |
| Required. Any numeric expression for the bottom side of the reference box for Module's graphics. |
| Right |
| Required. Any numeric expression for the right side of the reference box for Module's graphics. |
| Top |
| Required. Any numeric expression for the top side of the reference box for Module's graphics. |
| Comments: |
This function adds a way to set the module reference box of a single module instance programmatically. If a module has SetInstanceRefBox called for an instance of it, then SetModuleRefBox will not affect that instance. Comparing the two functions, SetModuleRefBox provides a way to programmatically set the default size of a module whereas SetInstanceRefBox provides a way to set the size of a specific instance of a module. In any of the parameters are omitted, or if one or more is invalid, the instance-specific reference box will be cleared. |
Examples:
The following is a widget that will draw the image, which is specified by its full path name in the text parameter, at its native size:
{================== Image Widget ======================}
(
ImageChoice <:"Select Image":> Text;
)
[
Title = "ImageWidget";
Shared UserMethods (LIBRARIES);
bWidth = 1 { default size is 1x1} ;
bHeight = 1 ;
bObj { bitmap object ref } ;
]
Init [
If Watch(1) WidgetMain;
[
ifelse(ImageChoice,
bObj = MakeBitmap(ImageChoice),
bObj = MakeBitmap("\Bitmaps\Icons\Question icon.bmp"));
bWidth = PickValid(BitmapInfo(bObj, 0), 1);
bHeight = PickValid(BitmapInfo(bObj, 1), 1);
SetInstanceRefBox(Self, 0, bHeight, bWidth, 0);
]
]
WidgetMain [
GUIBitmap(0, 1, 1, 0 { Bounding box of image },
1 - 0, bHeight, bWidth, 1 - 0, 1 { Scaling },
0, 0 { No trajectory or rotation },
1 { Bitmap is visible },
0 { Reserved },
4 { Left mouse button activates },
0 { Focus ID number },
0 { Focus trigger },
bObj { Bitmap to show });
]
