Where's the Window()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Rinehart

    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



    (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.
  • Erwin Moller

    #2
    Re: Where's the Window()

    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
    >

    >
    (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

    Comment

    • Daniel Orner

      #3
      Re: Where's the Window()

      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
      >

      >
      (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.

      Comment

      • Martin Rinehart

        #4
        Re: Where's the Window()

        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?

        Comment

        • Martin Rinehart

          #5
          Re: Where's the Window()

          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.

          Comment

          • Martin Rinehart

            #6
            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"
            }

            Comment

            • Erwin Moller

              #7
              Re: Where's the Window()

              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

              Comment

              • Erwin Moller

                #8
                Re: Where's the Window()

                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

                Comment

                • David Mark

                  #9
                  Re: Where's the Window()

                  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.

                  Comment

                  • The Natural Philosopher

                    #10
                    Re: Where's the Window()

                    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 :-)

                    Comment

                    • David Mark

                      #11
                      Re: Where's the Window()

                      On Nov 19, 6:40 pm, The Natural Philosopher <a...@b.cwrot e:
                      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
                      >>
                      (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. :(

                      Comment

                      • Martin Rinehart

                        #12
                        Re: Where's the Window()

                        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.wri te( "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(t his)>
                        <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(t his)
                        >
                        <tr<td</td</tr>
                        </table>
                        </center>

                        </body>

                        </html>

                        <! end of cc-popup.html >

                        Comment

                        • Martin Rinehart

                          #13
                          Re: Where's the Window()

                          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!

                          Comment

                          • Martin Rinehart

                            #14
                            Re: Where's the Window()

                            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.

                            Comment

                            • Erwin Moller

                              #15
                              Re: Where's the Window()

                              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

                              Comment

                              Working...