imgTag

User Interface Controls > Common Properties > Layout > Types > ImgTag

 

   

Creating User Interfaces - Quick Navigation

The ImgTag UI Control can be used to place images in MAXScript Rollouts. Other than the Bitmap UI Control, it does not have a sunken edge and can be integrated better in the layout. In addition, it supports transparency effects and various mouse handlers which could be used to design customized controls.

The syntax is:

imgTag <name> [caption] [tooltip:<string>] [style:<key>] [bitmap:<bitmap>] [opacity:<float>] [transparent:<color>] [iconName:<filename>] [iconSize:<point2>]	 

   

Properties:

<ImgTag>.tooltip String default:""   

   

<ImgTag>.bitmap Bitmap default:undefined 

Current image being displayed.

   

<ImgTag>.style Key default:#bmp_stretch 

Way the bitmap will be displayed in the control.

Can be one of the following:

 #bmp_stretch #bmp_tile #bmp_center 

   

<ImgTag>.opacity float default:0.0 

Overall opacity of the image, can range from 0.0 to 1.0

   

<ImgTag>.transparent color default:(color 0 0 0) 

The RGB color in the source bitmap to treat as transparent.

NOTE:

Opacity and transparent properties only have an effect in Windows 2000 and higher. These do not have an effect in NT.

   

<ImgTag>.iconName string

Specifies the filename of an icon file to load.

   

<ImgTag>.iconSize point2

Specifies the icon's size at 100% DPI scaling.

   

Methods:

 getIconAsBitmap <iconName> iconSize:<point2> enabled:<bool> on:<bool> applyUIScaling:<bool>

-- defaults values: [24,24], true, false, true

NEW in 3ds Max 2017: Returns the icon as a bitmap value, if the icon is found. Returns undefined if it is not found.

EXAMPLE

b = getIconAsBitmap @"PolyTools\TransformTools\PB_CW"
getIconSizes <iconName> enabled:<bool> on:<bool>
 -- defaults values: true, false

Returns an array of icon sizes that are defined for the specified icon file. Returns undefined if the icon is not found.

EXAMPLE

getIconSizes @"PolyTools\TransformTools\PB_CW"
#([20,20], [25,25], [30,30], [40,40])

   

Events:

on <ImgTag> mousedown do <expr> 

Called when the left mouse button is pressed down.

   

on <ImgTag> mouseup do <expr> 

Called when the left mouse button is released.

   

on <ImgTag> click do <expr> 

Called when the left mouse button is released.

   

on <ImgTag> dblclick do <expr> 

Called when the left mouse button double clicked.

   

on <ImgTag> mouseover do <expr> 

Called when the mouse is moved into the image area.

   

on <ImgTag> mouseout do <expr> 

Called when the mouse is moved out of the image area.

   

on <ImgTag> rightclick do <expr> 

Called when the right mouse button is released. Available in 3ds Max 8 and higher.

   

on <ImgTag> lbuttondown <Point2> <Flags> do <expr> 

Called when the left mouse button has been pressed. Available in 3ds Max 8 and higher.

The first argument contains a Point2 value representing the 0-based pixel coordinates within the ImgTag.

The second argument is the Flags value which is a combination of the following bits:

Hexadecimal

Decimal

Binary

Key Pressed

0x0001

1

00000001

The left mouse button is down.

0x0002

2

00000010

The right mouse button is down.

0x0004

4

00000100

The SHIFT key is down.

0x0008

8

00001000

The CTRL key is down.

0x0010

16

00010000

The middle mouse button is down.

0x0020

32

00100000

The first X button is down (the left side button of the mouse)

0x0040

64

01000000

The second X button is down (the right side button of the mouse)

You can use the bit.get() method to determine whether a key is pressed or not:

EXAMPLE

rollout ui_imgtag "imgtag"
(
local bm = bitmap 50 50 color:red
imgtag img_tag "imgtag" bitmap:bm align:#center
fn printButtonStates Flags =
(
LMB = bit.get Flags 1
RMB = bit.get Flags 2
SHIFT = bit.get Flags 3
CTRL = bit.get Flags 4
MMB = bit.get Flags 5
XB1 = bit.get Flags 6
XB2 = bit.get Flags 7
format "LMB:% MMB:% RMB:% SHIFT:% CTRL:% XB1:% XB2:%\n" LMB MMB RMB SHIFT CTRL XB1 XB2
)
on img_tag lbuttondown v1 v2 do printButtonStates v2
on img_tag mbuttondown v1 v2 do printButtonStates v2
on img_tag rbuttondown v1 v2 do printButtonStates v2
)
createdialog ui_imgtag width:100

   

on <ImgTag> lbuttonup <Point2> <Flags> do <expr> 

Called when the left mouse button has been released. Available in 3ds Max 8 and higher.

