[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
www.dhtmlgoodies.com • View topic - Floating Window(s)
Advertisement

Floating Window(s)

Moderators: Calcifer, slothy

Floating Window(s)

Postby allanjr » Thu Feb 15, 2007 11:17 am

A friend of mine turned me on to www.dhtmlgoodies.com, and I gotta say this is an excellent site for resources!
----------------

Here's my question:

I'm using Perl to generate webpages for my students. They study various topics, and I've given them a button to add a sticky-note (floating window) to the topic. I've removed the "cookie" option, because I want to position the stickies on the screen statically (but they can be moved/resized by the user).

The problem I run into is that I know of no way to count the currently open windows, or to know which one is open. This would be helpful.

For example, I click "Create sticky", a note is created and in position. I create 2 or 3 other ones, but I go back and close the first. The 4th one I create doesn't move into the position of the first one, they just keep appending to the WindowArray..[list] in new places on the screen, so I have to deal with re-arranging them on the screen manually. Is there a way to identify them and their positions on screen?
allanjr
 
Posts: 2
Joined: Thu Feb 15, 2007 11:10 am
Location: Vietnam : Ho Chi Minh : Ho Chi Minh

Postby slothy » Thu Feb 15, 2007 12:14 pm

hi Allan

welcome to the forum...

i am not that hot on Perl so i cant give you any specific help on that....however, having said that, what you require is, of course, fully implementable in Javascript....

I myself am thinking of adapting windows suite for my own needs and have been thinking about the issues you mention here.....

it depends whether you using the stand-alone windows version or the dhtml suite implementation as to how you handle the window states :-

1) to code position of windows on screen Alf has created generic methods (in the dhtml_suite implementation) for example slideWindowToXAndY.... but it would be easy to have a little function to set the XY coordinates of the parent Window DIV.

2) Now with regards to your windows ..... i am assuming that once you close a window you either no longer require it or you want to be able to re-invoke it?


But it doesnt really matter.....

somewhere you have to have a variable which stores the currently active window activeWindow say. this is just an index to the windowsArray. This changes when you click on another window or close a window or create a new one


Now when you close this window you have to have some algorithm to make the activeWindow another one (if another exists) ... this could be either the next open window in the list (you know which it would be from activeWindow...if this was 2 then active window would = 3 [if 3 doesnt exist then 1 :) ] or basically the first one ie activeWindow = 1.

When you create a new window this automatically becomes the activeWindow.. (you would set it yourself when you create it) you can position this new window using the javascript functions (left and top or any other way) if you want them in predetermined locations

it is not that easy if you are not that au fait with JS but not that tricky either

if you dont want to have windows reinvoked and dont want to clog up array every time you close a window you could bubble the window references down in windowsArray so you have no unnecessary wastage. ie if you delete 2 and you have 5 windows 3 takes position of 2 4 takes position of 3 etc)

if you want to be able to reinvoke them you, of course, have to have some way of recording whether a window is visible or hidden ( this is done simple using style.display == 'none')

Alex
slothy
Moderator
 
Posts: 58
Joined: Fri Aug 25, 2006 1:42 pm

Postby allanjr » Thu Feb 15, 2007 2:13 pm

allanjr
 
Posts: 2
Joined: Thu Feb 15, 2007 11:10 am
Location: Vietnam : Ho Chi Minh : Ho Chi Minh


Return to Window script questions

Who is online

Users browsing this forum: No registered users and 1 guest

cron