Hello from a Filemaker renegade

Trevor DeVore trevor at mangomultimedia.com
Thu Apr 8 11:35:23 EDT 2004


On Apr 8, 2004, at 4:24 AM, Norman Winn wrote:
> Which objects should I use to make a grid display of small, simple 
> images? I want to have around 30 variables that contain images, say 
> 16X16 pixels. The grid would fill with these images depending on 
> external data. Columns represent days and rows represent the timeline 
> of a stock item (resource). Tell me to go away and do the work if this 
> is too detailed a question,

I would create a group that would hold your image grid.  This allows 
you to easily delete all of the images each time you want to recreate 
the grid -

repeat with i = number of controls of group "MyGroup" down to 1
     delete control i of group "MyGroup"
end repeat

If you ever have to scroll your image grid then you can set the 
vScrollbar of the group to true -

if (formattedHeight of group "MyGroup" > height of group "MyGroup") 
then set vScrollbar of group "MyGroup" to true

Here is some code I use in one of my applications.  My array is 
populated by a database query which is where tTutorialData comes from -

put 10 into tRowLimit
put left of group "Tutorials" into tLeftEdge
put tLeftEdge into tX
put top of group "Tutorials" into tY
put 100 into tWidth
put 100 into tHeight
put 10 into tMarginY
put 10 into tMarginX

repeat with i = 1 to tTutorialData["Length"]    	
     ##
     ## Create image
     ##
     create image ("Media_" & tTutorialData["Data",i,"ID"]) in group 
"Tutorials"
     put it into tObjRef
     set fileName of tObjRef to libSys_AppPath() & "/Media/" & 
tTutorialData["Data",i,"Thumbnail"]
     set the uID of tObjRef to tTutorialData["Data",i,"ID"]
     set width of tObjRef to tWidth
     set height of tObjRef to tHeight
     set topLeft of tObjRef to (tX, tY)

     ## Adjust next positions
     if (i mod tRowLimit = 0) then
       put tLeftEdge into tX
       add tHeight to tY
       add tMarginY to tY
     else
       add tMarginX to tX
       add tWidth to tX
     end if
end repeat

Hope this helps,

-- 
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com






More information about the use-livecode mailing list