« XML and JSON Colorize… | Home | Trace with parameter … »

Prepare a Xojo Web 1 app for Web 2

Last week we had a Moving from Web 1 to Web 2 with lots of experiences I got when moving an app from older to newer web frameworks in Xojo.

While Web 1.0 apps with Xojo still work well, we have to make preparations for the eventual move. Some applications may just get obsolete and may never need to be ported. But some critical business applications need to survive. Eventually something will fail in the next years. May it be a change in JavaScript, CSS or HTML handling in a browser. It may be a minor thing somewhere, but if it drives users insane, it will come to our desk.

What web controls do we use?

Please search for the following things as they may be gone now:

  • WebAnimator
  • WebScrollbar
  • WebPageSource
  • WebSeparator
  • WebYoutubeMovie
  • And WebDialog with palette mode

Since those controls are gone in Web 2, you have to look if you use any of them and consider replacements.

Do you use control arrays?

Since there are no control arrays in Web 2 as of today, you my need to change code there.
Either by using containers or by dynamically adding controls at runtime. See Xojo blog article.

Do we use styles?

Once we move, the default colors can come from a bootstrap theme. But for all controls on the various webpages and containers, we need to move the style assignment to code, e.g. do it in the open events. As we may already know what theme we use, some of the styles may no longer be in need.

Make a list which controls in which webpage needs what styling and make it explicit in code since the assignments will be gone.
Check if you use styles for listbox columns, rows or cells as you need to change those .

Do you use session properties?

If you use platform property in session to switch between desktop and mobile layouts, you may need to change that based on size of web page. To query browser, you need to parse UserAgent string yourself.

Do you use toolbars?

You may need to change your use of toolbars to build them in code since the toolbar editor is done.
Best may be to change it in the old project to recreate it there before switching.

Do you use mouse events?

Some mouse events got changed. For the Web Listbox, they no longer report X and Y coordinates. For listbox you get row and column, which may still be enough to know about for your event for Pressed and DoublePressed.

MouseEnter, MoueMove and MouseExit events are gone across the controls. You may need to adjust.

Do you use WebFileUploader?

The new version doesn't manage a file list for you. If you need to know how many files are in the list, you have to make your own property. Count up in FileAdded event and count down in FileRemoved event. But you can prepare that beforehand.

API 2 name changes

You could make a module in Web 2 to bring back old names with extends keyword to add methods to classes.
So either you add new names like RemoveRowAt to the old Xojo version in a compatibility module and switch all code to use the new name. Or you do other way and add in Web 2 the old Web 1 names.

Deployment changes

The new applications run as stand alone. You may use apache as transparent proxy to keep the old URL to the outside. It may be good to setup a new server and once everything works, switch over the DNS to point to the new machine at night.

Final thoughts

Before moving the project, do some preparation work in the old Xojo version. This includes changing toolbars to be setup in code instead of the editor. Remove use of removed controls and classes. For styles go through them and try to generate styles you need in code since style editor is gone in Web 2.

If you do preparations before moving, you may reduce the time of transition and be quicker with deployment.

Anything we missed?

20 01 22 - 15:17