Deprecated: Function set_magic_quotes_runtime() is deprecated in /home4/mfoster/public_html/cb/forums/include/common.php on line 62

Warning: Cannot modify header information - headers already sent by (output started at /home4/mfoster/public_html/cb/forums/include/common.php:62) in /home4/mfoster/public_html/cb/forums/header.php on line 31

Warning: Cannot modify header information - headers already sent by (output started at /home4/mfoster/public_html/cb/forums/include/common.php:62) in /home4/mfoster/public_html/cb/forums/header.php on line 32

Warning: Cannot modify header information - headers already sent by (output started at /home4/mfoster/public_html/cb/forums/include/common.php:62) in /home4/mfoster/public_html/cb/forums/header.php on line 33

Warning: Cannot modify header information - headers already sent by (output started at /home4/mfoster/public_html/cb/forums/include/common.php:62) in /home4/mfoster/public_html/cb/forums/header.php on line 34
Cross-Browser.com / [xFenster]

Cross-Browser.com

X Library Forums

You are not logged in.

Announcement

New user registration is currently disabled.

#26 February 15, 2010 10:31:08 am

hmel
New Member
Registered: February 9, 2010
Posts: 5

Re: [xFenster]

Ok. Here goes another one)

Features:
1. On winResize, if maximized, sets fenster size\position by fenceID size\position (if fenceID)
2. On create new fenster, updates position\size of fenster with fenceId bounds (if fenceID)
3. Ignores enFixed (if fenceId)
4. Some new, maybe useful, functions (xHideAllFensters, xShowAllFensters, xMinimizeAllFensters, xRestoreAllFensters, xMaximizeAllFensters, xCascadeAllFensters, xFitToWindowAllFensters)


This code will be placed in the constructor of xFenster class

// ignore enFixed if fenceId (and other fixes)
  if (fenceId) {
    enFixed = false;
    me.fFenceId = fenceId;

    // update position\size of fenster with fenceId bounds
    pf = xGetElementById(fenceId);
    px = xLeft(pf);
    pw = xWidth(pf);
    py = xTop(pf);
    ph = xHeight(pf);

    if (iniX < px) iniX = px;
    else if (iniX > (px + pw) - 150) { iniX = px; iniY = py; }
    if (iniY < py) iniY = py;
    else if (iniY > (py + ph) - 100) { iniX = px; iniY = py; }

    if (iniW + iniX > pw + px) {
        iniW = pw + px - iniX;
    }
    if (iniH + iniY > ph + py) {
        iniH = ph + py - iniY;
    }

    me.conW = iniW;
    me.conH = iniH;
  }




in-class function

function winResize()
  {
    if (me.maximized) {
      xResizeTo(me.con, 100, 100); // ensure fenster isn't causing scrollbars

// ===========================HMEL===================================
// set fenster size\position by fenceID size\position (if fenceID)
// ===========================HMEL===================================
    if (fenceId) {
        pf = xGetElementById(fenceId);
        me.conW = xWidth(pf);
        me.conH = xHeight(pf);
        me.paint(0, 0);
    }
    else {
        if (!enFixed) xMoveTo(me.con, xScrollLeft(), xScrollTop());
        me.conW = xClientWidth();
        me.conH = xClientHeight();
        me.paint(0, 0);
    }
// ===========================HMEL===================================
    }
  }




And here new (not in-class) functions

function xHideAllFensters(pxFenster)
{
// hides all fensters in pxFenster
    if (pxFenster) {
        var o = pxFenster.instances;
        if (o)
            for (io in o)
                if (o[io]) o[io].hide();
    }
}

function xShowAllFensters(pxFenster)
{
// shows all fensters in pxFenster
    if (pxFenster) {
        var o = pxFenster.instances;
        if (o)
            for (io in o)
                if (o[io]) o[io].show();
    }
}

function xMinimizeAllFensters(pxFenster)
{
// minimizes all fensters in pxFenster
    if (pxFenster) {
        var o = pxFenster.instances;
        if (o)
            for (io in o)
                if (o[io]) o[io].minimize();
    }
}

function xRestoreAllFensters(pxFenster)
{
// restores all fensters in pxFenster
    if (pxFenster) {
        var o = pxFenster.instances;
        if (o)
            for (io in o)
                if (o[io]) o[io].restore();
    }
}

function xMaximizeAllFensters(pxFenster)
{
// maximizes all fensters in pxFenster
    if (pxFenster) {
        var o = pxFenster.instances;
        if (o)
            for (io in o)
                if (o[io]) o[io].maximize();
    }
}

function xGetFirstFenster(pxFenster)
{
// get first created fenster
    if (pxFenster) {
        var o = pxFenster.instances;
        if (o)
            for (io in o)
                if (o[io]) return(o[io]);
    }
}

