Sw4   >   About   >   swGui5
This section contains concepts, ideas, and discussion, on a new GUI structure that could be added to the StudioWorks framework in the future.
There is no time committment on swGui5. It may or may not be added to the framework.The first version of StudioWorks used Window Controller Objects. Each window instance was mapped to a window controller object class. When a window class was instantiated it would find and instantiate its own window controller object class.
Much of the code that would normally be in the window class was moved to the window controller object. The expresssion used was "keep the window class dumb, put the intelligence in the wco".
StudioWorks moved away from Window Controller Objects for a couple of reasons:
In hindsight another problem with Window Controller Objects was that responsibilities between the window class and the window controller object class were never clearly defined. You were never sure whether code would be in the window class or the window controller object.
We are now considering reintroducing Window Controller Objects in the StudioWorks framework. To maintain backwards compatabilty the swGui4 module would remain as it is, and the Window Controller Object structure would be introduced in a new module, swGui5.
The reasons for reintroducing Window Controller Objects to the StudioWorks framework are as follows:
The following is a list of ideas on the responsibilities of the window controller object classes.
; Do pContextMenu.$addMenuLine(pMnID,pbElipsis,pMenuText)
; Can we modify the schema class?
Do $cinst.$canModifyClass() Returns bCanSave
If not(bCanSave)
Calculate Text as con("Read-only: ",$cinst.iClassName," needs to be checked out of the VCS.")
Do pContextMenu.$addMenuLine($cinst,'doNothing',kFalse,Text)
Else
Do irTree.$currentnode() Returns rCurrNode
Do irTree.$getselectednodes(List)
; $addMenuLine(pfObserver,pMenuID,pbEllipsis,pMenuText_opt)
; Only allow new if one line selected.
If List.$linecount=1
Do pContextMenu.$addMenuLine($cinst,'newNode',kTrue,'New')
End If
; Only allow duplicate if one line selected and not a root node.
If List.$linecount=1&rCurrNode.$level<>1
Do pContextMenu.$addMenuLine($cinst,'duplicateNode',kTrue,'Duplicate')
End If
; Only delete selected if one line selected and not a root node.
If List.$linecount>0&rCurrNode.$level<>1
Do pContextMenu.$addMenuLine($cinst,'deleteSelectedNodes',kTrue,'Delete Selected')
End If
; Only allow duplicate if one line selected and not a root node.
If List.$linecount=1&rCurrNode.$level<>1
Do pContextMenu.$addMenuLine($cinst,'editNode',kTrue,'Edit')
End If
End If
End If
Quit method FlagOKThe following is a list of ideas on the responsibilities of a window class that uses a window controller object.
Should datalists be in the window class or the Window Controller Object?
It is tempting to consider storing all the datalists in the Window Controller Object and having window objects (headed list, complex grid, etc.) reference the datalists in the Window Controller Object.
Once advantage of doing this is that it might make it simpler to have 2 different window instances (stand alone or as subwindows) with different presentations of the same data pointing to the same Window Controller Object datalist. One window might be a list, the other a graph, one might display the visible fields of the current row, the other other all of the rows but just one or two columns of the datalist.
The Window Controller Object can decide if 2 different windows under its control point to the same datalist or separate datalists.
Another possible adavantage of storing the datalist in the Window Controller Object is that you can keep a Window Controller Object instance alive even if the window instance is closed. If the window instance is reopened the same Window Controller Object instance could be used with the datalist still populated.
Referencing datalists was not always stable in the earlier versions of Omnis Studio. This has not been a problem in the later versions of Omnis Studio.
For ultrathin web apps you can not reference a Window Controller Object datalist, the datalist must be passed to the ultrathin web client... so we can only go so far with referencing the Window Controller Object datalist. That might be a reason for storing the datalist in the window class rather than the Window Controller Object.What is the sequence of instantiation?
I am leaning towards option #1 because it may provide more flexibility. Numerous window classes in StudioWorks are completely generic and reused for many different window instances.
If we have a window controller object class for each wininstid, we would just have to instantiate the window controller object and let it instantiate the window class.
However, this will be a problem for subwindows. The $classname of the subwindow field must be assigned first and when it is assigned the window class is immediately instantiated. The work around could be to send an $openWCO message to the oWindows object.
Do wn.$openWCO(pWinInsID) Return WCOInstName
Then set the subwindow field $parameters property to include the WinInstID and the WCOInstName. The $construct method of the window instance receives the WCOInstName as an optional second parameter and if received, it sends a $retWCORef message to oWindows.
Do wn.$retWCORef(pWCOName) Returns ioWCO
The return value is a pointer to the Window Controller Object object reference instance which is stored in a list of Window Controller Object object reference instances.
If the second parameter is empty, the window's $construct methods sends the WinInstID as the parameter to oWindows.
Do wn.$retWCORef(pWinInstID) Returns ioWCO
oWindows then creates a new Window Controller Object object reference instance and passes it back.