New topic: Making The Canvas A Global Entity
<http://forums.realsoftware.com/viewtopic.php?t=45873> Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message RBnoob2012 Post subject: Making The Canvas A Global EntityPosted: Sun Nov 11, 2012 10:08 pm Joined: Sat Aug 18, 2012 11:23 am Posts: 16 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 timhare Post subject: Re: Making The Canvas A Global EntityPosted: Sun Nov 11, 2012 10:46 pm Joined: Fri Jan 06, 2006 3:21 pm Posts: 11795 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 RBnoob2012 Post subject: Re: Making The Canvas A Global EntityPosted: Sun Nov 11, 2012 11:14 pm Joined: Sat Aug 18, 2012 11:23 am Posts: 16 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 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 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]
