[Closed] Thumbnail and button in same group
Hey all,
I’m developing a script which will get a list of max files and jpgs from a specified folder and display them as buttons to merge them. Now I can get one at a time. Can someone help me how I can get the thumbnail and the maxfile name grouped together as two buttons pointing to the same max file. So if there are say three max files in there, I will have three groups of buttons, with it’s thumbnail on top and the button with the max file name below.
Thanks,
Vikram.
Can you post the code that you have so far? we just need to see that direction that you are trying to go.
Does it have to be buttons? I’ve done similar task using dotnet listview with LargeIcon style.
Heres a quick example. Code assumes that you have your maxfiles in c: est and thumbnails are same name than max files (myScene1.max, myScene1.jpg etc.)
(
Global myScenes # ()
Global imageList = dotNetObject "System.Windows.Forms.ImageList"
try destroyDialog sceneList catch()
Rollout sceneList "Scenes" width:500 height:500
(
dotNetControl sceneLv "System.Windows.Forms.ListView" width:480 height:480
fn initLv theLv =
(
theLv.View = (dotNetClass "System.Windows.Forms.View").LargeIcon
theLv.Multiselect = false
theLv.Scrollable = true
)
fn fillLv theLv =
(
theLv.Clear()
theLv.items.Clear()
theLv.Refresh()
imageList.images.Clear()
imageList.Dispose()
imageList.imagesize = dotnetobject "System.Drawing.Size" 128 128
imageList.ColorDepth = imageList.ColorDepth.Depth32Bit
local thumbs = #()
local items = #()
for s = 1 to myScenes.count do
(
local filePrefix = (getFilenamePath myScenes[s]) + (getFilenameFile myScenes[s])
local thumbFile = filePrefix + ".jpg"
local maxFile = filePrefix + ".max"
append thumbs ((dotNetClass "System.Drawing.Image").fromFile thumbFile)
local item = dotNetObject "System.Windows.Forms.ListViewItem" (filenameFromPath maxFile)
item.name = maxFile
item.imageIndex = s - 1
theLv.items.add item
)
imageList.images.addrange thumbs
theLv.LargeImageList = imageList
theLv.SmallImageList = imageList
for t in thumbs do t.dispose()
)
on sceneLv mouseUp arg do
(
hit=(sceneLv.HitTest (dotNetObject "System.Drawing.Point" arg.x arg.y))
if(hit != undefined AND hit.item != undefined) then
(
-- hit.item.name has full path of max scene
print hit.item.name
)
)
fn collectScenes =
(
myScenes = getFiles "c:\ est\\*.max"
)
on sceneList open do
(
initLv sceneLv
collectScenes()
fillLv sceneLv
)
on sceneList close do
(
imageList.dispose()
)
)
createDialog sceneList
)
Thanks VVari for that. That’s exactly what I wanted to do. The only problem is that I’m not that well versed with dotnet and was looking for a pure maxscript solution.
Hey Paul, am writing from home right now, so don’t have the code at this moment. but to give you an idea, i have thumbnails which merge maxfiles. with the across tag, i can have multiple thumbnails lined up horizontally, but need the name of the maxfile below them. they do not have to necessarily be buttons, can be labels too.
Cheers,
Vikram.