Window Manager Service |
Ver. 1.01 Contributed by Daria Bullock |
What
n_cst_windowmanager
n_cst_windowattrib
Why
The service provides a generic method for opening any type of window. The service also allows passing multiple values to a window (parameter passing).
How
The window service, N_CST_WINDOWMANAGER, is an autoinstantiated non-visual user object. The service is responsible for opening any type of window. Along with the window manager service is a window attribute object, N_CST_WINDOWATTRIB, that contain a variety of variables used for passing multiple values to a window (parameter passing). These variables are contained in a structure that is part of the attribute object. The variable used strictly for passing the window name exists as an instance on the attribute object.
The window name is dynamically created to determine the window type. Once that is determined than the appropriate OPEN is used to open the window. The structure attribute list contain any parameters (string, char, boolean, PB object, etc.) that are required by the window being opened. The Message.PowerObjectParm will contain the window attribute object when the window is opened (OpenWithParm) and therefore is used in the open of the window to cast it to a local of the window attribute.
The window attribute structure variables are filled prior to the of_SendMessage('pfc_open') in the menu for any window that you wish to open. The use of the INV_WINDOWATTRIB.IS_WINDOWNAME is strictly for opening the window. The structure variables are used to pass values to the window. Once in the window the Message.PowerObjectParm is moved to a local declaration of the window attribute (ie. lnv_windowattrib = message.powerobjectparm). One scenario of passing parms would be a report window that dynamically assigns the dataobject depending on the menu item selected. In the menu simply load the dataobject into the global structure string variable (ie. gnv_app.inv_windowattrib.istr_winattrib.is_stringvalue = 'd_datawindow') and call the of_sendmessage('pfc_open').
The service should be made an instance of the application manager. In this case, if the extension level of n_cst_appmanager is used then it would be modified. If the appmanager is inherited from then modify the inherited object to include the service. This allows the service to be used globally by way of gnv_app.
Ex: (include as an instance variable)
n_cst_windowmanager inv_windowmanager n_cst_windowattrib inv_windowattribInherited Message Object processing
The normal processing of OpenWithParm is to store the passed values (given the datatype) into the MessageObject. I have also taken into account that some applications inherit from N_MSG and use that object in the application variable types. If this is a requirement then include an instance of iPO_PowerObjectParm into the inherited object and uncomment the code in the of_OpenWindow():
//Store parameter into message object instance (inherited object from n_msg) //If lb_Parms Then // message.iPO_PowerObjectParm = anv_windowattrib //End IfThis will allow the application to still use the PowerObject datatype of the MessageObject which is where the WindowAttributeObject (non-visual) is stored. This will at least preserve the values in the window attribute and allow the MessageObject to be used at different levels. (ie. I recently encountered a problem with 3rd party security software that manipulates objects by using all of the MessageObject properties after an of_sendmessage and prior to opening a window.)
Available Service Functions.
of_Setrequestor
(w_master aw_requestor)If this function is not called prior to the open window function (of_OpenWindow) it defaults to the frame. NOTE: Requesting (aw_requestor) window can be:
The name of the MDI frame window in which you want to open this sheet when OPENSHEETWITHPARM is used.
The window you want make the parent of the child or popup window you are opening (child and popup windows only) when OPENWITHPARM is used.
of_Openwindow
(n_cst_windowattrib anv_windowattrib)Will open any type window. The window is dynamically created to determine the windowtype. The parameters passed via the window attribute object are passed via Message.PowerObjectParm. If necessary, as in some cases of PFC processing, the window attribute object variables can be preserved. Although the window attribute object is an instance of the application manager object, a local declaration will allow for local processing without destroying the global values. This function returns a ( -1 ) for errors and a ( 1 ) if the window was successfully opened. Other return codes are possible and in keeping with the meaning of the return value, those functions will also return a ( -1 ) if an error is encountered. of_Checkopensheets
(string as_window)Checks to see if the requesting window is already open. If the window is already open, it is made the active window and a ( -2 ) is returned from the function. of_Openmultiple
(boolean ab_switch)Boolean that is pre-set (call this function prior to the of_OpenWindow function) to determine whether a sheet is allowed to be opened multiple times. The default is NO do not allow for multiple instances. of_Getparms
(n_cst_windowattrib anv_windowattrib)Function called from within the window manager service to determine whether parameters are to be passed to the window. of_Getrequestor (w_master aw_requestor) Returns the window that will be the parent of the child or popup. (For child and popup processing only) of_Resetparms (n_cst_windowattrib anv_windowattrib) FUTURE USE. Resets the parameters in the window attribute structure. (Currently not being used from within window manager)
Function Examples
Example 1 (open a sheet from frame menu)
- Menu event:
gnv_app.inv_windowattrib.is_windowname='w_ws_sheet' of_sendmessage ('pfc_open')
- Frame pfc_open event:
//Open window if gnv_app.inv_windowmanager.of_OpenWindow(gnv_app.inv_windowattrib) = -1 then messagebox(gnv_app.iapp_object.displayname,"Unable to open window.") End if
Example 2 (open a sheet with parms from frame menu)
- Menu event:
gnv_app.inv_windowattrib.is_windowname= 'w_ws_sheet_parm' gnv_app.inv_windowattrib.istr_winattrib.is_stringvalue='d_datawindow' of_sendmessage ('pfc_open')
- Frame pfc_open event:
//Open window if gnv_app.inv_windowmanager.of_OpenWindow(gnv_app.inv_windowattrib) = -1 then messagebox(gnv_app.iapp_object.displayname,"Unable to open window.") End if
- Sheet pfc_preopen event:
//Move the string datawindow object to the datwindow. In this example a datawindow //object is passed to the window dynamically. n_cst_windowattrib lnv_windowattrib lnv_windowattrib = message.powerobjectparm dw_1.dataobject = lnv_windowattrib.istr_winattrib.is_stringvalueExample 3 (open a sheet multiple instances from frame menu)
- Menu event:
gnv_app.inv_windowattrib.is_windowname='w_ws_sheet' of_sendmessage ('pfc_open')
- Frame pfc_open event:
//Set variable to allow multiple instances of same sheet gnv_app.inv_windowmanager.of_Openmultiple(true)//Open window if gnv_app.inv_windowmanager.of_OpenWindow(gnv_app.inv_windowattrib) = -1 then messagebox(gnv_app.iapp_object.displayname,"Unable to open window.") End if
Example 4 (open a sheet from frame menu, open a child from the open sheet)
- Menu event:
gnv_app.inv_windowattrib.is_windowname='w_ws_sheet' of_sendmessage ('pfc_open')
- Frame pfc_open event:
//Open window if gnv_app.inv_windowmanager.of_OpenWindow(gnv_app.inv_windowattrib) = -1 then messagebox(gnv_app.iapp_object.displayname,"Unable to open window.") End if
- Command button on sheet window:
//Open a child window passing a datawindow object in structure object of the //window object attribute. //This is one example of passing string information via an object. The window //name is populated along with any other parameters.int li_rtn n_cst_windowattrib lnv_windowattrib lnv_windowattrib.is_windowname= 'w_ws_child_parm' lnv_windowattrib.istr_winattrib.is_stringvalue='d_datawindow'//Set instance of sheet for service li_rtn = gnv_app.inv_windowmanager.of_SetRequestor(parent)//Call window service if li_rtn = 1 then gnv_app.inv_windowmanager.of_OpenWindow(lnv_windowattrib)
Download the | About the extension contributor |
Revision History | ||
11/18/1997 | Initial Revision | Ver. 1.00 |
12/09/1997 | Added function of_ResetParms(). Modified of_GetParms() to better handle passing values. | Ver. 1.01 |
Interested in contributing material to this web site? Send an email to submit@pfcguide.com, but don't forget to check the contribution guidelines first.
For information or suggestions about this web site please contact webmaster@pfcguide.com
PFCGuide is
sponsored by Dynamic Technology Group.
The information on this site is provided for advice only and not to be considered a
contract or a liability against Dynamic
Technology Group.