The first argument contains a Point2 value representing the 0-based pixel coordinates within the ImgTag.

The second argument is the Flags value as described above.

   

on <ImgTag> lbuttondblclk <Point2> <Flags> do <expr> 

Called when the left mouse button has been double-clicked. Available in 3ds Max 8 and higher.

The first argument contains a Point2 value representing the 0-based pixel coordinates within the ImgTag.

The second argument is the Flags value as described above.

   

on <ImgTag> mbuttondown <Point2> <Flags> do <expr> 

Called when the middle mouse button has been pressed. Available in 3ds Max 8 and higher.

The first argument contains a Point2 value representing the 0-based pixel coordinates within the ImgTag.

The second argument is the Flags value as described above.

   

on <ImgTag> mbuttonup <Point2> <Flags> do <expr> 

Called when the middle mouse button has been released. Available in 3ds Max 8 and higher.

The first argument contains a Point2 value representing the 0-based pixel coordinates within the ImgTag.

The second argument is the Flags value as described above.

   

on <ImgTag> mbuttondblclk <Point2> <Flags> do <expr> 

Called when the middle mouse button has been double-clicked. Available in 3ds Max 8 and higher.

The first argument contains a Point2 value representing the 0-based pixel coordinates within the ImgTag.

The second argument is the Flags value as described above.

   

on <ImgTag> rbuttondown <Point2> <Flags> do <expr> 

Called when the middle mouse button has been pressed. Available in 3ds Max 8 and higher.

The first argument contains a Point2 value representing the 0-based pixel coordinates within the ImgTag.

The second argument is the Flags value as described above.

   

on <ImgTag> rbuttonup <Point2> <Flags> do <expr> 

Called when the middle mouse button has been released. Available in 3ds Max 8 and higher.

The first argument contains a Point2 value representing the 0-based pixel coordinates within the ImgTag.

The second argument is the Flags value as described above.

   

on <ImgTag> rbuttondblclk <Point2> <Flags> do <expr> 

Called when the middle mouse button has been double-clicked. Available in 3ds Max 8 and higher.

The first argument contains a Point2 value representing the 0-based pixel coordinates within the ImgTag.

The second argument is the Flags value as described above.

EXAMPLE

rcmenu MyRCmenu
(
menuItem mi_cs "First Option" checked:false
menuItem mi_rs "Second Option" checked:false
)
rollout ui_items "ui items"
(
button a2 "button"
on a2 rightClick do print a2
checkbutton a4 "checkbutton"
on a4 rightClick do print a4
local bm = bitmap 50 50 color:red
imgtag b5 "imgtag" bitmap:bm align:#center
on b5 mousedown v1 v2 do
format "% ; % ; % ; %\n" b5 #mousedown v1 v2
on b5 lbuttondown v1 v2 do
format "% ; % ; % ; %\n" b5 #lbuttondown v1 v2
on b5 mbuttondown v1 v2 do
format "% ; % ; % ; %\n" b5 #mbuttondown v1 v2
on b5 rightClick v1 v2 do
format "% ; % ; % ; %\n" b5 #rightClick v1 v2
on b5 rbuttondown v1 v2 do
format "% ; % ; % ; %\n" b5 #rbuttondown v1 v2
on b5 mouseup v1 v2 do
format "% ; % ; % ; %\n" b5 #mouseup v1 v2
on b5 click v1 v2 do
format "% ; % ; % ; %\n" b5 #click v1 v2
on b5 lbuttonup v1 v2 do
format "% ; % ; % ; %\n" b5 #lbuttonup v1 v2
on b5 mbuttonup v1 v2 do
format "% ; % ; % ; %\n" b5 #mbuttonup v1 v2
on b5 rbuttonup v1 v2 do
format "% ; % ; % ; %\n" b5 #rbuttonup v1 v2
on b5 dblclick v1 v2 do
format "% ; % ; % ; %\n" b5 #dblclick v1 v2
on b5 lbuttondblclk v1 v2 do
format "% ; % ; % ; %\n" b5 #lbuttondblclk v1 v2
on b5 mbuttondblclk v1 v2 do
format "% ; % ; % ; %\n" b5 #mbuttondblclk v1 v2
on b5 rbuttondblclk v1 v2 do
format "% ; % ; % ; %\n" b5 #rbuttondblclk v1 v2
on b5 mouseout v1 v2 do
format "% ; % ; % ; %\n" b5 #mouseout v1 v2
on b5 mouseover v1 v2 do
format "% ; % ; % ; %\n" b5 #mouseover v1 v2
mapbutton a11 "mapButton"
on a11 rightClick do print a11
materialbutton a12 "materialbutton"
on a12 rightClick do print a12
pickbutton a13 "pickbutton"
on a13 rightClick do (print a13; popupmenu MyRCmenu)
)
createdialog ui_items width:100

See Also