Window Manager w/Maximize and Minimize

Discussion in 'Javascript' started by Martin Rinehart, Dec 6, 2008.

  1. My proof-of-concept window manager now includes max/minimize and
    restores:

    http://www.martinrinehart.com/examples/js-wm.html

    It's feature-complete except for resizing. It's miniscule. Now to
    think carefully about how the application coder can use the window
    manager. Design goal: easy as Visual Basic. (Last I looked, "Hello
    World!" in VB cost 3MB.)

    I need a Firefox guru to tell me how to get this running in Eichland.
    (Opera's great, but their market share isn't.)

    Meanwhile I'm going to try to generalize the drag code. Dragging a
    window around by the title bar has a lot in common with dragging a
    side or corner, doesn't it?
    Martin Rinehart, Dec 6, 2008
    #1
    1. Advertising

  2. Martin Rinehart

    SAM Guest

    Le 12/6/08 3:32 PM, Martin Rinehart a écrit :
    > My proof-of-concept window manager now includes max/minimize and
    > restores:
    >
    > http://www.martinrinehart.com/examples/js-wm.html
    >
    > It's feature-complete except for resizing. It's miniscule. Now to
    > think carefully about how the application coder can use the window
    > manager. Design goal: easy as Visual Basic. (Last I looked, "Hello
    > World!" in VB cost 3MB.)
    >
    > I need a Firefox guru to tell me how to get this running in Eichland.
    > (Opera's great, but their market share isn't.)
    >
    > Meanwhile I'm going to try to generalize the drag code. Dragging a
    > window around by the title bar has a lot in common with dragging a
    > side or corner, doesn't it?
    >


    Nothing work in my FF.3 (buttons: - [] [x] )
    I get 8 what I suppose to be tables displayed, nothing more.

    Now, when seeing :
    window.event.cancelBubble = true;
    in the code, all I can say is that speaks only to IE
    (and probably Opera ?)

    Have a look to :
    <http://www.quirksmode.org/js/events_order.html>

    function doSomething(e)
    {
    if (!e) var e = window.event;
    e.cancelBubble = true;
    if (e.stopPropagation) e.stopPropagation();
    }


    See also :
    Listeners and "delegation event model" or "listenners delegation"
    in particular for your tableManager
    tableManager.find_ and so on
    (don't need to "find" the table (index, id, etc.), it'll have its own
    listener that will permit to do no more have functions as
    'clickChooseMe( tableId )' referencing to an individual 'tableId'


    You need no z-index, the browser knows by itself how to display objects
    over the others. To pass in front a table I think you have just to slide
    it at the end of the body : document.body.appendChild(this.table);
    <http://cjoint.com/?mgrCAOCZcd>

    --
    sm
    SAM, Dec 6, 2008
    #2
    1. Advertising

  3. Martin Rinehart

    David Mark Guest

    On Dec 6, 10:43 am, SAM <>
    wrote:
    > Le 12/6/08 3:32 PM, Martin Rinehart a écrit :
    >
    >
    >
    > > My proof-of-concept window manager now includes max/minimize and
    > > restores:

    >
    > >http://www.martinrinehart.com/examples/js-wm.html

    >
    > > It's feature-complete except for resizing. It's miniscule. Now to
    > > think carefully about how the application coder can use the window
    > > manager. Design goal: easy as Visual Basic. (Last I looked, "Hello
    > > World!" in VB cost 3MB.)

    >
    > > I need a Firefox guru to tell me how to get this running in Eichland.
    > > (Opera's great, but their market share isn't.)

    >
    > > Meanwhile I'm going to try to generalize the drag code. Dragging a
    > > window around by the title bar has a lot in common with dragging a
    > > side or corner, doesn't it?

    >
    > Nothing work in my FF.3 (buttons: - [] [x] )
    > I get 8 what I suppose to be tables displayed, nothing more.
    >
    > Now, when seeing :
    >        window.event.cancelBubble = true;
    > in the code, all I can say is that speaks only to IE
    > (and probably Opera ?)
    >
    > Have a look to :
    > <http://www.quirksmode.org/js/events_order.html>
    >
    > function doSomething(e)
    > {
    >         if (!e) var e = window.event;


    e = e || window.event; // Don't need to declare e

    >         e.cancelBubble = true;


    // Don't augment host objects, especially the event object.

    >         if (e.stopPropagation) e.stopPropagation();


    // Should detect that method with typeof and skip the cancelBubble
    addition if present.

    [snip]
    David Mark, Dec 6, 2008
    #3
  4. David Mark wrote:
    > SAM wrote:
    >> [...]
    >> Have a look to :
    >> <http://www.quirksmode.org/js/events_order.html>
    >>
    >> function doSomething(e)
    >> {
    >> if (!e) var e = window.event;

    >
    > e = e || window.event; // Don't need to declare e


    if (!e) e = window.event;

    And don't forget after that

    if (!e) return true;

    or something like it.

    >> e.cancelBubble = true;

    >
    > // Don't augment host objects, especially the event object.


    It isn't augmentation in the MSHTML DOM. In order to avoid augmentation of
    host objects, try to check if the property exists before assigning to it.

    if (typeof e.cancelBubble != "undefined")
    {
    e.cancelBubble = true;
    }

    >> if (e.stopPropagation) e.stopPropagation();

    >
    > // Should detect that method with typeof and skip the cancelBubble
    > addition if present.


    ACK, the standards-compliant approach should have precedence.


    PointedEars
    --
    Prototype.js was written by people who don't know javascript for people
    who don't know javascript. People who don't know javascript are not
    the best source of advice on designing systems that use javascript.
    -- Richard Cornford, cljs, <f806at$ail$1$>
    Thomas 'PointedEars' Lahn, Dec 6, 2008
    #4
  5. Martin Rinehart

    David Mark Guest

    On Dec 6, 5:52 pm, Thomas 'PointedEars' Lahn <>
    wrote:
    > David Mark wrote:
    > > SAM wrote:
    > >> [...]
    > >> Have a look to :
    > >> <http://www.quirksmode.org/js/events_order.html>

    >
    > >> function doSomething(e)
    > >> {
    > >>         if (!e) var e = window.event;

    >
    > > e = e || window.event; // Don't need to declare e

    >
    >   if (!e) e = window.event;


    Bah.

    >
    > And don't forget after that
    >
    >   if (!e) return true;


    I suppose. But how does it help to return true?

    >
    > or something like it.


    return;

    >
    > >>         e.cancelBubble = true;

    >
    > > // Don't augment host objects, especially the event object.

    >
    > It isn't augmentation in the MSHTML DOM.  In order to avoid augmentation of


    Right, my point is that other DOM's should skip it. I suppose that
    rather than rely on an inference from stopPropagation, it would make
    sense to see if cancelBubble is a boolean, but then what to do if it
    isn't?

    [snip]
    David Mark, Dec 6, 2008
    #5
  6. David Mark wrote:
    > Thomas 'PointedEars' Lahn wrote:
    >> David Mark wrote:
    >>> SAM wrote:
    >>>> [...]
    >>>> Have a look to :
    >>>> <http://www.quirksmode.org/js/events_order.html>
    >>>> function doSomething(e)
    >>>> {
    >>>> if (!e) var e = window.event;
    >>> e = e || window.event; // Don't need to declare e

    >> if (!e) e = window.event;

    >
    > Bah.


    I'm glad you approve.

    >> And don't forget after that
    >>
    >> if (!e) return true;

    >
    > I suppose. But how does it help to return true?


    If the method is used in an intrinsic event handler attribute value or
    proprietary event handler property value, and its return value is returned
    to the event handler, returning `true' has a better chance not to prevent
    the default action for the target element and event.

    >> or something like it.

    >
    > return;


    Since `undefined' is a false-value, it could be considered equivalent to
    `false' by the implementation, which one wants to avoid.

    >>>> e.cancelBubble = true;
    >>> // Don't augment host objects, especially the event object.

    >> It isn't augmentation in the MSHTML DOM. In order to avoid augmentation of

    >
    > Right, my point is that other DOM's should skip it. I suppose that
    > rather than rely on an inference from stopPropagation, it would make
    > sense to see if cancelBubble is a boolean, but then what to do if it
    > isn't?


    You should read my posting whole.

    That said, there are DOMs that support both features, most notably the Gecko
    DOM. However, my tests in Firefox 2.0.x had showed that you must not assign
    `true' to `cancelBubble' before you called stopPropagation() or propagation
    would not be stopped; there was no such problem if the order was reversed.
    This might have been a bug that is fixed now, though.


    PointedEars
    --
    Anyone who slaps a 'this page is best viewed with Browser X' label on
    a Web page appears to be yearning for the bad old days, before the Web,
    when you had very little chance of reading a document written on another
    computer, another word processor, or another network. -- Tim Berners-Lee
    Thomas 'PointedEars' Lahn, Dec 7, 2008
    #6
  7. SAM wrote:

    > You need no z-index, the browser knows by itself how to display objects
    > over the others. To pass in front a table I think you have just to slide
    > it at the end of the body : document.body.appendChild(this.table);


    This is for application programming. The application running in the
    table may be using multiple z-indexes for its own purposes.

    Thanks much for those helpful references.
    Martin Rinehart, Dec 7, 2008
    #7
  8. Mr. Mark and Mr. Lahn:

    Very learned discussion. Thank you.

    I am still not sure how to pull together the various thoughts into a
    bit of best code that will say "OK, this event has been handled, we're
    done with it." (My attempt was something I found by Googling. It
    doesn't work.)
    Martin Rinehart, Dec 7, 2008
    #8
  9. Martin Rinehart wrote:
    > I am still not sure how to pull together the various thoughts into a
    > bit of best code that will say "OK, this event has been handled, we're
    > done with it."


    Why would you need to do that in the first place?

    > (My attempt was something I found by Googling.


    <http://catb.org/~esr/faqs/smart-questions.html#examples>

    > It doesn't work.)


    <http://www.jibbering.com/faq/faq_notes/clj_posts.html#ps1DontWork>


    PointedEars
    --
    var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
    ) // Plone, register_function.js:16
    Thomas 'PointedEars' Lahn, Dec 7, 2008
    #9
  10. Martin Rinehart

    SAM Guest

    Le 12/7/08 1:37 PM, Martin Rinehart a écrit :
    > SAM wrote:
    >
    >> You need no z-index, the browser knows by itself how to display objects
    >> over the others. To pass in front a table I think you have just to slide
    >> it at the end of the body : document.body.appendChild(this.table);

    >
    > This is for application programming. The application running in the
    > table may be using multiple z-indexes for its own purposes.


    ? why ?

    If the "application" is html, following the html flux is enough to get
    all (or each element) well z-indexed. That is automatically made by the
    browser. At worst the DOM does the job (if there is no declared z-index)
    and reconstructs the complet z indexing when something happens (new or
    moved element in the tree).

    .... at least that's what I think.
    maybe I'm in error ? (I do not much know IE's particularities)

    --
    sm
    SAM, Dec 7, 2008
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rene Ruppert
    Replies:
    0
    Views:
    500
    Rene Ruppert
    Aug 18, 2004
  2. leggolas
    Replies:
    3
    Views:
    28,031
    leggolas
    Mar 22, 2005
  3. Erik  Bethke
    Replies:
    1
    Views:
    1,876
    Erik Bethke
    Feb 8, 2005
  4. Mariano
    Replies:
    0
    Views:
    582
    Mariano
    Dec 2, 2006
  5. Godfried van Loo
    Replies:
    1
    Views:
    350
    kaeli
    Dec 5, 2003
Loading...

Share This Page