Sw4   >   Swgui5   >   swGui5 (All Contents)
The swGui5 library is the beginning of a new paradigm for the structure of window instances in StudioWorks.
The notes in this section and the classes in swGui5 library are under development and subject to change without notice.
StudioWorks developers are advised not to use any of the swGui5 classes.
The documentation in this section as subject to change without notice.Doing anything in the $construct methods of windows tends to push the stack limit especially when we have a container window that has multiple subwindows which are also running code in their $construct methods.
The other problem with $construct methods is that they are called by Omnis Studio so if an error happens in a $construct method we have no way of communicating the error to StudioWorks and stopping method excecution. Error handling and reporting them to the user from $construct methods gets messy.
In swGui5 we avoid using the $construct method in any class. With window instances it frees us from having to make sure the pWinInstID parameter is sent to a window's $construct.
In swGui5 instantiating a window triggers very little code. After the window has been instantiated we send a $initialize message to the window instance with the appropriate parameters. Normally the $initialize message tells the window instance its wininstid, mode, and datalist. Based on the wininstid the window can find out other properties like toolbar buttons, searchbarvisible, etc. and add them if required.
The downside on doing very little in the $construct is that a window can become visible to the user before it is ready. The solution is simple. In StudioWorks all windows are instantiated as subwindows, so we simply need to hide the subwindow field until after it has been initialized.
To avoid double initializing a window an ibInitialized ivar is part of every window. It is set to kTrue after the $initialize method has been run without any errors. The $initialize method only runs if ibInitialized is kFalse.The following is a definition of MVC in Wikepedia.
Model-view-controller (MVC) is an architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other. In MVC, the Model represents the information (the data) of the application and the business rules used to manipulate the data, the View corresponds to elements of the user interface such as text, checkbox items, and so forth, and the Controller manages details involving the communication to the model of user actions such as keystrokes and mouse movements.The original release of StudioWorks used window controller objects (WCOs) as the controller in the MVC architecture.
The Window Controller Objects were dropped from StudioWorks in version 3. Window Controller Objects were dropped because object instances were unstable in earlier versions of Omnis Studio and they had to be instantiated by the window class instance.
Omnis Studio version 3 introduced the object reference datatype which made it possible to instantiate an object to its own spot in memory and pass stable references to the object. The object reference datatype makes it possible for StudioWorks to reintroduce Window Controller Objects.
One of the goals we hope to attain with Window Controller Objects is to structure the Window Controller Object so that it can be used with window classes, remote forms, and ultrathin web pages.In swGui5 as with swGui4 requests to open a new window are sent to an oWindow object class. The difference in swGui5 is that rather than directly opening a window class, oWindow_window controller object opens an owcWinInstID window controller object reference instance for the specified WinInstID. An object reference to the object instance is stored in an iWCOsList inside oWindow_window controller object.
oWindow_window controller object then sends the Window Controller Object instance an $initialize message which allows it to define and build any lists and get any addition information it needs prior to opening a window. oWindow_window controller object then sends an $openWindow message to the Window Controller Object. The Window Controller Object opens a window instance and attaches itself as the Window Controller Object to the window instance.
All window events and are passed from the window to the attached Window Controller Object. This gives the developer the flexibility of deciding which window controller to connect to a window instance.
The window instance is responsible for:
The remote form is generated by a remote form generator object in StudioWorks.
The remote form generator is responsible to prepare a remote form with:
The remote form instance is responsible for:
The ultrathin web page is generated by an HTML generator object in StudioWorks.
The HTML generator is responsible to return HTML for:
Javascript files on the server are responsible for:
The web browser is responsible for: