Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Sep 19, 2019 3:55 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Canvas control array
PostPosted: Wed May 22, 2013 2:59 am 
Offline

Joined: Tue Aug 28, 2012 3:52 am
Posts: 28
I'm struggling with the following:

on a Window I place a Containercontrol. In that control I place a Canvas (myCanvas renamed to thumbCanvas). The canvas displays a JPEG as thumbnail.
With a method I want to clone that canvas and put it under the first canvas, fill it with a new JPEG

The first canvas is given an index '0'. In the action event of the button I try to clone the first canvas:
dim aCanvas as myCanvas
aCanvas = new thumbCanvas


But it doesn't work. Anybody who can point me in the right direction? Eventually I want to fill the Containercontrol with all the JPEGs in a given folder.
Help is highly appreciated....


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas control array
PostPosted: Wed May 22, 2013 3:41 am 
Offline
User avatar

Joined: Mon Apr 02, 2007 2:08 am
Posts: 1225
Location: San Francisco, CA, USA
If I understand what you're trying to do, then I think you might want to reconsider the design. Controls aren't intended to be used as moveable, overlapping objects. If you're trying to create a "draggable pictures" control (like the one seen here) then you should consider using a single canvas to draw the thumbnails on.

For example, you could have an array of items that specify a picture and a pair of coordinates. Then, in the Paint event of the canvas, draw the pictures in a loop. There have been a few discussions and examples of this technique on this forum and elsewhere.

_________________
Boredom Software


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas control array
PostPosted: Wed May 22, 2013 3:45 am 
Offline

Joined: Wed May 20, 2009 11:02 am
Posts: 423
Hi,

Is myCanvas the name of the class (canvas subclass, I guess) and thumbCanvas the name of the instance/object on the window?

And, what do you mean with "it doesn't work"?

Pixe

_________________
Using RS2011r4.3 on Windows7.


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas control array
PostPosted: Wed May 22, 2013 7:20 am 
Offline

Joined: Tue Aug 28, 2012 3:52 am
Posts: 28
pixe656 wrote:
Hi,

Is myCanvas the name of the class (canvas subclass, I guess) and thumbCanvas the name of the instance/object on the window?

And, what do you mean with "it doesn't work"?

Pixe

Ah, forgive me. English is not my mother tongue. Nothing is happening...


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas control array
PostPosted: Wed May 22, 2013 7:23 am 
Offline

Joined: Tue Aug 28, 2012 3:52 am
Posts: 28
charonn0 wrote:
If I understand what you're trying to do, then I think you might want to reconsider the design. Controls aren't intended to be used as moveable, overlapping objects. If you're trying to create a "draggable pictures" control (like the one seen here) then you should consider using a single canvas to draw the thumbnails on.

For example, you could have an array of items that specify a picture and a pair of coordinates. Then, in the Paint event of the canvas, draw the pictures in a loop. There have been a few discussions and examples of this technique on this forum and elsewhere.


OK. Thanks... I find the Graphics/Picture object difficult to comprehend. I will look into your examples. Thanks again.


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas control array
PostPosted: Wed May 22, 2013 6:34 pm 
Offline

Joined: Sat Oct 01, 2005 5:19 pm
Posts: 3216
Why? Control arrays are hacks, you have a Pro (or better) version of RB, so why not use a container control that just holds a canvas (or paint the jpeg directly onto the container controls themselves)?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 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