function xCascadeAllFensters(pxFenster, pFenW, pFenH, pOffX, pOffY) {
// set cascade position to all fensters in pxFenster
// pFenW, pFenH - size of fensters
// pOffX, pOffY - offsets
// let's assume that all fensters have same fenceId
//    if else - hmm... need to think

    if (pxFenster) {
        var o = pxFenster.instances, px = 0, py = 0, ph = xClientHeight(), pw = xClientWidth();

        x = 0; y = 0;
        ff = xGetFirstFenster(pxFenster);
        if (ff.fFenceId) {
            pf = xGetElementById(ff.fFenceId);
            px = xLeft(pf);
            py = xTop(pf);
            ph = xHeight(pf);
            pw = xWidth(pf);
            x = px; y = py;
        }

        if (pOffX == 0) pOffX = 20;
        if (pOffY == 0) pOffY = 20;
        if (pFenW == 0) pFenW = 300;
        if (pFenH == 0) pFenH = 150;

        if (pOffX > pw/2) pOffX = pw/2;
        if (pOffY > ph/2) pOffY = ph/2;
        if (pFenW > pw/2) pFenW = pw/2;
        if (pFenH > ph/2) pFenH = ph/2;

        if (o)
            for (io in o)
                if (o[io] && !o[io].maximized && !o[io].minimized && !o[io].hidden) {
                    if (x + pFenW > px + pw) x = px;
                    if (y + pFenH > py + ph) y = py;

                    o[io].conW = pFenW;
                    o[io].conH = pFenH;
                    o[io].paint(0, 0);
                    xMoveTo(o[io].con, x, y);
                    x += pOffX; y += pOffY;
                };
    }
}

function xFitToWindowAllFensters(pxFenster, pRows, pCols) {
// fits all fensters in pxFenster to window (parent fence)
// pRows, pCols - row\column count
// 150x100 - minimum size for fensters
// let's assume that all fensters have same fenceId
//    if else - hmm... need to think

    if (pxFenster) {
        var o = pxFenster.instances, px = 0, py = 0, ph = xClientHeight(), pw = xClientWidth();

        x = 0; y = 0;
        ff = xGetFirstFenster(pxFenster);
        if (ff.fFenceId) {
            pf = xGetElementById(ff.fFenceId);
            px = xLeft(pf);
            py = xTop(pf);
            ph = xHeight(pf);
            pw = xWidth(pf);
            x = px; y = py;
        }

        if (pRows == 0) pRows = 4;
        if (pCols == 0) pCols = 3;

        pFenW = pw/pCols;
        pFenH = ph/pRows;

        if (pFenW < 150) {
            pCols = Math.round(pw/150);
            pFenW = pw/pCols;
        }
        if (pFenH  < 100) {
            pRows = Math.round(ph/100);
            pFenH = ph/pRows;
        }

        pOffX = pFenW;
        pOffY = pFenH;

        if (o)
            for (io in o)
                if (o[io] && !o[io].maximized && !o[io].minimized && !o[io].hidden) {
                    if (x + pFenW > px + pw) {
                        x = px;
                        y += pOffY;
                    }
                    if (y + pFenH > py + ph) {
                        y = py;
                        x = px;
                    }

                    o[io].conW = pFenW;
                    o[io].conH = pFenH;
                    o[io].paint(0, 0);
                    xMoveTo(o[io].con, x, y);
                    x += pOffX;
                };
    }
}

Last edited by hmel (February 15, 2010 10:49:57 am)

Offline

 

#27 February 16, 2010 9:21:53 am

hmel
New Member
Registered: February 9, 2010
Posts: 5

Re: [xFenster]

I've found some bugs in my code (functions restore() and minClick() ).

the code:

me.restore()
....
me.tbar.xDragEnabled = true;
me.rbtn.xDragEnabled = true;
....

minClick()
....
me.tbar.xDragEnabled = false;
me.rbtn.xDragEnabled = false;
....



should be replaced with this code:

me.restore()
....
if (me.tbar) me.tbar.xDragEnabled = true;
if (me.rbtn) me.rbtn.xDragEnabled = true;
....

minClick()
....
if (me.tbar) me.tbar.xDragEnabled = false;
if (me.rbtn) me.rbtn.xDragEnabled = false;
....

Last edited by hmel (February 16, 2010 9:30:11 am)

Offline

 

#28 March 10, 2010 11:28:07 am

MikeFoster
Administrator
From: Alabama, USA
Registered: April 27, 2007
Posts: 874
Website

Re: [xFenster]

Hi hmel, thanks again!

Do you have a page available where we can see these things in action?

Offline

 

#29 March 12, 2010 8:18:18 am

hmel
New Member
Registered: February 9, 2010
Posts: 5

