Change ImgTag bitmap source
Hi all
I made a dialog using ImgTag to place a bitmap on it.
Is there a way to change the bitmap used for the ImgTag, choosing it on a dropdownlist?
Here is my try:
rollout progressTest ("Choose Logo!") ( local bm001 = openBitMap("D:\\Test\\logo_001.jpg") local bm002 = openBitMap("D:\\Test\\logo_002.jpg") imgTag CPanel_BMP "Logo" bitmap:bm001 align:#left dropdownlist LogoList "Choose Logo" items:#("001 - Red Logo","002 - Blue Logo") ) on LogoList selected selID do ( MyLogo = "bm" + (substring LogoList.items[selID] 1 3) CPanel_BMP.bitmap = MyLogo )
>> MAXScript Rollout Handler Exception:
-- Type error: set .bitmap requires BitMap, got: #bm002 <<
Someone could help me to understand where I'm wrong?
Thanks in advance,
David
Comments
Problem solved
rollout test "Untitled" width:328 height:539
(
dropdownList 'ddl1' "DropDownList" pos:[16,26] width:288 height:40 items:#("", "1", "2") align:#left
bitmap 'image' "Bitmap" pos:[4,226] width:319 height:200 align:#left
on ddl1 selected sel do
if ddl1.selection==2 then
(
image.filename = @"C:\01.jpg"
)
else
if ddl1.selection==3 then
(
image.filename = @"C:\02.jpg"
)
else
if ddl1.selection==1 then
image.filename = @"C:\03.jpg"
)
Createdialog test
...
Post your code or snippet
bga
Oops! You are right,
Oops! You are right, sorry...
I just edit my post, entering the code I tried
...
What is the "CustomModel.items" here? I don't see that this is related to any control in rollout
bga
Damn... it's "LogoList", not
Damn... it's "LogoList", not "CustomModel", sorry.
...
bga
If options are already added ?
what can be done to get rid of both the code complexity and reduce the base?
exapmle
rollout Test "Untitled" width:162 height:257
(
dropDownList 'ddl7' "DropDownList" pos:[7,19] width:148 height:40 items:#("", "1", "2") align:#left
imgtag 'cust4' "???" pos:[8,118] width:146 height:124 align:#left
on Test open do
if ddl7.selection==2 then
(
bmp001 = openBitMap (@"C:\1.bmp")
cust4.bitmap = bmp001
)
)
createdialog Test
...
Chance size of imgTag control to mach size of icon
bga