Connecting Tech Pros Worldwide Help | Site Map

Where's the Window()

  #1  
Old November 19th, 2008, 03:25 PM
Martin Rinehart
Guest
 
Posts: n/a
I've got most of the components of a robust color chooser but I'm
having trouble pulling them together.

What I want is to have a ready-to-use but not visible pop-up object
created when the application is loaded. On a click on a color button,
this thing should pop up as a modal dialog. It should hide when the
user chooses OK, Cancel or clicks the window closing button.

"window.open(...)" opens a window, which is not what I want when the
application loads. My development platform, Opera on Konqueror,
doesn't support "new Window(...)". This was dead simple in Java (and I
may still be thinking in Java).

There's a Java example of where I'm going at

http://www.MartinRinehart.com/exampl...r-chooser.html

(This is a slug in Firefox on XP Pro - use any other browser or FF
with XP Home or any earlier Windows. I've no clue why.)

The JavaScript version will be better.
  #2  
Old November 19th, 2008, 03:45 PM
Erwin Moller
Guest
 
Posts: n/a

re: Where's the Window()


Martin Rinehart schreef:
Quote:
I've got most of the components of a robust color chooser but I'm
having trouble pulling them together.
>
What I want is to have a ready-to-use but not visible pop-up object
created when the application is loaded. On a click on a color button,
this thing should pop up as a modal dialog. It should hide when the
user chooses OK, Cancel or clicks the window closing button.
>
"window.open(...)" opens a window, which is not what I want when the
application loads. My development platform, Opera on Konqueror,
doesn't support "new Window(...)". This was dead simple in Java (and I
may still be thinking in Java).
>
There's a Java example of where I'm going at
>
http://www.MartinRinehart.com/exampl...r-chooser.html
>
(This is a slug in Firefox on XP Pro - use any other browser or FF
with XP Home or any earlier Windows. I've no clue why.)
>
The JavaScript version will be better.
What is your question?
How to open a new window when somebody pushes the button?

To do that you'll need window.open() not new Window().

Regards,
Erwin Moller

--
"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare
  #3  
Old November 19th, 2008, 04:25 PM
Daniel Orner
Guest
 
Posts: n/a

re: Where's the Window()


Martin Rinehart wrote:
Quote:
I've got most of the components of a robust color chooser but I'm
having trouble pulling them together.
>
What I want is to have a ready-to-use but not visible pop-up object
created when the application is loaded. On a click on a color button,
this thing should pop up as a modal dialog. It should hide when the
user chooses OK, Cancel or clicks the window closing button.
>
"window.open(...)" opens a window, which is not what I want when the
application loads. My development platform, Opera on Konqueror,
doesn't support "new Window(...)". This was dead simple in Java (and I
may still be thinking in Java).
>
There's a Java example of where I'm going at
>
http://www.MartinRinehart.com/exampl...r-chooser.html
>
(This is a slug in Firefox on XP Pro - use any other browser or FF
with XP Home or any earlier Windows. I've no clue why.)
>
The JavaScript version will be better.
You'll probably want the content in a div rather than a separate
window. You can hide the div and position/show it when needed. Browsers
generally don't have the idea of "modal" windows in any case, so you'll
need to go this route.
  #4  
Old November 19th, 2008, 04:35 PM
Martin Rinehart
Guest
 
Posts: n/a

re: Where's the Window()


Daniel Orner wrote:
Quote:
You'll probably want the content in a div rather than a separate
window. You can hide the div and position/show it when needed. Browsers
generally don't have the idea of "modal" windows in any case, so you'll
need to go this route.
The color chooser in its own window is quite nice as you can drag it
around (inevitable: it pops up over something you want to look at). Do
I need to write a draggable div widget?
  #5  
Old November 19th, 2008, 04:35 PM
Martin Rinehart
Guest
 
Posts: n/a

re: Where's the Window()


Erwin Moller wrote:
Quote:
What is your question?
How to open a new window when somebody pushes the button?
>
To do that you'll need window.open() not new Window().
That insists on opening the window. I'd like to construct the window
before it's visible, then show/hide it based on the users' clicks.
  #6  
Old November 19th, 2008, 04:55 PM
Martin Rinehart
Guest
 
Posts: n/a

re: Where's the Window()


It just gets odder and odder.

function popup() { // called on button click
var cc = window.open( ... ) // window pops up
alert( cc ); // alert appears after window is closed. reports
"object Window"
alert( cc ); // reports "object Object"
}
  #7  
Old November 19th, 2008, 05:05 PM
Erwin Moller
Guest
 
Posts: n/a

re: Where's the Window()


Martin Rinehart schreef:
Quote:
Erwin Moller wrote:
Quote:
>What is your question?
>How to open a new window when somebody pushes the button?
>>
>To do that you'll need window.open() not new Window().
>
That insists on opening the window. I'd like to construct the window
before it's visible, then show/hide it based on the users' clicks.
Any reason for that?
Anyway, if you must: follow Daniels advise and make it a div.
And yes, you must take care of the dragging of that div-'window' then.

Erwin Moller


--
"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare
  #8  
Old November 19th, 2008, 05:15 PM
Erwin Moller
Guest
 
Posts: n/a

re: Where's the Window()


Martin Rinehart schreef:
Quote:
It just gets odder and odder.
>
function popup() { // called on button click
var cc = window.open( ... ) // window pops up
alert( cc ); // alert appears after window is closed. reports
"object Window"
I doubt that...
I never saw that happening before.

What does the ... in your window.open(...) actually hold?
If it holds a normal URL, windowname, etc this shouldn't happen.
Quote:
alert( cc ); // reports "object Object"
Why would 2 subsequent alerts showing the same object give diffent
results if you didn't touch anything in between?
Quote:
}
My guess is you are making a mistake somewhere, or not showing us the
whole story.

Regards,
Erwin Moller

--
"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare
  #9  
Old November 19th, 2008, 10:15 PM
David Mark
Guest
 
Posts: n/a

re: Where's the Window()


On Nov 19, 11:52*am, Martin Rinehart <MartinRineh...@gmail.comwrote:
Quote:
It just gets odder and odder.
>
function popup() { // called on button click
* * var cc = window.open( ... ) // window pops up
* * alert( cc ); // alert appears after window is closed. reports
"object Window"
No, you just didn't see it until you closed the window. It was there
all along.
Quote:
* * alert( cc ); // reports "object Object"
So what? It is a host object. If it wants to report a different type
for closed windows, that is its prerogative.

And yes, you will need some basic mouse position reporting code.
Don't use a canned "drag and drop library" as they are mostly refuse.
  #10  
Old November 19th, 2008, 11:45 PM
The Natural Philosopher
Guest
 
Posts: n/a

re: Where's the Window()


Daniel Orner wrote:
Quote:
Martin Rinehart wrote:
Quote:
>I've got most of the components of a robust color chooser but I'm
>having trouble pulling them together.
>>
>What I want is to have a ready-to-use but not visible pop-up object
>created when the application is loaded. On a click on a color button,
>this thing should pop up as a modal dialog. It should hide when the
>user chooses OK, Cancel or clicks the window closing button.
>>
>"window.open(...)" opens a window, which is not what I want when the
>application loads. My development platform, Opera on Konqueror,
>doesn't support "new Window(...)". This was dead simple in Java (and I
>may still be thinking in Java).
>>
>There's a Java example of where I'm going at
>>
>http://www.MartinRinehart.com/exampl...r-chooser.html
>>
>(This is a slug in Firefox on XP Pro - use any other browser or FF
>with XP Home or any earlier Windows. I've no clue why.)
>>
>The JavaScript version will be better.
>
You'll probably want the content in a div rather than a separate
window. You can hide the div and position/show it when needed. Browsers
generally don't have the idea of "modal" windows in any case, so you'll
need to go this route.

yes. unhide a massive 'glass screen' at z-index 1, and overlay with our
popup div at z-index 2.

Nothing works till you remove the screen :-)
  #11  
Old November 20th, 2008, 01:15 AM
David Mark
Guest
 
Posts: n/a

re: Where's the Window()


On Nov 19, 6:40*pm, The Natural Philosopher <a...@b.cwrote:
Quote:
Daniel Orner wrote:
Quote:
Martin Rinehart wrote:
Quote:
I've got most of the components of a robust color chooser but I'm
having trouble pulling them together.
>
Quote:
Quote:
What I want is to have a ready-to-use but not visible pop-up object
created when the application is loaded. On a click on a color button,
this thing should pop up as a modal dialog. It should hide when the
user chooses OK, Cancel or clicks the window closing button.
>
Quote:
Quote:
"window.open(...)" opens a window, which is not what I want when the
application loads. My development platform, Opera on Konqueror,
doesn't support "new Window(...)". This was dead simple in Java (and I
may still be thinking in Java).
>
Quote:
Quote:
There's a Java example of where I'm going at
>>
Quote:
Quote:
(This is a slug in Firefox on XP Pro - use any other browser or FF
with XP Home or any earlier Windows. I've no clue why.)
>
Quote:
Quote:
The JavaScript version will be better.
>
Quote:
* * You'll probably want the content in a div rather than a separate
window. You can hide the div and position/show it when needed. Browsers
generally don't have the idea of "modal" windows in any case, so you'll
need to go this route.
>
yes. unhide a massive 'glass screen' at z-index 1, and overlay with our
popup div at z-index 2.
And just look at the difference!
Quote:
>
Nothing works till you remove the screen :-)
In your dreams. :(
  #12  
Old November 20th, 2008, 06:45 PM
Martin Rinehart
Guest
 
Posts: n/a

re: Where's the Window()


David Mark wrote:
Quote:
No, you just didn't see it until you closed the window. It was there
all along.
You're right. Opera launches new window in new tab, tricking me.
Quote:
Quote:
� � alert( cc ); // reports "object Object"
Quote:
So what? It is a host object. If it wants to report a different type
for closed windows, that is its prerogative.
I don't care what it reports. Problem is, it morphs from Window to
Object between two consecutive alerts. I don't like sneeky vars that
change type when they think I'm not looking.

The following crap is not finished code, it's try stuff and see what
happens code.

--------------------------------------------------------------------------------------------

<! cc-popup.html - pop up a JavaScript Color Chooser >
<! copyright 2008, Martin Rinehart >

<html lang=en-US>

<head>
<titleCC Popup Button </title>

<meta http-equiv="Content-Script-Type" content="text/javascript">

<script>

function ccpop( who ) {
var cc = window.open( 'javascript:"";', '',
'top=100, left=100, width=450, height=300');
cc.document.write( "Hello from cc" );

alert( cc );
alert( cc );
}

</script>

<style>

font { color:blue; }

.script {
font:32pt 'Free Chancery' italic;
color:#404080
}

</style>

</head>

<body>

<table id=bar
bgcolor=cyan border=5 height=30px width=45px
style='position:relative; top:1px; left:108px;'
onclick=ccpop(this)>
<tr<td</td</tr>
</table>

<center>
<hr width=80%>
<span class=script>
CC Popup
</span>
<hr width=80%>
<p>
<table id=foo
bgcolor=blue border=5 height=30px width=45px
onclick=ccpop(this)
Quote:
>
<tr<td</td</tr>
</table>
</center>

</body>

</html>

<! end of cc-popup.html >
  #13  
Old November 20th, 2008, 06:45 PM
Martin Rinehart
Guest
 
Posts: n/a

re: Where's the Window()


The Natural Philosopher wrote:
Quote:
yes. unhide a massive 'glass screen' at z-index 1, and overlay with our
popup div at z-index 2.
Thanks!
  #14  
Old November 20th, 2008, 07:25 PM
Martin Rinehart
Guest
 
Posts: n/a

re: Where's the Window()


Martin Rinehart wrote:
Quote:
I don't care what it reports. Problem is, it morphs from Window to
Object between two consecutive alerts. I don't like sneeky vars that
change type when they think I'm not looking.
Now I've got it. New window is opened on tab two, on which Opera also
shows content of tab one pre-window opening. Alert pops on tab one,
but I'm looking at tab two. Closing the window on tab two also closes
tab two and returns to tab one, which is paused because the alert is
modal. OK the alert and execution resumes, which is the second alert.
Since there is no more window, the var is now just an Object.

Now, you guys cheerfully inform me, all that remains to do to get my
Color Chooser working is to write a little windowing OS in JS. No
wonder I couldn't find a decent color chooser already written.
  #15  
Old November 21st, 2008, 09:45 AM
Erwin Moller
Guest
 
Posts: n/a

re: Where's the Window()


Martin Rinehart schreef:
Quote:
Martin Rinehart wrote:
Quote:
>I don't care what it reports. Problem is, it morphs from Window to
>Object between two consecutive alerts. I don't like sneeky vars that
>change type when they think I'm not looking.
>
Now I've got it. New window is opened on tab two, on which Opera also
shows content of tab one pre-window opening. Alert pops on tab one,
but I'm looking at tab two. Closing the window on tab two also closes
tab two and returns to tab one, which is paused because the alert is
modal. OK the alert and execution resumes, which is the second alert.
Since there is no more window, the var is now just an Object.
>
Now, you guys cheerfully inform me, all that remains to do to get my
Color Chooser working is to write a little windowing OS in JS. No
wonder I couldn't find a decent color chooser already written.
Personally I think decent color choosers are written inline, in a div
that can be hidden/shown. Popups are often blocked.

Regards,
Erwin Moller


--
"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access Relationships Window: Proper Layout? alexandre.brisebois@gmail.com answers 4 June 25th, 2006 04:55 AM
window object yb answers 26 March 6th, 2006 12:05 AM
Opening image in new window without padding D. Alvarado answers 14 July 23rd, 2005 10:57 PM
window.opener.location.reload() Darren answers 19 July 23rd, 2005 08:42 PM
The ongoing new-window Resize debate David Hayes answers 6 July 23rd, 2005 05:34 PM