Re: Deprecated "Graphics" dropped

Jon Ogden <[email protected]> Wed, 26 Dec 2018 10:51:33 -0600
Newsgroups gmane.comp.lang.realbasic.user
Message-ID <[email protected]>
You have access to the graphics object of a picture always. Just not for a w=
indow or container control.=20

Sent from my iPhone

> On Dec 26, 2018, at 10:43 AM, Daniel Drijard <[email protected]> wrot=
e:
>=20
>   I have used the BackDrop method proposed by Jim McKay, with success in g=
eneral, but not in Modules. There I have no Paint Event. I tried to create a=
 Picture and filled it but in the absence of a Paint Event I am stuck.=20
>=20
> Happy New Year to you
> 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