hello, how I can create a picture gallery, reading the picture path from a table and displaying the picture file (PNG)
Here’s some ways I can think of.
-
generate some HTML in your Xojo app and then use a HTMLViewer to display it. Works incredibly well and provides smooth scrolling.
-
Use a canvas, load the pictures into memory and draw them. This is fairly easy code wise but very inefficient and slow to update.
-
Use declares or a plugin to load the thumbnails of the pictures and then CALayers to lay them out on a canvas. Most complicated; but most flexible and super smooth. Animation is also included for free.
-
Use declares or plugins to use the system supplied icon grid control. Never used it myself.
if you’re familiar with Obj-C you may want to use the IKImageBrwoser class:
https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/IKImageBrowserView/
If not, you can do it simply by using containers and a control class which handles,add,insert,remove, the layout and scrolling. It’s not very difficult. You may also use the listbox.
I like HTML suggestion too and would see an example
http://www.ohanaware.com/cards/
Download the demo, the template list is all HTML that the program generates.
Ok thanks
You can also draw the thumbs into a large Canvas:
- No htmlviewer,
- Some computations for the x,y locations
x: compute the value from the window width, the number of thumbs, the thumbs width and y
y: once you are near enough of the window rightmost position, increment it, reset x to the first thumb location and paint
And if you need to scroll vertically, add a ScrollBar at the rightmost location, near the Canvas.