New topic: 

Picture Viewer nilobjectexception

<http://forums.realsoftware.com/viewtopic.php?t=47558>

         Page 1 of 1
   [ 5 posts ]                 Previous topic | Next topic          Author  
Message        traustitj          Post subject: Picture Viewer 
nilobjectexceptionPosted: Wed Apr 10, 2013 4:11 pm                         
Joined: Wed Oct 19, 2005 8:21 am
Posts: 132
Location: Norway                I have been using the Pictureviewer that Alex 
Restrepo created, and lately (last few years), it doesn't work in any Real 
Studio app.

It crashes when the project is starting, and I can't see why it does that or 
how to fix it. It tries to se a visible property on a canvas, which strangely 
hasn't been created yet.

I have the code, if someone wants it

Here it is : http://d.pr/f/JwF9      
_________________
=========================
 Merge pdfs, free. www.mergepdfs.com
=========================  
                             Top                doofus          Post subject: 
Re: Picture Viewer nilobjectexceptionPosted: Thu Apr 11, 2013 12:12 pm          
                       
Joined: Thu Sep 10, 2009 2:50 am
Posts: 392
Location: Santa Cruz, CA, USA                For objects placed on a window 
their computed properties get called/Set() even before the Constructor happens. 
With PictureViewer the Visible computed property is trying to change it's parts 
before they've been created.

So anyways, the easy fix is to simply remove that visible computed property. I 
don't see what it's for and it actually prevents the PictureViewer from ever 
being visible (the real property is always false). If you want it though try 
this...

Set(value As boolean)
  if pictureCanvas = nil then return //not constructed yet
  pictureCanvas.Visible=value
  options.Visible=value
  horizontalScroll.Visible=value
  verticalScroll.Visible=value
  ContainerControl(self).Visible = value //set the real Visible property too
End Set
   
                             Top                traustitj          Post 
subject: Re: Picture Viewer nilobjectexceptionPosted: Thu Apr 11, 2013 1:12 pm  
                       
Joined: Wed Oct 19, 2005 8:21 am
Posts: 132
Location: Norway                I already tried this but the object isnt usable 
that way. No scaling button and no matter what I do, it never becomes visible   
   
_________________
=========================
 Merge pdfs, free. www.mergepdfs.com
=========================  
                             Top                doofus          Post subject: 
Re: Picture Viewer nilobjectexceptionPosted: Thu Apr 11, 2013 2:30 pm           
                      
Joined: Thu Sep 10, 2009 2:50 am
Posts: 392
Location: Santa Cruz, CA, USA                traustitj wrote: I already tried 
this but the object isnt usable that way. Which way, deleted the property or 
changed the code.

traustitj wrote:No scaling button and no matter what I do, it never becomes 
visibleHmm, I don't know. What OS are you on? Works for me on 2012r2.1 mac both 
ways. If it never becomes visible I'm thinking you used the code change and 
there you have to have that last line that sets the real Visible property of 
the ContainerControl. But really that makes all the code pointless. I mean, if 
you're changing the visibility there's no need to change all the sub parts 
right? It's just reimplementing Visible to do exactly what Visible already 
does!? And it's shadowing a property which can lead to other issues.

My recommendation is to delete it entirely, it's of no use as far as I can 
tell. Though Restrepo does good code so maybe I can't tell as far.   
                             Top                traustitj          Post 
subject: Re: Picture Viewer nilobjectexceptionPosted: Thu Apr 11, 2013 2:39 pm  
                       
Joined: Wed Oct 19, 2005 8:21 am
Posts: 132
Location: Norway                I stand corrected. Just by deleting the visible 
property, all is well again. Everything works.
I had tried to put blocks around the set visible, but that did not work.

Deleting the property works like a charm.

Thanks.      
_________________
=========================
 Merge pdfs, free. www.mergepdfs.com
=========================  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 5 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]

Reply via email to