New topic: 

graphics deprecated - use paint instead - how to change code

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

         Page 1 of 1
   [ 4 posts ]                 Previous topic | Next topic          Author  
Message        edcnow          Post subject: graphics deprecated - use paint 
instead - how to change codePosted: Thu Jan 17, 2013 12:33 am                   
      
Joined: Sun Aug 28, 2011 12:15 pm
Posts: 7                I am trying to upgrade an old program that I have not 
looked for 2 years.
I now get an error that graphics had been deprecated.
How do I change the following code so it still works?
Thanks,
Deb

**************
  dim p as picture
  dim g as graphics
  //dim x as integer
  g=main.canAssessQuestion.graphics
  
  if intLsn=intVisLsnNo and intNew = 0 and LR = false then 
  p=map(Z)
  g.drawpicture 
map(Z),0,0,main.canAssessQuestion.width,main.canAssessQuestion.height,0,0,p.width,p.height
 
  main.canAssessQuestion.Visible = true
  end if
  
  current=Z   
                             Top                timhare          Post subject: 
Re: graphics deprecated - use paint instead - how to change Posted: Thu Jan 17, 
2013 1:06 am                         
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 11991
Location: Portland, OR  USA                Add a property to the window, thePic 
as Picture.  In your code, set

thePic = map(Z)
main.canAssessQuestion.Invalidate

In the canvas Paint event, draw thePic

if thePic <> Nil then
g.DrawPicture thePic, 0,0,me.Width,me.Height, 0,0,thePic.Width,thePic.Height
end if   
                             Top                edcnow          Post subject: 
Re: graphics deprecated - use paint instead - how to change Posted: Thu Jan 17, 
2013 1:29 am                         
Joined: Sun Aug 28, 2011 12:15 pm
Posts: 7                Is this what you mean?
Btw: I get an error when I use me.width and me.height



  dim g as graphics
  dim thePic as picture
  
  if intLsn=intVisLsnNo and intNew = 0 and LR = false then
   thePic = map(Z)
  main.canAssessQuestion.Invalidate
    if thePic <> Nil then
     g.DrawPicture thePic, 0,0,me.Width,me.Height, 
0,0,thePic.Width,thePic.Height
    end if
  main.canAssessQuestion.Visible = true
  end if
  
  current=Z   
                             Top                timhare          Post subject: 
Re: graphics deprecated - use paint instead - how to change Posted: Thu Jan 17, 
2013 1:44 am                         
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 11991
Location: Portland, OR  USA                Um, no.  What I mean is change
dim p as picture
dim g as graphics
//dim x as integer
g=main.canAssessQuestion.graphics

if intLsn=intVisLsnNo and intNew = 0 and LR = false then
  p=map(Z)
  g.drawpicture 
map(Z),0,0,main.canAssessQuestion.width,main.canAssessQuestion.height,0,0,p.width,p.height
  main.canAssessQuestion.Visible = true
end if

current=Z

to
if intLsn=intVisLsnNo and intNew = 0 and LR = false then
  thePic=map(Z)
  main.canAssessQuestion.Invalidate
  main.canAssessQuestion.Visible = true
end if

current=Z

Where thePic is a property that you add to the window.

Then in the canvas canAssessQuestion, in the Paint event put
if thePic <> Nil then
  g.DrawPicture thePic, 0,0,me.Width,me.Height, 0,0,thePic.Width,thePic.Height
end if
   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 4 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