Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Aug 17, 2017 10:07 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Making The Canvas A Global Entity
PostPosted: Sun Nov 11, 2012 10:08 pm 
Offline

Joined: Sat Aug 18, 2012 11:23 am
Posts: 21
Hi, me again ... still trying to shift my VB brain to RB.

In VB2010 if I put a PictureBox on Form1 I can manipulate it from Form2 even if Form2 is modal.

In RB I'm not able to manipulate Canvas1 on Form1 from another modal form.

Canvas1 is Public and I thought I understood that to mean its scope was outside its parent form.

What I'm trying to do is this:

I have Canvas1 on Form1. It sizes to the size of Form1.

As per my last post here, I learned to use DrawScreen to draw everything to a buffer and then use:
Canvas1.Refresh(False)
to fire the paint event which sets the buffer onto Canvas1. I got that working fine.

The problem is that unless I send Canvas1 as a parameter of my DrawScreen sub-routine, I cannot use Canvas1.Refresh(False).

Having to send Canvas1 as a parameter to DrawScreen prevents me from manipulating the screen from my modal Form2.

What am I missing that makes Canvas1 interactable from other Forms?

Thanks for your help,
RBnoob


Top
 Profile  
Reply with quote  
 Post subject: Re: Making The Canvas A Global Entity
PostPosted: Sun Nov 11, 2012 10:46 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Canvas1 exists on an instance of a window. You must use that instance variable name to access it.

Form1.Canvas1.Refresh(false)

- or -

dim w as new Form1
w.Canvas1.Refresh(false)

All depends on how you instantiate the window. The first example uses implicit instantiation. The second is explicit.


Top
 Profile  
Reply with quote  
 Post subject: Re: Making The Canvas A Global Entity
PostPosted: Sun Nov 11, 2012 11:14 pm 
Offline

Joined: Sat Aug 18, 2012 11:23 am
Posts: 21
ROFLMAO.

Oh my God, I can't believe how stupid I am. I just got done writing Form1.PictureBox1 in the VB2010 project to make sure I was right about being able to manipulate a the PicBox ... and it NEVER occurs to me that I'd have to do the same thing in RB.

Wow. Well, it's an indication of how much I've come to rely on all the little Intellisense-like aspects of VB2010.

Thanks for your help, timhare, I got it working ... and thanks for not laughing YOUR ass off at me!

Best Wishes,
RBnoob


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