Re: Deprecated "Graphics" dropped
Jon Ogden <[email protected]> Fri, 28 Dec 2018 09:32:11 -0600
| Newsgroups | gmane.comp.lang.realbasic.user |
|---|---|
| Message-ID | <[email protected]> |
Great job, Daniel! =20 I am impressed for 82 years old! The backdrop property is what you could consider to be the default image of t= he canvas. All other drawings are done on top of the backdrop. As it is a pi= cture you still have access to the graphics object of the picture. That=E2=80= =99s why this suggestion by Jim was the easiest to be implemented.=20 There is no reason that Xojo would be changing this backdrop property in the= future. So I think you are safe! Regards, Jon Sent from my iPhone > On Dec 28, 2018, at 4:22 AM, Daniel Drijard <[email protected]> wrote= : >=20 > I have received many messages to help me. I want to thank all of them. I= have used the method using BackDrop proposed by Jim Kay. I have tried some o= thers, but preferred that one of Jim, easier, faster to implement. I recall y= ou that I had VERY MANY errors in my project. Using Jim=E2=80=99s method too= k me many hours (correcting, confirming, I am 82 years old) but my project i= s now working fine.=20 > I suspect that the correction method I used is much faster, humanwise, t= han rewriting the code in the =E2=80=9Cnew=E2=80=9D XOJO conventions would b= e. I see no interest in this rewriting, given that I have now a XOJO version= 2 and a XOJO version 4 both working fine.=20 > I understand that the corrections I implemented might not be valid in fu= ture XOJO versions. I JUST EXPERIMENTED that if I created now a new version o= f my code, I would have no guarantee either that it would be usable in futur= e XOJO versions.=20 >=20 > I wish you a HAPPY NEW YEAR.=20 > Daniel >=20 >>> On 26 12 2018, at 13:27, Emile SCHWARZ <[email protected]> wrot= e: >>>=20 >>> These types of errors happen on multiple other Modules. What should I do= ? >>=20 >> Just before I closed the web tab, I noticed that. >>=20 >>=20 >>=20 >> I do not think you followed Xojo way of doing (the links I sent you). >>=20 >>=20 >>=20 >> In a simple sentence: you cannot anymore use Graphics elsewhere of the Pa= int Event (so, not in a Module). >>=20 >> In a Module case, create a new Picture (say Pict1), draw into it, then in= the place where you want to display the art, in the Paint Event use some co= de like: >>=20 >> If Pict1 <> Nil Then >>=20 >> g.DrawPicture Pict1,0,0 >>=20 >> End If >>=20 >>=20 >>=20 >> I hope this helps. >>=20 >>=20 >>=20 >> Have a happy new year. >>=20 >>=20 >>=20 >>> Envoy=C3=A9 : 26 d=C3=A9cembre 2018 =C3=A0 12:40de : Daniel Drijard <Dan= [email protected]> >>> =C3=A0 : Nug <nug-Ktk10zIkF/Jvqtv/[email protected]> >>> objet : Re: Deprecated "Graphics" dropped >>>=20 >>>=20 >>> Jim,=20 >>>=20 >>> I followed your proposition and, indeed, some compilation errors disappe= ared. Some of them are, however, still present. In a Module ModWindow they p= rotest to my code >>> "Me.Graphics.clearRect Me.Left,Me.Top,MeWidth,Me.Height=E2=80=9D >>> by >>> "This method extends class Canvas, but the base expression is class ModW= indow.ModWindow=E2=80=9D >>> and to >>> "Graphics.clearRect(0,0,1000,1000)=E2=80=9D >>> by >>> =E2=80=9CStatic reference to instance method: call this on an instance o= f class Graphics.=E2=80=9D >>>=20 >>> There are as well errors on other codes such as >>> "Me.Graphics.drawstring(str1,430,65,200)=E2=80=9D >>>=20 >>> These types of errors happen on multiple other Modules. What should I do= ? >>>=20 >>> Cordially,=20 >>> Daniel >>>=20 >>>=20 >>>> On 23 12 2018, at 19:53, Jim McKay <[email protected]> wrote: >>>>=20 >>>> My solution is very simple. You add a module to your project (via the m= enu Insert->Module), call it =E2=80=9CGraphicsBandaid=E2=80=9D or whatever. A= dd a single method. Now your old code works, unmodified. I'm not understandi= ng how that is complex. >>>>=20 >>>> After you've added the new method, calls to canvas1.graphics will simpl= y be forwarded to canvas1.backdrop.graphics >>>>=20 >>>> The only real solution is to rewrite your code to only access the graph= ics from inside the paint event. >>>>=20 >>>> On Dec 23, 2018, at 6:34 AM, Daniel Drijard <[email protected]> wr= ote: >>>>=20 >>>> I got later a new answer from [email protected] who proposes something more= complex to escape the problem, without solving it. >>>>=20 >>> Daniel Drijard >>> Thoiry t=C3=A9l=C3=A9phone :=20 >>> 04 50 41 22 75 >>> international >>> +33/4 50 41 22 75 >>> Courriel : >>> [email protected] >>> Thoiry F-01710 >>> 48, rue des Savoies >>>=20 >=20 > Daniel Drijard > Thoiry t=C3=A9l=C3=A9phone :=20 > 04 50 41 22 75 > international > +33/4 50 41 22 75 > Courriel : > [email protected] > Thoiry F-01710 > 48, rue des Savoies >=20