Re: Deprecated "Graphics" dropped

Jon Ogden <[email protected]> Sun, 23 Dec 2018 10:12:12 -0600
Newsgroups gmane.comp.lang.realbasic.user
Message-ID <[email protected]>
--Apple-Mail-F3ED7DFA-4C23-45AF-A7B2-EAA38DAC83A0
Content-Type: text/plain;
	charset=utf-8
Content-Transfer-Encoding: quoted-printable

I gave you a pretty simple and easy answer yesterday. The reality is you nee=
d to only make calls to graphics in the paint event.=20

Again here are my suggestions:

1.) Draw into a picture property in your MouseDown event. Paint the picture i=
n the canvas paint event. You can access the canvas property of a picture.=20=


2.) Put York drawing code in MouseDown into a method with the graphics objec=
t as a parameter. Add a MouseDwn Boolean property to your canvas. Set MouseD=
wn to True when the Mouse is down and false when up. Call Refresh or Invalid=
ate when the mouse state changes. In the Paint event check for MouseDwn bein=
g true. If it is then call your method. Pass the graphics parameter into the=
 method.=20

These are two simple ways to do what you want.=20

It=E2=80=99s been years now since Xojo has said that you should not access t=
he Graphics object outside the paint event. Years. They have been warning of=
 it being removed.=20

Merry Christmas,

Jon=20

Sent from my iPhone

> On Dec 23, 2018, at 7:34 AM, Daniel Drijard <[email protected]> wrote=
:
>=20
> Hello,=20
>=20
>    I have sent a request for help on 22/12/2018 (copied). I got answers fr=
om James Wagner and Keith DeLong and thanked them that I was still not able t=
o solve my problem which is due to the dropping of =E2=80=9CGraphics=E2=80=9D=
 in version 3. I got later a new answer from [email protected] who proposes some=
thing more complex to escape the problem, without solving it. This is not wh=
at I look for.=20
>    I have an easy solution: keep using XOJO version 2, and consequently no=
t renewing my license with XOJO, which is not a constructive action.=20
>    There is maybe a smarter solution: myself paying somebody to correct my=
 code. I hope somebody in the XOJO team can translate the old code conventio=
ns into the new ones. This is unfortunately far from being evident for a pla=
in user as I am. I suspect that somebody in the XOJO team could be intereste=
d by this deal.=20
>=20
>    I wait for a positive answer.
>=20
> Cordially,=20
> Daniel
>=20
>=20
>>> On Dec 22, 2018, at 8:31 AM, Daniel Drijard <[email protected]> wro=
te:
>>>=20
>>>   Dropping happened in version Xojo 2018 Release 3. I was not aware of t=
he deprecation which happened a few years earlier. Now I would like to use v=
ersion Xojo 2018 Release 4, but this imposes multiple modifications of my pr=
oject.=20
>>>=20
>>>   My project spans a few thousands of lines of code. The =E2=80=9Cerrors=
=E2=80=9D generated by the new version of Xojo are very numerous (a few hund=
reds). Fortunately, I suspect they are only due to a small number of reasons=
, which I have not identified yet.=20
>>>=20
>>>   Here is a piece of code is refused, there are many other types of prob=
lem.=20
>>>   MouseDown is here part of the ColorButton of a Controls, itself part o=
f a Window construct. The error mentioned is that =E2=80=9CType Canvas has n=
o member named Graphics=E2=80=9D neither Width and Height.
> <<<<<<<<<<<<<
>>> MouseDown(X As Integer, Y As Integer) As Boolean
>>> Dim c as Color
>>> Dim b as Boolean
>>> c=3Drgb(255,255,255) //default color
>>> b=3DSelectColor(c,"Select a Text Color")
>>> If b then
>>> Me.Graphics.ForeColor=3Dc
>>> Me.Graphics.FillRect(1,1,Me.Graphics.Width-2, Me.Graphics.Height-2)=20
>>> TextField.SelTextColor=3Dc
>>> End if
>>> <<<<<<<<<<<<<<<
>>>=20
>>>    I am told to look into the Documentation of Release 3, page 825 and, s=
eparately, into Graphics and Multimedia a part of Example Projects. I did my=
 best but this is not really helpful. I find there no hint on how this shoul=
d be modified.=20
>>>=20
>>> Cordially,=20
>>> Daniel
>=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

--Apple-Mail-F3ED7DFA-4C23-45AF-A7B2-EAA38DAC83A0
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">I gave you a pretty simple and easy answer y=
esterday. The reality is you need to only make calls to graphics in the pain=
t event.&nbsp;<div><br></div><div>Again here are my suggestions:</div><div><=
br></div><div>1.) Draw into a picture property in your MouseDown event. Pain=
t the picture in the canvas paint event. You can access the canvas property o=
f a picture.&nbsp;</div><div><br></div><div>2.) Put York drawing code in Mou=
seDown into a method with the graphics object as a parameter. Add a MouseDwn=
 Boolean property to your canvas. Set MouseDwn to True when the Mouse is dow=
