Discussion:
App events order
Jean-Luc Arnaud
2017-03-21 17:50:16 UTC
Permalink
Hi all,

When using the OpenDocument event of an application, in what order are
events fired?

In particular, does this OpenDocument event fire before Open event?

TIA for any help
--
Jean-Luc Arnaud


_______________________________________________

Xojo forum:

https://forum.xojo.com/
Jon Ogden
2017-03-21 18:03:27 UTC
Permalink
I don't think event order is guaranteed to happen in any particular order. From what I have read, it's not good practice to code in a manner that requires events to happen in a certain order.

Sent from my iPhone
Post by Jean-Luc Arnaud
Hi all,
When using the OpenDocument event of an application, in what order are events fired?
In particular, does this OpenDocument event fire before Open event?
TIA for any help
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.com/
Jean-Luc Arnaud
2017-03-22 08:39:23 UTC
Permalink
Thanks for your reply, Jon.

Sure, and I don't code so.

Nevertheless, I read in the Language's reference that Open event of the
app fires first, whatever is happening. I would like to be sure, in
particular for the OpenDocument event.

Else, how do you deal with all initialization code which is usually in
the Open event, if OpenDocument may fire first?

Jean-Luc Arnaud
Post by Jon Ogden
I don't think event order is guaranteed to happen in any particular order. From what I have read, it's not good practice to code in a manner that requires events to happen in a certain order.
Sent from my iPhone
Post by Jean-Luc Arnaud
Hi all,
When using the OpenDocument event of an application, in what order are events fired?
In particular, does this OpenDocument event fire before Open event?
TIA for any help
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.com/
fqd
2017-03-22 09:32:27 UTC
Permalink
Jean Luc,

App.Open event raises first since years, whatever RB or Xojo version.

So all Init code should be in Open Event.

After the Open event, it depends if you ara using a command line or
opening a existing document.


HTH, Fred
Post by Jean-Luc Arnaud
Thanks for your reply, Jon.
Sure, and I don't code so.
Nevertheless, I read in the Language's reference that Open event of
the app fires first, whatever is happening. I would like to be sure,
in particular for the OpenDocument event.
Else, how do you deal with all initialization code which is usually in
the Open event, if OpenDocument may fire first?
Jean-Luc Arnaud
Post by Jon Ogden
I don't think event order is guaranteed to happen in any particular
order. From what I have read, it's not good practice to code in a
manner that requires events to happen in a certain order.
Sent from my iPhone
On Mar 21, 2017, at 12:50 PM, Jean-Luc Arnaud
Hi all,
When using the OpenDocument event of an application, in what order are events fired?
In particular, does this OpenDocument event fire before Open event?
TIA for any help
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.com/
Jean-Luc Arnaud
2017-03-22 10:26:20 UTC
Permalink
Thanks for your reply.

Unfortunately, it seems to no longer be true, at least with Xojo
2016r4.1 Mac.

Testing that repeatedly, it's about fifty-fifty either Open or
OpenDocument firing first.

Does anyone have the same result?

Jean-Luc Arnaud
Post by fqd
Jean Luc,
App.Open event raises first since years, whatever RB or Xojo version.
So all Init code should be in Open Event.
After the Open event, it depends if you ara using a command line or
opening a existing document.
HTH, Fred
Post by Jean-Luc Arnaud
Thanks for your reply, Jon.
Sure, and I don't code so.
Nevertheless, I read in the Language's reference that Open event of
the app fires first, whatever is happening. I would like to be sure,
in particular for the OpenDocument event.
Else, how do you deal with all initialization code which is usually
in the Open event, if OpenDocument may fire first?
Jean-Luc Arnaud
Post by Jon Ogden
I don't think event order is guaranteed to happen in any particular
order. From what I have read, it's not good practice to code in a
manner that requires events to happen in a certain order.
Sent from my iPhone
On Mar 21, 2017, at 12:50 PM, Jean-Luc Arnaud
Hi all,
When using the OpenDocument event of an application, in what order are events fired?
In particular, does this OpenDocument event fire before Open event?
TIA for any help
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.com/
Jean-Luc Arnaud
2017-03-22 10:17:34 UTC
Permalink
Replying to myself.

Actually, Open or OpenDocument events never fire in the same order. So
Open is _*not*_ the very first event.

So, it will be painfull to recode taking that into consideration...

If any advise, your help is welcome.

Jean-Luc Arnaud
Post by Jean-Luc Arnaud
Thanks for your reply, Jon.
Sure, and I don't code so.
Nevertheless, I read in the Language's reference that Open event of
the app fires first, whatever is happening. I would like to be sure,
in particular for the OpenDocument event.
Else, how do you deal with all initialization code which is usually in
the Open event, if OpenDocument may fire first?
Jean-Luc Arnaud
Post by Jon Ogden
I don't think event order is guaranteed to happen in any particular
order. From what I have read, it's not good practice to code in a
manner that requires events to happen in a certain order.
Sent from my iPhone
On Mar 21, 2017, at 12:50 PM, Jean-Luc Arnaud
Hi all,
When using the OpenDocument event of an application, in what order are events fired?
In particular, does this OpenDocument event fire before Open event?
TIA for any help
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.com/
Markus Winter
2017-03-22 10:52:35 UTC
Permalink
Have a boolean NeedsInitiation as True

Have Init method

Set NeedsInitiation to False at end

Call Init method in both Open and OpenDocument like this

If NeedsInitiation then Init


MfG

Markus

Sent from my iPad
Post by Jean-Luc Arnaud
If any advise, your help is welcome.
_______________________________________________

Xojo forum:

https://forum.xojo.com/
Jean-Luc Arnaud
2017-03-22 11:38:02 UTC
Permalink
Seems clear, obvious and great!

Thanks for the idea, Markus

Jean-Luc Arnaud
Post by Markus Winter
Have a boolean NeedsInitiation as True
Have Init method
Set NeedsInitiation to False at end
Call Init method in both Open and OpenDocument like this
If NeedsInitiation then Init
MfG
Markus
Sent from my iPad
Post by Jean-Luc Arnaud
If any advise, your help is welcome.
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.com/

Loading...