Results 1 to 10 of 10

Thread: Windows Widget minimize function

  1. #1
    Join Date
    May 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Windows Widget minimize function

    1) Script Title: Script: DHTML Window widget
    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...ndow/index.htm

    3) Describe problem: I have searched the forums but have not found what I'm looking for. Is there a method in which I can open a dhtmlwindow but then immediately minimize it? I've tried following the code but cannot get the correct parameters to pass to make this happen.

    In the end, I would like to load several dhtmwindows as a user front page and if they minimize, I want to capture that and load it like that the next time they refresh or visit the home page. If I can manipulate the minimize function then I can insert the value into a PHP variable and use that when the user comes back to the page.

    Any help is appreciated.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Have you checked out this blog post: http://www.dynamicdrive.com/forums/blog.php?b=31 ?
    DD Admin

  3. The Following User Says Thank You to ddadmin For This Useful Post:

    Maddawg6 (05-14-2010)

  4. #3
    Join Date
    May 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    YES! I searched and searched but couldn't find that one post I so needed. Thanks much for pointing me in the right direction!

    I'm off and running. Thanks again for the great work that this site provides!

  5. #4
    Join Date
    May 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    OK, so that started me down another path. Now that I know how to call up the minimize function, there is an issue when calling it multiple times.

    The example is:
    Code:
    dhtmlwindow.minimize(googlewin.controls.firstChild, googlewin)
    The problem is that multiple dhtml windows will minimize but they minimize in their associated x,y position rather than nicely stacked in the lower left. When the page loads they all appear in the lower left but at the end they move. The only one that will stay minimized in the lower left is the first one loaded within the web page.

    I've already been able to modify the script within other posts to help with maximizing so if you have any thoughts on this minimize issue throw them out there please and maybe that will help trigger something towards a solution.

    THANKS!

  6. #5
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Ah yes I see it. The issue occurs because the minimized function is called "too early", before certain calculations have been completed yet. One workaround is to call the function after the page has loaded. The caveat is that each DHTML window may appear briefly on the page before it disappears.

    To call the minimize function when the page has loaded, wrap the original function with the code in red:

    Code:
    dhtmlwindow.addEvent(window, function(){dhtmlwindow.minimize(googlewin.controls.firstChild, googlewin)}, "load")
    DD Admin

  7. #6
    Join Date
    May 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hmmm, so I tried this. I commented out the old and put this new code right under it. Same issue. So then I started thinking about what you said in that not everything is loading so I placed this new code as the last piece of code in the same web page. Nada.

    So is your assumption that this new code calls the event after the page has loaded? Any other suggestions?

  8. #7
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    It should work- I tried it on the DHTML windows in demo.htm (file you downloaded as part of the zip). Do the windows minimize for you, just still in the wrong place? A link to the problem page would help.
    DD Admin

  9. #8
    Join Date
    May 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    It only works in your example because it is the first dhtml window loaded. The "effect" I'm referencing only happens when trying to minimize multiple dhtml windows. Try this minimize code for both the 1st and 2nd dhtml example windows and you'll see the 2nd window load, minimize and then move the minimized window to its first loaded position. The 2nd minimized window will not stay nicely stacked in the lower left of the screen...

    Also, unfortunately I cannot provide a link because what I am working on is an internal site... it is also sensitive in nature thus I cannot post code snipets from my work... sorry...
    Last edited by Maddawg6; 05-17-2010 at 02:03 PM. Reason: Updated info

  10. #9
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Ah yes you're right. Time for a new approach. Try the modified .js file instead, which builds this feature in. Then, to have a DHTML window initially minimized, just define the attribute in red below when opening a window:

    Code:
    var googlewin=dhtmlwindow.open("googlebox", "iframe", "http://images.google.com/", "#1: Google Web site", "width=590px,height=350px,resize=1,scrolling=1,center=1,minimize=1", "recal")
    p.s: You should remove the code I posted earlier above to minimize a window, as it's not longer needed:

    Code:
    dhtmlwindow.addEvent(window, function(){dhtmlwindow.minimize(googlewin.controls.firstChild, googlewin)}, "load")
    DD Admin

  11. The Following User Says Thank You to ddadmin For This Useful Post:

    Maddawg6 (05-18-2010)

  12. #10
    Join Date
    May 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    That is the solution! THANKS!

    I also needed the maximize feature to work so I've uploaded the js file I've been working on so this now includes the ability to minimize a dhtml window upon loading along with the ability to maximize.

    On another note, I am now trying to get this script to use the Maximize button while a window is in a minimized state, and use the Minimize button while a window is in a maximized state.



    Attachment 3313

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •