New topic: Displaying embedded pictures at runtime.
<http://forums.realsoftware.com/viewtopic.php?t=46188> Page 1 of 1 [ 9 posts ] Previous topic | Next topic Author Message neilwillatt Post subject: Displaying embedded pictures at runtime.Posted: Mon Dec 10, 2012 10:06 am Joined: Mon Dec 10, 2012 9:39 am Posts: 4 My project uses embedded pictures (Ones which I have dragged into the project window during build). I embed the pictures rather than storing them in an external file because it is a convenient way of making it impossible for the user to see them without running the application. I want to write a subroutine which displays these pictures one after the other when a button is clicked. In VB I would simply give the pictures names such as 'Picture1', 'Picture2' ... etc and then display them using a command such as Dim i as integer ImageWell1.Picture = "Picture"+Str(i) i = i + 1 When I try to do this in Real Basic I get an error which says 'Expected Picture but got String' or somkething to that effect. Is there anyway of converting the String variable to a Picture variable, or can anybody suggest another way of doing this ? Top jakuno Post subject: Re: Displaying embedded pictures at runtime.Posted: Mon Dec 10, 2012 10:32 am Joined: Fri Aug 31, 2012 3:56 pm Posts: 30 Look at this sample: https://dl.dropbox.com/u/103694210/SwitchPict.zip Top neilwillatt Post subject: Re: Displaying embedded pictures at runtime.Posted: Mon Dec 10, 2012 1:38 pm Joined: Mon Dec 10, 2012 9:39 am Posts: 4 Thanks Jakuno, thats cool, I've run it and it seems to do exactly what I want to do, but I can't see your code anywhere. Where have you hidden it ? Top jakuno Post subject: Re: Displaying embedded pictures at runtime.Posted: Mon Dec 10, 2012 1:51 pm Joined: Fri Aug 31, 2012 3:56 pm Posts: 30 Look at MyCanvas Class Top neilwillatt Post subject: Re: Displaying embedded pictures at runtime.Posted: Mon Dec 10, 2012 4:25 pm Joined: Mon Dec 10, 2012 9:39 am Posts: 4 Thanks for all the help you've given me so far, but now I can't see how you have managed to get 'MyCanvas' into the project as an item which you can give properties like 'Pict()' and 'WhichPict'. I can only get the Canvas to go into a window, and therefore I can't give it any properties. Top jakuno Post subject: Re: Displaying embedded pictures at runtime.Posted: Mon Dec 10, 2012 4:50 pm Joined: Fri Aug 31, 2012 3:56 pm Posts: 30 Be aware the Super of Window1.Canvas1 is MyCanvas. Top timhare Post subject: Re: Displaying embedded pictures at runtime.Posted: Mon Dec 10, 2012 5:50 pm Joined: Fri Jan 06, 2006 3:21 pm Posts: 11874 Location: Portland, OR USA In the Project tab, use Add Class to add a new class to the project. Set the name of the class to MyCanvas and set the Super of the class to Canvas. Edit the class and add properties, etc. Top neilwillatt Post subject: Re: Displaying embedded pictures at runtime.Posted: Tue Dec 11, 2012 5:01 am Joined: Mon Dec 10, 2012 9:39 am Posts: 4 Thanks Jakuno & Tim, but my list of possible 'Supers' to Classes doesn't include 'Canvas'. Alphabetically it goes from 'Bounds3D' to 'Clipboard'. Are you working on the 'Enterprise' edition of Real Studio. I only have the 'Professional' Edition. This is the only reason I can think of for you having a more extensive list of 'Supers' than me. Top jakuno Post subject: Re: Displaying embedded pictures at runtime.Posted: Tue Dec 11, 2012 5:38 am Joined: Fri Aug 31, 2012 3:56 pm Posts: 30 Type "Canvas" via Keyboard in the Super Property of your new Class, or Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 9 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