Re: [xFenster]

I've uploaded a simple test, probably, it will be enough:

Updated xFenster test

Last edited by hmel (March 12, 2010 8:20:32 am)

Offline

 

#30 March 12, 2010 11:11:23 am

MikeFoster
Administrator
From: Alabama, USA
Registered: April 27, 2007
Posts: 874
Website

Re: [xFenster]

Very cool! Thanks! tup

Offline

 

#31 March 12, 2010 2:38:26 pm

hmel
New Member
Registered: February 9, 2010
Posts: 5

Re: [xFenster]

Damn! I forgot to upload fenster images... Now it looks better smile

Offline

 

#32 March 12, 2010 7:08:37 pm

MikeFoster
Administrator
From: Alabama, USA
Registered: April 27, 2007
Posts: 874
Website

Re: [xFenster]

Oh yes, much better smile

Offline

 

#33 July 26, 2010 12:38:32 pm

tsteam
New Member
Registered: July 26, 2010
Posts: 1

Re: [xFenster]

Hi everybody

I've recently interface xFenster with an ASP.NET server control
But I've got one problem : the implementation of the destroy method

when my page use partial rendering (understanding AJAX post back) I need to call this method and it's works fine
but when my page perform a full post back calling this method crash

My investigations are that the window unload event occurs before/during my call to the destroy method
which generate a null reference exception when the method access to the me variable

To resolve my problem, I rewrite the destroy method like that :

  me.destroy = function ()
  {
    xRemoveEventListener(window, 'unload', winUnload, false);
    xRemoveEventListener(window, 'resize', winResize, false);
    if (me != null)
    {
      me.hide();
      me.con.parentNode.removeChild(me.con);
      winUnload();
    }
  };

the main changes are :
-> don't access the "me" variable before removing the unload event
-> test the "me" variable before using it
-> remove the try catch (I prefer catch myself the error than having a library that display an unwanted alert message)

I hope this fix will help

Offline

 

#34 July 27, 2010 9:44:56 am

MikeFoster
Administrator
From: Alabama, USA
Registered: April 27, 2007
Posts: 874
Website

Re: [xFenster]

Hi tsteam, Welcome to the forum!

Hey that's great! Thank you very much! I'll make a note to make this change in the library at the next update.

All the best! smile

Offline

 

#35 August 16, 2010 6:24:24 pm

4and25
New Member
Registered: August 16, 2010
Posts: 3

Re: [xFenster]

I've encountered an xFenster problem that I've been unable to resolve.

Specific to iFramed content within a fenster, when the contentbox element (me.client object) of an unfocused fenster is clicked... although the click event passes through to the framed content, the parent clicked fenster fails to gain focus.

The condition is evident in these demo pages:
http://cross-browser.com/x/examples/xfenster4.php
http://cross-browser.com/x/examples/xfenster2.php
(same result when viewed via Opera, SE Iron, or Firefox)

In an attempt to resolve this, I added an event listener... but it failed to achieve the desired result.

// register event listeners
if (me.isIFrame) {
. . .
xAddEventListener(me.client.contentWindow, 'click', function(){ if(!me.focused){me.focus();}}, false);
}

I'm saying/suggesting the desired (perhaps expected) behavior would be:

When user clicks on the "client area" of a partially-obscured (nonfocused) fenster, its container should achieve focus. The user should not need to (drag other fensters out of the way, then) click the "titlebar" belonging to the fenster of interest, in order to focus on that container.

Thanks in advance for any assistance you care to provide.

Last edited by 4and25 (August 16, 2010 6:28:46 pm)

Offline

 

#36 August 16, 2010 9:15:35 pm

DaveMorton
Member
From: Carson City, NV
Registered: November 27, 2009
Posts: 49
Website

Re: [xFenster]

Hi, 4and25, and welcome.

Mike is the one to bring this up to, I believe, and while he checks the forum as often as he can, sometimes his schedule prevents him from doing so as often as he would like. It may take a while, but he'll see this, and will likely point you in the right direction. smile

[edit]by "a while", I mean no more than a day or two. Sorry about not pointing that out at first. smile [/edit]

Last edited by DaveMorton (August 16, 2010 9:16:49 pm)


Safe, Reliable Insanity, since 1961!
http://www.geekcavecreations.com

Offline

 

#37 August 17, 2010 1:40:46 am

4and25
New Member
Registered: August 16, 2010
Posts: 3

Re: [xFenster]

(unrelated to my previous post)

I agree that a winResize() method has merit, but the suggested code (posted earlier in this thread) seems misdirected. I don't care about "preventing scroll bars" -- I *do* care to prevent fensters from disappearing, offscreen, if user resizes the window smaller.

I'm not planning to use 'fences', and have excluded consideration toward such, but I've taken a stab at extending the proposed winResize()

