Re: Deprecated "Graphics" dropped

Jon Ogden <[email protected]> Wed, 26 Dec 2018 08:40:56 -0600
Newsgroups gmane.comp.lang.realbasic.user
Message-ID <[email protected]>
--Apple-Mail-F1C03CC9-7771-4D8F-AB65-BC1A4C979F51
Content-Type: text/plain;
	charset=utf-8
Content-Transfer-Encoding: quoted-printable

You can use graphics in a module method. However, the graphics object must b=
e passed into the method from the paint event if the canvas.=20

The paint event of the canvas exposes the graphics object. =46rom there you c=
an pass the graphics object to any other method, function, class, etc and do=
 all the same operations on it.=20

Jon

Sent from my iPhone

> On Dec 26, 2018, at 6:27 AM, Emile SCHWARZ <[email protected]> wr=
ote:
>=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 Pai=
nt Event (so, not in a Module).
>=20
> In a Module case, create a new Picture (say Pict1), draw into it, then in t=
he place where you want to display the art, in the Paint Event use some code=
 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 <Dani=
[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 disappea=
red. Some of them are, however, still present. In a Module ModWindow they pr=
otest 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 ModWi=
ndow.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 of=
 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 me=
nu 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 simply=
 be forwarded to canvas1.backdrop.graphics
>>>=20
>>> The only real solution is to rewrite your code to only access the graphi=
cs from inside the paint event.
>>>=20
>>> On Dec 23, 2018, at 6:34 AM, Daniel Drijard <[email protected]> wro=
te:
>>>=20
>>> I got later a new answer from [email protected] who proposes something more c=
omplex 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

--Apple-Mail-F1C03CC9-7771-4D8F-AB65-BC1A4C979F51
Content-Type: text/html;
	charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=3D=
utf-8"></head><body dir=3D"auto">You can use graphics in a module method. Ho=
wever, the graphics object must be passed into the method from the paint eve=
nt if the canvas.&nbsp;<div><br></div><div>The paint event of the canvas exp=
oses the graphics object. =46rom there you can pass the graphics object to a=
ny other method, function, class, etc and do all the same operations on it.&=
nbsp;</div><div><br></div><div>Jon</div><div><br><div id=3D"AppleMailSignatu=
re" dir=3D"ltr">Sent from my iPhone</div><div dir=3D"ltr"><br>On Dec 26, 201=
8, at 6:27 AM, Emile SCHWARZ &lt;<a href=3D"mailto:[email protected]=
r">[email protected]</a>&gt; wrote:<br><br></div><blockquote type=3D=
"cite"><div dir=3D"ltr">


    <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF-8"=
>
 <p>&gt;These types of errors happen on multiple other Modules. What should I=
 do ?</p><p>Just before I closed the web tab, I noticed that.<br></p><p><br>=
</p><p>I do not think you followed Xojo way of doing (the links I sent you).=
<br></p><p><br></p><p>In a simple sentence: you cannot anymore use Graphics e=
lsewhere of the Paint Event (so, not in a Module).<br></p><p>In a Module cas=
e, create a new Picture (say Pict1), draw into it, then in the place where y=
ou want to display the art, in the Paint Event use some code like:<br></p><p=
>If Pict1 &lt;&gt; Nil Then<br></p><p>g.DrawPicture Pict1,0,0</p><p>End If<b=
r></p><p><br></p><p>I hope this helps.<br></p><p><br></p><p>Have a happy new=
 year.<br></p><p><br></p><blockquote type=3D"cite"><p>Envoy=C3=A9 : 26 d=C3=A9=
cembre 2018 =C3=A0 12:40de : Daniel Drijard &lt;<a href=3D"mailto:Daniel.Dri=
[email protected]">[email protected]</a>&gt;<br>=C3=A0 : Nug &lt;<a href=3D"=
mailto:nug-Ktk10zIkF/Jvqtv/[email protected]">nug-Ktk10zIkF/Jvqtv/[email protected]</a>&gt;<br>objet : Re: Depreca=
ted "Graphics" dropped<br><br><br>Jim, <br><br> I followed your proposition a=
nd, indeed, some compilation errors disappeared. Some of them are, however, s=
till present. In a Module ModWindow they protest to my code<br> "Me.Graphics=
.clearRect Me.Left,Me.Top,MeWidth,Me.Height=E2=80=9D<br> by<br> "This method=
 extends class Canvas, but the base expression is class ModWindow.ModWindow=E2=
=80=9D<br> and to<br> "Graphics.clearRect(0,0,1000,1000)=E2=80=9D<br> by<br>=
 =E2=80=9CStatic reference to instance method: call this on an instance of c=
lass Graphics.=E2=80=9D<br><br> There are as well errors on other codes such=
 as<br> "Me.Graphics.drawstring(str1,430,65,200)=E2=80=9D<br><br> These type=
s of errors happen on multiple other Modules. What should I do ?<br><br>Cord=
ially, <br>Daniel<br><br></p><blockquote type=3D"cite"><p>On 23 12 2018, at 1=
9:53, Jim McKay &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; w=
rote:<br><br>My solution is very simple. You add a module to your project (v=
ia the menu Insert-&gt;Module), call it =E2=80=9CGraphicsBandaid=E2=80=9D or=
 whatever. Add a single method. Now your old code works, unmodified. I'm not=
 understanding how that is complex.<br><br>After you've added the new method=
, calls to canvas1.graphics will simply be forwarded to canvas1.backdrop.gra=
phics<br><br>The only real solution is to rewrite your code to only access t=
he graphics from inside the paint event.<br><br>On Dec 23, 2018, at 6:34 AM,=
 Daniel Drijard &lt;<a href=3D"mailto:[email protected]">daniel.drijard=
@cern.ch</a>&gt; wrote:<br><br>I got later a new answer from <a href=3D"mail=
to:[email protected]">[email protected]</a> who proposes something more complex to e=
scape the problem, without solving it.</p></blockquote><p>Daniel Drijard<br>=
Thoiry t=C3=A9l=C3=A9phone : <br> 04 50 41 22 75<br> international<br> +33/4=
 50 41 22 75<br>Courriel :<br> <a href=3D"mailto:[email protected]">dan=
[email protected]</a><br>Thoiry F-01710<br> 48, rue des Savoies</p></block=
quote>
</div></blockquote></div></body></html>=

--Apple-Mail-F1C03CC9-7771-4D8F-AB65-BC1A4C979F51--