« MBS Real Studio Plugi… | Home | MBS Releases the MBS … »

Web Application event live cycle

Which events come in which order is really a good question and you should know a few facts here. First the order of events in a very small web application with two pages and one button to switch to second page:
  • App.Open
  • Session.Constructor
  • Session.Open
  • WebPage1.Button1.Open
  • WebPage1.Open
  • WebPage1.Resized
  • WebPage1.Shown
  • WebPage1.Button1.Shown
  • WebPage1.Button1.Action
  • WebPage2.Open
  • WebPage2.Resized
  • WebPage1.Hidden
  • WebPage1.Button1.Hidden
  • WebPage2.Shown
  • WebPage2.Close
  • WebPage1.Button1.Close
  • WebPage1.Close
  • Session.Close
  • Session.Destructor
  • WebPage2.Destructor
  • WebPage1.Destructor
  • App.Close
First event is App.Open called right when the application launches. Sometime later, the first session is created and you get first Constructor and then Open event called. The session needs a webpage, so the default webpage is shown. For the website, first the controls are created and their open events fire, before the actually open event of the page fires. Than the website is resized to the size of the browser window and we get a resized event. Finally we get a Shown event, first on the webpage, than on the controls.

Now the user presses a button with the mouse. The button action fires and we use "webpage2.show" to switch to other page. As you see the second page is created with open event firing and resized. Than first page hides, before second page is shown.

When the user closes the browser window, nothing happens until a timeout after which the session is destroyed. So you see the webpages get their Close events including all the controls on them. The session is also closed and destructor fires. Finally also the destructors of the webpages fire. And on the end, when the web app quits, the app.close event is called.

Important note: Webpages are not released from memory before the session closes.

Sample project: livecycle.rbp.zip The biggest plugin in space...
17 01 12 - 12:35