function winResize() {

if (me.maximized) {
xMoveTo(me.con, xScrollLeft(), xScrollTop());
me.conW = xClientWidth();
me.conH = xClientHeight();
me.paint(0, 0);

} else if(me.minimized) {
var alla=0, o=xFenster.instances;                 
for (i in o) {

if(
o.hasOwnProperty(i) 
&& o[i] && o[i].minimized
&& (
o[i].con.offsetTop > xClientHeight()
|| o[i].con.offsetLeft > xClientWidth()
)
) {

// TODO: this could certainly be better handled
alla += o[i].miniW;
xMoveTo(o[i].con,xScrollLeft()+alla, xClientHeight() -18);
} // end *if*

} // end *for-in*

} else {

if( me.con.offsetTop > xClientHeight() ) {               
xMoveTo(me.con, me.con.offsetLeft, xClientHeight() - 50 );
}

if ( me.con.offsetLeft > dpu.xClientWidth() ) {
dpu.xMoveTo(me.con, dpu.xClientWidth() -100 , me.con.offsetTop );
}

} // end *else*

} // end *function*



The above code works ...but not elegantly. I got tripped up trying to establish offsetLeft for multiple minimized fensters (calling minClick() didn't help) and, as is, the code can result in multiple open fensters being repositioned *exactly* atop one another, at the lower left corner of the window.

additional thoughts / rationale:

even if a fenster is 'fixed', we still need to reposition it when it winds up offscreen!

any currently 'hidden' fensters require onResize handling (or they may be located offscreen when later displayed)

If fences and / or 'fixed' position fensters are employed, you really should not permit the containers to be minimized, because they'll often wind up outside the fence, undraggable, when minimized.

Last edited by 4and25 (August 17, 2010 1:43:57 am)

Offline

 

#38 August 17, 2010 8:39:37 am

MikeFoster
Administrator
From: Alabama, USA
Registered: April 27, 2007
Posts: 874
Website

Re: [xFenster]

Hi 4and25, welcome to the forum!

You can't listen for events in an iframe from outside the iframe. At least, not if the main page and iframe page are loaded from different domains. A possible solution might be, when an iframe fenster is not focused, cover it with a semi-transparent div which would accept a click to refocus - then the cover could be removed.

You know, it seems like I did that at one time ... ? ... hmmm

Sorry but I just saw your second post and haven't had much time to think about it. Interesting - you have a good point there.

(thanks Dave!)

Offline

 

#39 August 17, 2010 11:06:39 am

DaveMorton
Member
From: Carson City, NV
Registered: November 27, 2009
Posts: 49
Website

Re: [xFenster]

(any time, Mike! I got your back. smile )


Safe, Reliable Insanity, since 1961!
http://www.geekcavecreations.com

Offline

 

#40 August 18, 2010 12:42:12 am

MikeFoster
Administrator
From: Alabama, USA
Registered: April 27, 2007
Posts: 874
Website

Re: [xFenster]

Woah... this thread is about to hit 20,000 views! Wow!  8-O  Who will be the 20,000th viewer of this thread? smile

4and25, you have some great ideas there - but I'm gonna have to take some time to figure out where I am on this xFenster project before I add anything else to it. I'm afraid I'm letting it get unorganized. To try to catch up a little, here's what I've done...

If you've looked at all the xFenster demos then you know the default rev is 18, however I had started on an experimental version, which is r19.1. I now see that I had also started on r19.2 (an unreleased rev) around 13Feb2010. r19.2 added some contributions by user 'hmel'. The sources for these two experimental revs are now here:
xfenster19.1.js
xfenster19.2.js
The r19.2 source file has comments on the features I was implementing at that time, as contributed by 'hmel'. I've now updated demo 5, and added demo 6, to use r19.2. I've updated the xfenster.xml file to provide, at least a little, documentation on these things. I have not yet updated the X distribution download file.

I'm curious, 4and25, what rev are you using?

Offline

 

#41 August 25, 2010 10:08:10 pm

4and25
New Member
Registered: August 16, 2010
Posts: 3

Re: [xFenster]

I believe the version I modded from was R18. It definitely wasn't the xfenster2... nor the R19 (I wasn't looking for cookie functionality).

Offline

 

#42 November 11, 2010 9:12:24 pm

MikeFoster
Administrator
From: Alabama, USA
Registered: April 27, 2007
Posts: 874
Website

Re: [xFenster]

I've made some progress working on everyone's suggestions in this thread. I'm not finished, but I have a few things implemented and I'm still working on it. Here's a link to the demos.

Offline

 

Board footer

Powered by PunBB 1.2.15
Copyright © 2002–2005 Rickard Andersson

Expand Restore Select Format Eval Load