Graphics referenced ByRef method

Hi,

I noticed that in Xojo 2019.1 when the g Graphics of paint event of a canvas is referenced in a method by ByRef, nothing works anymore like in the previous versions of Xojo. Is that normal or a bug?

Regards,
Payam

I can’t answer your question, but I am curious why you’d ever do that.

I don’t know why I did that, but I saw that it worked in all previous versions of Xojo, and now suddenly it doesn’t anymore.

ByRef allows a method to replace the data in the calling method’s variable and can be very handy in many situations. This is not one of those situations. :slight_smile: If this really is a bug in Xojo, file a report, but also stop doing that as it could lead to odd or even crashy behavior. (Yes, “crashy” is a word, no need to look that up.)

:slight_smile: Yes I understand. But I don’t understand the policy of Xojo. They completely disable what used to work from the very beginning.

(^_^)

Unless they realized that this could lead to some severe issues, I doubt they did it intentionally, but I don’t pretend to speak for them. They go out their way to keep from breaking code even when the existing stuff can be harmful, e.g., the availability of App.DoEvents in desktop apps.

Edit: That should read, “In my experience, they go out of their way…”

I notice that my problem is a different issue. I put the whole code in the Paint event, but still the problem persists. So just forget about this thread.

I doubt it is a “bug”, but more likely it fixed what should have been a “bug” in previous releases
“graphics” is an object pointer… “byref” infers you can change the value… but for an object you can only change its attributes (ie. you can not create a “new” graphics object)

[quote=432058:@Dave S]I doubt it is a “bug”, but more likely it fixed what should have been a “bug” in previous releases
“graphics” is an object pointer… “byref” infers you can change the value… but for an object you can only change its attributes (ie. you can not create a “new” graphics object)[/quote]
You could by creating a picture then assigning its graphics to the one passed in byref
But I have no idea what it would do and would expect problems if you did this in an event param the runtime passed in