Creating an auto-updating button icon thumbnail image from card snapshot

Keith Clarke keith.clarke at clarkeandclarke.co.uk
Fri Apr 1 13:30:37 EDT 2011


Hi Jaque,
Thanks for responding. This is what I ended up with for updating a single button. I'm quite pleased with the result, because, as there are 'moving parts' on the visited cards, when I return to the home screen it is updated with thumbnails reflecting the current 'just left' view of the visited cards, rather than the default from when the presentation was first opened. 

on openCard
   --Delete the old thumbnail and set button to 'Updating'
   delete image "Snapshot-Example"
   set the showName of button "btn Example" to true
   set the label of button "btn Example" to "Updating Image"
   
   --get the new card snapshot and make it identifiable
   import snapshot from rectangle 0,0,1024,768 of card "Example"
   set the name of the last image to "Snapshot-Example"
   
   --scales the snapshot to thumbnail size
   set the height of the last image to 150
   set the width of the last image to 200
   
   --Make it the button's icon image and hide the updating message
   set the icon of button "btn Example" to the ID of the last image
   set the showName of button "btn Example" to false
   set the label of button "btn Example" to "Example"
   
   --Hide the imported snapshot
   set the layer of the last image to 1
end openCard

Once I have wrapped it in a loop for all the navigation buttons on the 'home' screen, I will publish a how-to document. This will be one of a few switching guides I have in mind for LiveCode newbies like me who were PowerPoint 'power user'. In my case, PowerPoint was my 'IDE for non-functioning wish-list-ware' for a couple of decades <gulp!>. 
Best,
Keith..





More information about the use-livecode mailing list