PDA

View Full Version : Thumbnail and button in same group


floyd1510
11-12-2009, 06:43 AM
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.

PEN
11-12-2009, 12:24 PM
Can you post the code that you have so far? we just need to see that direction that you are trying to go.

VVaari
11-12-2009, 02:42 PM
Does it have to be buttons? I've done similar task using dotnet listview with LargeIcon style.

VVaari
11-12-2009, 03:12 PM
Heres a quick example. Code assumes that you have your maxfiles in c:\test 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:\\test\\*.max"
)

on sceneList open do
(
initLv sceneLv
collectScenes()
fillLv sceneLv
)

on sceneList close do
(
imageList.dispose()
)

)
createDialog sceneList
)

floyd1510
11-16-2009, 11:58 AM
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.

CGTalk Moderation
11-16-2009, 11:58 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.