mdi.getWindowInterface(windowName)
|
The getWindowInterface command returns an interface object that was previously registered by the named child window. This interface object allows the parent form to access the data and functions of the child window.
The interface contains pointers to functions in the child window that the child window allows the parent to use. This method gives the child window control over which of its functions and data are exposed to the larger application.
Communication between windows is a common theme when programming so we have constructed a javascript file, MDIwareHooks.js, to eliminate much of the busy work. Include MDIwareHooks.js in the head of your child window forms.
MDIwareHooks.js will create an interface object in your child window form and register the interface object with the parent form that contains the child window.
In this example, the parent form will use the interface object to extract data from an input field in the child window. The interface function it uses is defined the MDIwareHooks.js file.
Note: Two code blocks below, one for the parent form and one for the child window.
|
<input type='button' value='Get Child Data' onclick='getChildData();' />
<script>
var mdi;
var windowName;
function getChildData()
{
var interface = mdi.getWindowInterface(windowName);
alert(interface.val('#firstName'));
}
function docReady()
{
mdi = new MDIware('http://MDIware.com/libs/MDIware/');
mdi.addForm({name:'form1', url:'', width:400, height:200, title:'Child1.htm'});
windowName=mdi.form('form1').show();
}
$(document).ready(docReady);
</script>
</div>
</body>
</html>
|
First Name:<input type='text' id='firstName' value = 'Eddie' />
</div>
</body>
</html>
|
msgBox(title, message, buttons, callback, [options], [passThruData])
|
The msgBox command is not prefaced by 'mdi.'
The msgBox command REQUIRES THE INCLUSION of the MDIwareHooks.js file in the child window's source code. The msgBox displays a message to the user with one or more response buttons.
The optional options object may contain width and height poperties - for example {width:300, height:400}.
The optional passThruData is a data object that will be returned to the caller as a second parameter in the callback function.
Also note that the msgBox command is only for use in a child window.
If you want a message box in the parent window use the 'mdi.sysMsgBox(title, message, buttons, callback)' which is prefaced by 'mdi.', and does not require MDIwareHooks.js. Whew!
|
<script>
function responseFN(response)
{
switch(response)
{
case 'buttOk':
code to process Ok ....
break;
case 'buttCancel':
code to process Cancel ....
break;
}
}
msgBox('Careful',
'Do you want to save your work?',
{buttOk:'Ok', buttCancel:'Cancel'}, responseFN);
</script>
</div>
</body>
</html>
|
mdi.form(formName).showAttached(windowName, [modal], [linkData])
|
An attached window is created by using a variation of the form show command called 'showAttached(attachedToWindowName)'. The showAttached command requires the name of the 'attached to' window to be passed as a parameter. An attached window is always shown at a higher z-index than the window it is attached to.
Attached windows are often used as dialog boxes such as a file-save dialog in a text editor.
A modal window can be created by including an optional modal parameter
in the show command. For example,
mdi.form(formName).showAttached(windowName, true) will open a window that is modal relative to the window it is attached.
|
<script>
var mdi;
var win1Name;
function docReady()
{
mdi = new MDIware('http://MDIware.com/libs/MDIware/');
mdi.addForm({name:'form1', url:'', width:400, height:200, title:'Child1.htm'});
mdi.addForm({name:'form2', url:'', width:400, height:200, title:'Child2.htm'});
win1Name = mdi.form('form1').show();
mdi.form('form2').showAttached(win1Name);
mdi.windowToTop(win1Name);
}
$(document).ready(docReady);
</script>
</div>
</body>
</html>
|
Use of the MDIware properties is optional.
Property | Type | Default | Description |
cascadeResizeHeight | boolean | true | If false then each windows height will not be resized when the windows are cascaded. |
cascadeResizeWidth | boolean | true | If false then each windows width will not be resized when the windows are cascaded. |
focusedWindowName | string | | Read only. The name of the window that currently has focus. |
forms | array | | Read only. An array of MDIware forms. |
lastOpenX | integer | | Read only. X coordinate where the last window was opened. |
lastOpenY | integer | | Read only. Y coordinate where the last window was opened. |
leftMargin | integer | 0 | The left margin is used by the cascade function as a leftmost starting point. |
| | | |
onModeChange | function pointer | null | Called when the user switches display mode. onModeChange(mode). |
onResize | function pointer | null | Called when the any window is resized. onResize(formName, leftCoord, topCoord, width, height, action). The numeric action code indicates the source action of the resize event. An action codes > 15 indicates a manual operation by the user. |
onWindowToTop | function pointer | null | Called when the user brings a new window to the top of the z-order. onWindowToTop(windowName). |
optNoTabOrStack | boolean | false | If true then eliminates the stack and tab options from the options menu of new windows. Set this to true for the 'Mobile Mode'. |
optCascadeAftOnTop | boolean | false | If true then call CascadeMode() whenever a new window moves to the top. Set this to true for the 'Mobile Mode'. |
optNoWindowMove | boolean | false | If true this disables the manual movement of any windows. Set this to true for the 'Mobile Mode'. |
optCascadeOverflow | boolean | false | If true then allow the cascaded windows to exceed the browser window dimensions Set this to true for the 'Mobile Mode'. |
optNoCascadeOffset | boolean | false | If true then don't horizontally offset cascaded windows. |
optOpenLeft | boolean | false | If true then open new windows at the left margin. Set this to true for the 'Mobile Mode'. |
optNoMaxButton | boolean | false | If true then don't display the max buttom in new windows. Set this to true for the 'Mobile Mode'. |
optNoMinButton | boolean | false | If true then don't display the min button in new windows. Set this to true for the 'Mobile Mode'. |
optLeftCloseButton | boolean | false | If true then display a close button in place of the option button in new windows. Set this to true for the 'Mobile Mode'. |
| | | |
systemModalOpen | boolean | false | Read only. Indicates if a system modal window is open. |
systemModalEvent | function pointer | null | Called when a MDIware switches in/out of a system modal state. systemModalEvent(bIsModal). |
soundOn | boolean | true | This controls the 'beep' sound that occurs when the user clicks off a modal window or message box. |
topMargin | integer | 0 | No window can be manually moved above the top margin. Set the topMargin to 35 or so to allow space for your applications menu - if you have one. |
windows | array | | Read only. An array of open MDIware windows. |
| | | |
An MDIware form defines the properties and behaviors that a window will have when opened.
A single form can be opened multiple times to create multiple open windows.
Property | Type | Default | Description |
height | integer | required | Sets the initial height of the window |
maximizable | boolean | true | If false then the maximize button will not be displayed on the title bar. |
minimizable | boolean | true | If false then the minimize button will not be displayed on the title bar. |
modal | boolean | false | If true then the window will be system modal and no other window can gain focus until this window is closed. |
name | string | required | You assign a name to the form. The form 'name' property must follow the naming conventions for html elements - no embedded spaces, etc.
|
closeButton | boolean | true | If false then the window will not have a close button at the right end of the window title bar. |
openInCenter | boolean | false | If true then the window will be initially centered in the browser screen. |
optionsButton | boolean | true | Controls the presence of the options button at the left end of the window title bar. If the value = false then the button will not be shown. |
resizable | boolean | true | trueIf true then the window frame can be dragged to manually change the size of the window. |
sandbox | string | optional |
MDIware uses html iframes to create windows. The sandbox property controls the
access that one open window has to the contents of the parent window, parent session
information, and other sibling windows. By default, each open window has access to the
parent window, the parent session information and some access to sibling windows. A
complete description of the sandbox
property is given here. |
title | string | optional | The initial title of the window to be displayed in the title bar. If no title is specified then the window title will display 'Loading...'. |
width | integer | required | Sets the initial width of the window |
x | integer | optional | The initial x position of the window. |
y | integer | optional | The initial y position of the window. |
| | | |
| | | |
"The MDIware team is committed to insuring that new versions of MDIware are always backwards compatible with prior versions." - Ed Zaron
Date
|
Version
|
Changes
|
4/4/21 | 2.05 |
Fixed the occasional dropping of mouse state when the mouse is moved outside of browser and button released.
|
3/24/21 | 2.04 |
Added mdi.onResize property. Set mdi.onResive to the function that will be called when any window is resized.
Function is called as onResize(formName, leftCoord, topCoord, width, height, action).
|
3/2/21 | 2.03 |
Added mdi.pop() function that takes the top window and moves it to the bottom of the window stack.
|
1/23/21 | 2.02 |
Cleanup MDIwareHooks.js and document mdi.debug(..) function.
|
1/15/21 | 2.01 |
Minor fix to form.show(modal) when in stack mode.
|
1/06/21 | 2.00 |
New Year code cleanup. Improve response when clicking on an input item in a non-top window.
|
11/4/20 | 1.9.70 |
Add mdi.splitH(), mdi.splitV(), mdi.tile() functions.
|
10/26/20 | 1.9.20 |
If form.html property = true then use linkdata.html as window contents as in "..form.show(formname, mode, linkdata)"
|
8/29/20 | 1.8.28 |
On opening a window, don't exactly overlay windows with same form name. |
8/25/20 | 1.7.93 |
Corrected an error in msgBox(..) that sometimes didn't return the optional passThruData to the callback function. |
5/26/20 | 1.7.91 |
Add numerous 'opt...' MDIware properties to facilitate making MDIware mobile friendly. |
3/13/20 | 1.7.82 |
Disallow minimizing 'Always On Top' windows. |
1/26/20 | 1.7.79 |
Make callback parameter optional in msgBox(Title, Message, Buttons, [callback]). |
1/9/20 | 1.7.76 |
Add mdi.onModeChange function pointer callback to capture when user changes mode (cascade, tab, stack). |
12/21/19 | 1.7.74 |
Add form.maximizable property (boolean) to control display of maximize/restore title bar button. |
11/16/19 | 1.7.72 |
Fix msgBox over attached modal child. |
8/13/19 | 1.7.71 |
Fix msgBox over attached modal child. Add sysMsgBox(..) for message box creation in parent form |
3/4/19 | 1.7.65 |
Fix modal functionality to allow for multiple levels of modal windows. |
8/28/18 | 1.7.58 |
Add mdi.adjustMargins(windowName) to resize/resync non-scrolling areas of window. |
8/8/18 | 1.7.47 |
Replace jQuery bind and unbind calls with .on and .off for compatibility with latest jQuery. |
8/3/18 | 1.7.41 |
Add .linkData object to window.data. Add linkData as optional parameter to form.show(...) and form.showAttached(..) functions. |
7/27/18 | 1.7.30 |
Reset 'next window open position' when all windows are closed. |
7/19/18 | 1.7.10 |
Recode mdi.windowWidth() and mdi.windowHeight() for improved browser compatibility. |
7/12/18 | 1.7.00 |
Display window caption in bold font-weight |
6/24/18 | 1.6.87 |
Add mdi.windowsName(window) function for retrieving the internal window name used for window access. |
6/17/18 | 1.6.80 |
Add mdi.broadcast to mdiware.js, add msgReceiver to mdiwarHooks.js |
6/5/18 | 1.6.74 |
Add 'url' property to form object. |
5/30/18 | 1.6.58 |
Changes to msgBox to return button selected name to callback function. |
2/20/18 | 1.5.94 |
Add touch interface for moving/manipulating windows on touch screens. |
1/17/18 | 1.5.41 |
Add window(windowName).title(caption text) for setting window caption in title bar. |
1/16/18 | 1.5.40 |
Add form.showAttached(parent, modal) function for creating dialog type windows. |
12/20/17 | 1.5.19 |
Add mdi.closeAll([force]) function for closing all open windows. |
8/8/17 | 1.4.84 |
Create Tabs and Stack display modes. |
6/9/17 | 1.3.82 |
Add menuArea, LeftArea and bottomArea for non scrolling content in window. |
6/7/17 | 1.3.70 |
Rename project from jsWindows to MDIware |