n and false when up. Call Refresh or Invalidate when the mouse state changes=
. In the Paint event check for MouseDwn being true. If it is then call your m=
ethod. Pass the graphics parameter into the method.&nbsp;</div><div><br></di=
v><div>These are two simple ways to do what you want.&nbsp;</div><div><br></=
div><div>It=E2=80=99s been years now since Xojo has said that you should not=
 access the Graphics object outside the paint event. Years. They have been w=
arning of it being removed.&nbsp;</div><div><br></div><div>Merry Christmas,<=
/div><div><br></div><div>Jon&nbsp;<br><br><div id=3D"AppleMailSignature" dir=
=3D"ltr">Sent from my iPhone</div><div dir=3D"ltr"><br>On Dec 23, 2018, at 7=
:34 AM, Daniel Drijard &lt;<a href=3D"mailto:[email protected]">Daniel.=
[email protected]</a>&gt; wrote:<br><br></div><blockquote type=3D"cite"><div d=
ir=3D"ltr">

<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8">


<div dir=3D"auto" style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; -=
webkit-line-break: after-white-space;" class=3D"">
<div dir=3D"auto" style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; -=
webkit-line-break: after-white-space;" class=3D"">
Hello,&nbsp;
<div class=3D""><br class=3D"">
</div>
<div class=3D"">&nbsp; &nbsp;I have sent a request for help on 22/12/2018 (c=
opied). I got answers from&nbsp;<span style=3D"font-family: Helvetica; orpha=
ns: 2; widows: 2;" class=3D"">James Wagner and&nbsp;</span>Keith DeLong and t=
hanked them that I was still not able to solve my problem
 which is due to the dropping of =E2=80=9CGraphics=E2=80=9D in version 3. I g=
ot later a new answer from&nbsp;<a href=3D"mailto:[email protected]" class=3D"">=
[email protected]</a> who proposes something more complex to escape the problem,=
 without solving it. This is not what I look for.&nbsp;</div>
<div class=3D"">&nbsp; &nbsp;I have an easy solution: keep using XOJO versio=
n 2, and consequently not renewing my license with XOJO, which is not a cons=
tructive action.&nbsp;</div>
<div class=3D"">&nbsp; &nbsp;There is maybe a smarter solution: myself payin=
g somebody to correct my code. I hope somebody in the XOJO team can translat=
e the old code conventions into the new ones. This is unfortunately far from=
 being evident for a plain user as I am.
 I suspect that somebody in the XOJO team could be interested by this deal.&=
nbsp;</div>
<div class=3D""><br class=3D"">
</div>
<div class=3D"">&nbsp; &nbsp;I wait for a positive answer.</div>
<div class=3D""><br class=3D"">
</div>
<div class=3D"">Cordially,&nbsp;</div>
<div class=3D"">Daniel</div>
<div class=3D""><br class=3D"">
</div>
<div class=3D"">
<div><br class=3D"">
<blockquote type=3D"cite" class=3D"">
<div class=3D"">
<div style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-=
break: after-white-space;" class=3D"">
<div class=3D"">
<div class=3D"">
<blockquote type=3D"cite" class=3D"">
<div class=3D"">On Dec 22, 2018, at 8:31 AM, Daniel Drijard &lt;<a href=3D"m=
ailto:[email protected]" class=3D"">[email protected]</a>&gt; wrot=
e:</div>
<br class=3D"Apple-interchange-newline">
<div class=3D"">
<div class=3D"">&nbsp;&nbsp;Dropping happened in version Xojo 2018 Release 3=
. I was not aware of the deprecation which happened a few years earlier. Now=
 I would like to use version Xojo 2018 Release 4, but this imposes multiple m=
