Sw4   >   Windows   >   Windows
All window instances in StudioWorks must included in the oWindows master list before you can open an instance of the window. Each module adds their own window instances to the master list. The window instances lists are returned by the $:WindowInstancesList property method of the oWindowList objects.
StudioWorks automatically declares a default list and edit window instance for each schema class in your application. For example if you have a schema class named sAuthor with a server table name Author, StudioWorks will automatically declare the window instances AuthorList and AuthorEdit for you. Each window instance is called a wininstid and must be unique across all modules.
For each default window instance StudioWorks automatically sets its sqlclassname property by searching for a query or schema class based on naming conventions. The following example is for the AuthorList window instance:
You add/modify/delete window instances using the
Tooltips are provided for the various fields (window instance properties) of the located under a tab of the . Instruction are provided in the editor window. If you change any of the properties of a default wininstid you become responsible for all further changes. .attachChangeRecordObserverYou can set default commands to be excecuted when an evOK or evCancel is received by the wShell window.
The wShell window's $event method traps On evOK and On evCancel and sends a $doCmnd(pCmnd) message to the current subwindow. The pCmnd parameter is set as follows:
The $doCmnd method, checks for pCmnd = to 'defaultokay' or 'defaultcancel' and changes the parameter value to the return value of $:DefaultCmnd_evOK or $:DefaultCmnd_evCancel as applicable.
The base window defaults have been set to the following:
You should place your edit fields for any edit type subwindow inside of a kScrollbox object named MainScrollbox. (The exact name and case is important.)
The reason for doing this is to allow the edit fields to scroll independent of the swToolbar subwindow field which is normally at the top of an edit type subwindow.
If we were to set the entire edit subwindow field to scroll, the swToolbar would scroll off the top if user scrolled down the subwindow field. The solution was to put all of the edit fields inside of a kScrollbox field, thereby allowing the user to scroll down the MainScrollbox field without affecting the swToolbar field.
When you wEdit_autoconfig window, StudioWorks automatically adds the MainScrollbox for you and puts the edit fields inside the scrollbox.
aIf you have an edit subwindow that does not scroll when it should, you likely need to add a MainScrollbox field to the subwindow. Here's what to do:
There are several shared module libraries that are included with StudioWorks. You set whether or not to include each library in the $:AppLibsList method of oConstants. (See Configuration > App Libraries List)
When you include a library, the window instances declared by the library's oWindowList object are automatically added to your application's windows list and navigation menus.
You may have a situation where you want to modify or replace a window instance declared by a StudioWorks shared library. Making the change directly in the shared library would be a problem because StudioWorks updates would wipe out your changes.
One technique you can use is to add the exact same WinInstID to the oWindowsList object in your main library or one of your module libraries. For the WinInstID which you add, you would point it to your custom window class.
You then need to remove the shared library WinInstID from the master windows list. You can accomplish this as follows:
; Superclass builds the list of all WinInstIDs.
Do inherited Returns FlagOK
If FlagOK
; Find and remove the shared library WinInstID that is being replaced by a custom WinInstID.
Calculate HomeLibName as 'swContacts4'
Calculate WinInstID as 'PersonEdit'
If iWindowsList.$search($ref.homelibname=HomeLibName&$ref.wininstid=WinInstID,1,0,0,0)
Do iWindowsList.$remove(kListDeleteSelected)
End If
End If
Quit method FlagOK