WEB2 Page SHOWN event, way to late to initialize visual controls?

Web2.0 was supposed to be a modern framework, but unfortunately it inherited many of the problems from web 1.0.

The Shown event in pages is one of those big problems, while other frameworks try to focus on pre-rendered pages, Xojo has a pretty bad event order that make it look bad and feel sluggish:

  • First SHOW the uninitialized controls
  • Make a roundtrip to the server to know what to initialize
  • Move things around in front of the user worsening perception of slowness

Is there any workaround to initialize controls before those are shown to the user?

For example, to resize some element depending on the page width.

You can set those using the locks right? setting .left .top .width and .height later is a bad idea in web.

The controls don’t exist until they are shown. However, you could probably set them as invisible, modify their size, and then set them visible.

In RubberViewsWE, I use CSS and JavaScript to resize controls client side, so it is faster and more fluid.

1 Like

In web, Good Idea/Bad Idea… it all depends on the framework capabilites.

A really common example, You have an UI element with a MaxWidth of 900px (a table for example), if the Viewport is smaller it could be smaller up to the Viewport MinWidth, but if yo have a Maximized window larger than 900px the table should be 900px centered…

Acording to xojo, you should show the table and after the fact, resize it. :man_facepalming:t2:

That is relative… They dont exist on the DOM, but the DO EXISTS virtually on the server, so with a proper desing, it should be posible to use code to initialize the controls on the opening event, Then the client framework can create the controls on the DOM and inmediatly aply the initializing code.

There is a huge difference between wishes and actual implementation.

I offered a possible workaround. Now you do as you please.

Perhaps you want to file a feature request.

2 Likes

Xojo Web is not HTML/CSS/JS plain, xojo web has a managed framework. Your better off creating different pages for different purposes just like ios where a screen is more like a form. you can close a page if you don’t need it anymore in memory or keep it unclosed to be able to switch back (again like ios view hiërarchie).

It’s best to go with that xojo provides rather than to go the HTML/CSS/JS thinking (e.g. websites), remember it’s a Web Application.

2 Likes