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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

...

Post your code or snippet

barigazy

David_Lee's picture

Oops! You are right,

Oops! You are right, sorry...
I just edit my post, entering the code I tried

barigazy's picture

...

What is the "CustomModel.items" here? I don't see that this is related to any control in rollout

barigazy

David_Lee's picture

Damn... it's "LogoList", not

Damn... it's "LogoList", not "CustomModel", sorry.

barigazy's picture

...

try(DestroyDialog ::progressTest)catch()
rollout progressTest "LogoRoll"
(
	local logos = #()
	imgTag CPanel_BMP "Logo" align:#left width:80 height:80 pos:[10,10]
	dropdownlist LogoList "Choose Logo:" pos:[10,95] width:80 --items:#("001 - Red Logo","002 - Blue Logo")
 
	on progressTest open do
	(
		local items = #()
		if doesFileExist @"D:\Test\logo_001.jpg" do
		(
			bmp001 = openBitMap (@"D:\Test\logo_001.jpg")
			close bmp001 ; append logos bmp001
			append items "001 - Red Logo" ; CPanel_BMP.bitmap = bmp001
		)
		if doesFileExist @"D:\Test\logo_001.jpg" do
		(
			bmp001 = openBitMap (@"D:\Test\logo_002.jpg")
			close bmp001 ; append logos bmp001 ; append items "002 - Blue Logo"
		)
		LogoList.items = items
	)
	on LogoList selected id do (CPanel_BMP.bitmap = logos[id])
	on progressTest close do (freeSceneBitmaps() ; gc light:on)
)
createDialog progressTest 100 140 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

barigazy

barigazy's picture

...

Chance size of imgTag control to mach size of icon

barigazy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.