Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Jul 23, 2018 4:43 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Displaying embedded pictures at runtime.
PostPosted: Mon Dec 10, 2012 10:06 am 
Offline

Joined: Mon Dec 10, 2012 9:39 am
Posts: 6
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
 Profile  
Reply with quote  
 Post subject: Re: Displaying embedded pictures at runtime.
PostPosted: Mon Dec 10, 2012 10:32 am 
Offline

Joined: Fri Aug 31, 2012 3:56 pm
Posts: 82
Look at this sample: https://dl.dropbox.com/u/103694210/SwitchPict.zip


Top
 Profile  
Reply with quote  
 Post subject: Re: Displaying embedded pictures at runtime.
PostPosted: Mon Dec 10, 2012 1:38 pm 
Offline

Joined: Mon Dec 10, 2012 9:39 am
Posts: 6
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
 Profile  
Reply with quote  
 Post subject: Re: Displaying embedded pictures at runtime.
PostPosted: Mon Dec 10, 2012 1:51 pm 
Offline

Joined: Fri Aug 31, 2012 3:56 pm
Posts: 82
Look at MyCanvas Class

Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Displaying embedded pictures at runtime.
PostPosted: Mon Dec 10, 2012 4:25 pm 
Offline

Joined: Mon Dec 10, 2012 9:39 am
Posts: 6
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
 Profile  
Reply with quote  
 Post subject: Re: Displaying embedded pictures at runtime.
PostPosted: Mon Dec 10, 2012 4:50 pm 
Offline

Joined: Fri Aug 31, 2012 3:56 pm
Posts: 82
Be aware the Super of Window1.Canvas1 is MyCanvas.

Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Displaying embedded pictures at runtime.
PostPosted: Mon Dec 10, 2012 5:50 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
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
 Profile  
Reply with quote  
 Post subject: Re: Displaying embedded pictures at runtime.
PostPosted: Tue Dec 11, 2012 5:01 am 
Offline

Joined: Mon Dec 10, 2012 9:39 am
Posts: 6
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
 Profile  
Reply with quote  
 Post subject: Re: Displaying embedded pictures at runtime.
PostPosted: Tue Dec 11, 2012 5:38 am 
Offline

Joined: Fri Aug 31, 2012 3:56 pm
Posts: 82
Type "Canvas" via Keyboard in the Super Property of your new Class, or

Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Displaying embedded pictures at runtime.
PostPosted: Tue Dec 11, 2012 12:31 pm 
Offline

Joined: Mon Dec 10, 2012 9:39 am
Posts: 6
Fantastic. Got it working now. Thanks very much. There's a lot more to this than you think when you first start out. I hadn't much idea what adding new classes was all about, let alone 'supers' on top of them. Can anybody tell me how best to learn more about this stuff. Are there any really good books. I have 'Beginning Real Basic from Novice to Professional' but that only scratches the surface.


Top
 Profile  
Reply with quote  
 Post subject: Re: Displaying embedded pictures at runtime.
PostPosted: Tue Dec 11, 2012 2:39 pm 
Offline

Joined: Mon Dec 10, 2012 9:39 am
Posts: 6
Hi, I was wondering whether it would be possible to get a push button to control the picture changes instead of clicking on the canvas. I tried making the two properties public, and then copying the picture changing code into the pushbutton's action method, but I couldn't work out what I should change the 'me' to. I tried MyCanvas, but that didn't work. Any suggestions ?


Top
 Profile  
Reply with quote  
 Post subject: Re: Displaying embedded pictures at runtime.
PostPosted: Tue Dec 11, 2012 3:05 pm 
Offline

Joined: Fri Aug 31, 2012 3:56 pm
Posts: 82
Try: https://dl.dropbox.com/u/103694210/SwitchPict2.zip

My way to learn RealStudio

1. Look at the SampleCode coming with RS
2. Analyse the available free SourceCode http://www.realsoftware.com/community/resources.php
3. View Training Videos: http://www.bkeeney.com
4. Buy 'Killer Toolbar' with SourceCode access and learned a much
5. Buy ‘Formatted Text Control' with SourceCode access and learned much more
6. Buy 'RS PlugIns' http://www.monkeybreadsoftware.de/realb ... gins.shtml and look at the SampleCode


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group