473,405 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

WebApp Parent/Child windows

Hello All,
I'm working on a web app that will simulate a Windows app.

One of the items that I've trouble reproducing is the parent/child
interaction that might occur between a windo and popup custom dialog
box (example: right click an item and bring up a Config/Properties
dialog of the selected item).

In a Windows app, I can add a handler in the Parent to respond to the
"OK" event in the child window so that I can update the object's
poprties and reflect any changes on the parent Window.

In the web app, I haven't been able to figure out how to hook into the
PropertyPage's "OK" event from the parent window. It seems that once I
generate a "var propPage = window.open(..)" script, that the only link
between the two windows is the "window.opener" property or the
"propPage" variable. Even then, this is a javascript relationship, not
a .NET relationship.

Currently, to simulate the parent/child interaction, I currently do
this (more or less):
1.Pop up the config page (in a small window)
2. Get the user's selections
3. Store the user's selections in the Session
4. Refresh the parent
5. Parent loads, and scans the Session for the config info
6. Parent reflects any config changes on original form.
7. Parent clears the session variable that the child set.

Is there a better way to do this?

All ideas are welcome and appreciated.

-tomas
Nov 16 '05 #1
1 2216
Hi Tomas,
There are a lot of options. It sounds like what you want to do is
POST the settings dialog and then refresh the parent. If this is the
case, then open the dialog window, keeping the window handle in a var
(like I believe you already have). Then keep polling the the dialog
window to see if it has closed... When the dialog page has closed,
then post the original window back to .Net manually. The code I've
provided below is completely self-contained on the Parent window.
There are lots of other ways to do it, hope this helps you find your
final solution.
-Jerry

// CODE for IE and Mozilla
// Variable to hold settings dialog window handle
var subWin = "";
// will hold the timeout
var tmCheck = "";
// initialize type var
var myTypeS = typeof subWin;

// function to open dialog and prep
function ChangeSettings() {
// open the new win
subWin = window.open("mypage.html","settingsDlg","toolbar=n o,location=no,status=no")
;
// this is for Netscape
subWin.NSVar = 1;
//
window.onfocus = TimeRefreshThisWindow;
}

// function that sets timeout to check dialog
function TimeRefreshThisWindow() {
tmCheck = setTimeout("CheckDialog()",800);
}

// dummy function
function Nothing() {}

// function to check if dialog has closed
function CheckDialog() {
var myTypeS = typeof subWin.document;
// Has the dialog closed?
if ( ( navigator.userAgent.indexOf("IE") && myTypeS != "object" )
|| ( navigator.userAgent.indexOf("NS") && subWin.NSVar != 1 ) ) {
// bring the focus back to parent (me)
window.focus();
// refresh me (.Net must be expecting this pseudo postback,
handle it in your Page Load event or pass a control id to link it to
an event)
__doPostBack("<%=Me.ClientID%>:myControlId","") ;
// to avoid errors
window.onfocus = Nothing;
} else {
// the child still exists, make sure it has focus
subWin.focus();
}
}

// this function closes the dialog if the parent is closed
function CheckDlgOrphan() {
var myTypeS = typeof subWin.document;
if (myTypeS == "object") {
subWin.close();
}
}
// set onunload
onunload = CheckDlgOrphan;
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Paul | last post by:
Hi all, Here is what I am trying to do. I have a parent class calling a child class. when one function in child class is called, i need to call parent class' function. How can I get parent class'...
3
by: Maheshkumar.R | last post by:
Hi groups, How i can command over the MDI CHIlD forms created dynamically at runtime from PARENT. Let say, i have generated 5 mdichild forms, but i want to work with child form1 from MDI...
4
by: Steve | last post by:
I have the MDI MFC application ported to .NET. Now this application include mixed managed/unmanaged code. The application displays progress dialog with the cancel button during lenghtly...
1
by: Bill Borg | last post by:
Hello all, Simple chat app, where the site owner has a master window with all requests for chat, status of each room, etc., and child windows for each separate chat in which the owner is...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
3
by: Eddie | last post by:
If FormMain = MDI parent, FormSub = Child parent, I execute FormSub from the menu like this way. FormSub^ sub = gcnew FormSub; sub->MdiParent = this; sub->Show(); This can generate child...
2
by: epaetz | last post by:
Is there a way to decouple the linkage between a parent and a child window? Does the parent window have any sort of a collection that holds all the children that it has spawned? I want to...
3
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
6
by: SQACSharp | last post by:
I'm using the EnumChildWindows API with an EnumChildWndProc callback to populate the treeview. The output will be something similar to spy+ + How can I specify the parent when adding a new node...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.