odifications of my project.
<br class=3D"">
<br class=3D"">
&nbsp;&nbsp;My project spans a few thousands of lines of code. The =E2=80=9C=
errors=E2=80=9D generated by the new version of Xojo are very numerous (a fe=
w hundreds). Fortunately, I suspect they are only due to a small number of r=
easons, which I have not identified yet.
<br class=3D"">
<br class=3D"">
&nbsp;&nbsp;Here is a piece of code is refused, there are many other types o=
f problem. <br class=3D"">
&nbsp;&nbsp;MouseDown is here part of the ColorButton of a Controls, itself p=
art of a Window construct. The error mentioned is that =E2=80=9CType Canvas h=
as no member named Graphics=E2=80=9D neither Width and Height.<br class=3D""=
>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;<br class=3D"">
<blockquote type=3D"cite" class=3D"">
<div class=3D"">
<div style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-=
break: after-white-space;" class=3D"">
<div class=3D"">
<div class=3D"">
<blockquote type=3D"cite" class=3D"">
<div class=3D"">
<div class=3D"">MouseDown(X As Integer, Y As Integer) As Boolean<br class=3D=
"">
Dim c as Color<br class=3D"">
Dim b as Boolean<br class=3D"">
c=3Drgb(255,255,255) //default color<br class=3D"">
b=3DSelectColor(c,"Select a Text Color")<br class=3D"">
If b then<br class=3D"">
Me.Graphics.ForeColor=3Dc<br class=3D"">
Me.Graphics.FillRect(1,1,Me.Graphics.Width-2, Me.Graphics.Height-2) <br clas=
s=3D"">
TextField.SelTextColor=3Dc<br class=3D"">
End if<br class=3D"">
&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;<br class=3D"">
<br class=3D"">
&nbsp;&nbsp;&nbsp;I am told to look into the Documentation of Release 3, pag=
e 825 and, separately, into Graphics and Multimedia a part of Example Projec=
ts. I did my best but this is not really helpful. I find there no hint on ho=
w this should be modified.
<br class=3D"">
<br class=3D"">
Cordially, <br class=3D"">
Daniel<br class=3D"">
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class=3D"">
<div class=3D"">
<div style=3D"color: rgb(0, 0, 0); letter-spacing: normal; text-align: start=
; text-indent: 0px; text-transform: none; white-space: normal; word-spacing:=
 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mo=
de: space; -webkit-line-break: after-white-space;" class=3D"">
<div style=3D"color: rgb(0, 0, 0); letter-spacing: normal; text-align: start=
; text-indent: 0px; text-transform: none; white-space: normal; word-spacing:=
 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mo=
de: space; -webkit-line-break: after-white-space;" class=3D"">
<div style=3D"color: rgb(0, 0, 0); letter-spacing: normal; text-align: start=
; text-indent: 0px; text-transform: none; white-space: normal; word-spacing:=
 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mo=
de: space; -webkit-line-break: after-white-space;" class=3D"">
<div style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-=
break: after-white-space;" class=3D"">
<div style=3D"color: rgb(0, 0, 0); font-family: Courier; font-size: 12px; fo=
nt-style: normal; font-variant-caps: normal; font-weight: normal; letter-spa=
cing: normal; text-align: start; text-indent: 0px; text-transform: none; whi=
te-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
Daniel Drijard<br class=3D"">
Thoiry t=C3=A9l=C3=A9phone :&nbsp;</div>
<div style=3D"color: rgb(0, 0, 0); font-family: Courier; font-size: 12px; fo=
nt-style: normal; font-variant-caps: normal; font-weight: normal; letter-spa=
cing: normal; text-align: start; text-indent: 0px; text-transform: none; whi=
te-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
&nbsp; 04 50 41 22 75</div>
<div style=3D"color: rgb(0, 0, 0); font-family: Courier; font-size: 12px; fo=
nt-style: normal; font-variant-caps: normal; font-weight: normal; letter-spa=
cing: normal; text-align: start; text-indent: 0px; text-transform: none; whi=
te-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
&nbsp; &nbsp; international</div>
<div style=3D"color: rgb(0, 0, 0); font-family: Courier; font-size: 12px; fo=
nt-style: normal; font-variant-caps: normal; font-weight: normal; letter-spa=
cing: normal; text-align: start; text-indent: 0px; text-transform: none; whi=
te-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
&nbsp; +33/4 50 41 22 75<br class=3D"">
Courriel :</div>
<div style=3D"color: rgb(0, 0, 0); font-family: Courier; font-size: 12px; fo=
nt-style: normal; font-variant-caps: normal; font-weight: normal; letter-spa=
cing: normal; text-align: start; text-indent: 0px; text-transform: none; whi=
te-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
&nbsp; &nbsp;<a href=3D"mailto:[email protected]" class=3D"">daniel.dri=
[email protected]</a><br class=3D"">
</div>
<div style=3D"color: rgb(0, 0, 0); font-family: Courier; font-size: 12px; fo=
nt-style: normal; font-variant-caps: normal; font-weight: normal; letter-spa=
cing: normal; text-align: start; text-indent: 0px; text-transform: none; whi=
te-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
Thoiry F-01710</div>
<div style=3D"color: rgb(0, 0, 0); font-family: Courier; font-size: 12px; fo=
nt-style: normal; font-variant-caps: normal; font-weight: normal; letter-spa=
cing: normal; text-align: start; text-indent: 0px; text-transform: none; whi=
te-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
&nbsp; &nbsp;48, rue des Savoies<br class=3D"">
</div>
</div>
</div>
</div>
</div>
</div>
<br class=3D"">
</div>
</div>
</div>


</div></blockquote></div></body></html>=

--Apple-Mail-F3ED7DFA-4C23-45AF-A7B2-EAA38DAC83A0--