473,396 Members | 1,987 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,396 software developers and data experts.

Where's the Window()

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.
Nov 19 '08 #1
14 1352
Martin Rinehart schreef:
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
Nov 19 '08 #2
Martin Rinehart wrote:
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.
Nov 19 '08 #3
Daniel Orner wrote:
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?
Nov 19 '08 #4
Erwin Moller wrote:
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.
Nov 19 '08 #5
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"
}
Nov 19 '08 #6
Martin Rinehart schreef:
Erwin Moller wrote:
>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
Nov 19 '08 #7
Martin Rinehart schreef:
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.
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?
}
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
Nov 19 '08 #8
On Nov 19, 11:52*am, Martin Rinehart <MartinRineh...@gmail.comwrote:
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.
* * 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.
Nov 19 '08 #9
Daniel Orner wrote:
Martin Rinehart wrote:
>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 :-)
Nov 19 '08 #10
On Nov 19, 6:40*pm, The Natural Philosopher <a...@b.cwrote:
Daniel Orner wrote:
Martin Rinehart wrote:
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.
And just look at the difference!
>
Nothing works till you remove the screen :-)
In your dreams. :(
Nov 20 '08 #11
David Mark wrote:
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.
� � 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.
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)
>
<tr<td</td</tr>
</table>
</center>

</body>

</html>

<! end of cc-popup.html >
Nov 20 '08 #12
The Natural Philosopher wrote:
yes. unhide a massive 'glass screen' at z-index 1, and overlay with our
popup div at z-index 2.
Thanks!
Nov 20 '08 #13
Martin Rinehart wrote:
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.
Nov 20 '08 #14
Martin Rinehart schreef:
Martin Rinehart wrote:
>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
Nov 21 '08 #15

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

Similar topics

2
by: Nat | last post by:
Hi there, I have code as following but it returns error Error Type: Microsoft VBScript compilation (0x800A03F6) Expected 'End' /urbisjhdintranet/metadata/resultList.asp, line 324 which is the...
4
by: Dino M. Buljubasic | last post by:
This might be a silly question but I have never seen this before. I suddenly got some blue squares on the left side (the place where break points are shown if any exist). Anybody knows what...
5
by: Howard Kaikow | last post by:
I know where to find the spec for ECMAScript and the Document Object Model, but where do I find the spec for, e.g.? alert location.href -- http://www.standards.com/; See Howard Kaikow's web...
4
by: Nhmiller | last post by:
This is directly from Access' Help: "About designing a query When you open a query in Design view, or open a form, report, or datasheet and show the Advanced Filter/Sort window (Advanced...
11
by: -Lost | last post by:
I was perusing some code and saw: var theForm = document.forms; if (!theForm) { theForm = document.aspnetForm; } Is this a waste of code? Or is there some instance where bracket notation...
3
by: Curious | last post by:
I''ve created a simple Console Application in C#.NET (.NET 2.0), and I have the following code: Console.WriteLine("Now let us begin!"); However, the string, "Now let us begin!", never shows up...
2
by: Alan Mailer | last post by:
Well this is a new one on me... Suddenly I can't get my "Find" and/or "Replace" window to appear on screen while I'm working on my VB.net code. These windows don't appear if I hit Ctrl-F,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.